core-lightning/plugins/bkpr
2024-11-18 17:46:40 +01:00
..
test db: Instrument the DB interactions to trace their execution 2024-11-18 17:46:40 +01:00
account_entry.c bkpr: track channel rebalances, display in listincome 2022-08-09 11:57:18 +09:30
account_entry.h bkpr: track channel rebalances, display in listincome 2022-08-09 11:57:18 +09:30
account.c bkpr: new method, "is_external_account" 2022-07-28 12:08:18 +09:30
account.h bkpr: new method, "is_external_account" 2022-07-28 12:08:18 +09:30
bookkeeper.c bkpr: add examples for new edit description RPC calls 2024-11-12 09:46:09 +10:30
chain_event.c cleanup: rename json_add_amount_msat_only to json_add_amount_msat 2023-03-18 15:55:49 +10:30
chain_event.h bkpr: properly account for fees and channel closures if splice 2024-08-08 12:30:53 -07:00
channel_event.c common/amount: rename amount_sat_zero/amount_msat_zerp -> amount_sat_is_zero/amount_msat_is_zero. 2024-09-19 12:16:53 +09:30
channel_event.h bkpr: track channel rebalances, display in listincome 2022-08-09 11:57:18 +09:30
channelsapy.c common/amount: rename amount_sat_zero/amount_msat_zerp -> amount_sat_is_zero/amount_msat_is_zero. 2024-09-19 12:16:53 +09:30
channelsapy.h bkpr: command to calculate some APYs/stats on channel routing fees 2022-07-28 12:08:18 +09:30
db.c bookkeeper: fix up out-of-order migrations in rc1 2024-08-16 07:18:29 +09:30
db.h bkpr: now that we're not doing empty acct logging, we dont need this bool 2024-01-29 10:05:03 +10:30
incomestmt.c common/amount: rename amount_sat_zero/amount_msat_zerp -> amount_sat_is_zero/amount_msat_is_zero. 2024-09-19 12:16:53 +09:30
incomestmt.h bkpr csvs: koinly + cointracker only accept fees on the same line 2022-07-28 12:08:18 +09:30
Makefile wallet: add channel_type field to db. 2023-04-10 17:26:47 +09:30
onchain_fee.c cleanup: rename json_add_amount_msat_only to json_add_amount_msat 2023-03-18 15:55:49 +10:30
onchain_fee.h bkpr: move json_to functions to respective type files 2022-07-28 12:08:18 +09:30
README.md bkpr: add two custom notifications that we listen for 2024-08-09 10:21:44 +09:30
recorder.c bkpr: add new RPC bkpr-editdescriptionbyoutpoint 2024-11-12 09:46:09 +10:30
recorder.h bkpr: add new RPC bkpr-editdescriptionbyoutpoint 2024-11-12 09:46:09 +10:30

The bookkeeper keeps track of coins moving through your Lightning node.

See the doc/PLUGINS.md#coin_movement section on the message that CLN emits for us to process.

// FIXME: add more detailed documenation for how bookkeeper works.

3rd Party Coin Movements

Bookeeper ingests 3rd party plugin notifications about on-chain movements that it should watch.

This allows for us to account for non-internal on-chain wallets in the single place, making bookkeeper your single source of truth for bitcoin for an organization or node-operator.

As a plugin writer, if you want to emit onchain events that the bookkeeper should track, you should emit an event with the following format:

{
	"utxo_deposit": {
		"account": "nifty's secret stash",
		"transfer_from: null,
		"outpoint": xxxx:x,
		"amount_msat": "10000sat",
		"coin_type": "bc",
		"timestamp": xxxx,
		"blockheight": xxx,
	}
}
{
	"utxo_spend": {
		"account": "nifty's secret stash",
		"outpoint": xxxx:x,
		"spending_txid": xxxx,
		"amount_msat": "10000sat",
		"coin_type": "bc",
		"timestamp": xxxx,
		"blockheight": xxx,
	}
}

Withdrawing money (sending to a external account)

Sending money to an external account is a bit unintuitive in in the UTXO model that we're using to track coin moves; technically a send to an external account is a "deposit" to 3rd party's UTXO.

To account for these, bookkeeper expects to receive a utxo_deposit event for the creation of an output to a 3rd party. It's assumed that you'll issue these at transaction creation time, and that they won't be final until we receive notice of spend of the inputs in the tx that created them.

To notify that money is being sent to a 3rd party output, here's the event we'd expect.

The two keys here are the following:

  • The account is external. This is a special account in bookkeeper and used for tracking external deposits (aka sends)
  • The transfer_from field is set to the name of the account that is sending out the money.
{
	"utxo_deposit": {
		"account": "external",
		"transfer_from": "nifty's secret stash",
		"outpoint": xxxx:x,
		"amount_msat": "10000sat",
		"coin_type": "bc",
		"timestamp": xxxx,
		"blockheight": xxx,
	}
}

List of todos

List of things to check/work on, as a todo list.

  • Transfers btw a 3rd party wallet and the internal CLN wallet? These should be registered as internal transfers and not show up in listincome