ZmnSCPxj / clboss

Automated Core Lightning Node Manager
MIT License
211 stars 32 forks source link

Possible to expose FundsMover via the RPC? #51

Closed hosiawak closed 3 years ago

hosiawak commented 3 years ago

Is there a way to get FundsMover's actions somehow via the RPC (either identify self-payments somehow via the lightningd rpc or create clboss rpc that exposes this data) ?

plugin-clboss: FundsMover: Moved 201239852msat from xxx, getting 200678652msat to yyy, costing us 561200msat.

I'm trying to calculate operational costs of running a node so that we can subtract the total fees from the collected fees and get an idea if we're operating at a loss or profit and how it changes over time. So far I've got channel opening/closing fees done. FundsMover seems to be the next step and Boltz swap fees next after that.

ZmnSCPxj commented 3 years ago

We currently record this in the database data.clboss, in table "EarningsTracker". We should probably expose it in clboss-status.

The data is one row per node we currently have a channel with. Unfortunately we delete this data when the channel with the node is closed.

in_expenditures is the cost of FundsMover movements away from channel with the node. It is "expenditures to enable incoming earnings". out_expenditures is the cost of Fundsover movements to the channel with the node, as moving to a channel enables outgoing earnings via that channel.

When FundsMover moves from xxx to yyy, it updates the in_expenditures of xxx, and out_expenditures of yyy.

You can snapshot-copy data.clboss and extract the data by SQLite3 access for now. I have been meaning to expose the table since I think FundsMover takes too much fees.

ZmnSCPxj commented 3 years ago

Unfortunately we do not record Boltz swap fees anywhere yet, I probably should add a table for that as well.

hosiawak commented 3 years ago

@ZmnSCPxj ok, thanks for the hints, I'll take a look and see what's inside. I think Boltz swap fees is much less important than this ( a nice to have eventually ).