Exactly how many sats are in my LN wallet?
7
avatar for sloppy-weasel-of-politeness
18 months ago by
avatar for sloppy-weasel-of-politeness sloppy-weasel-of-politeness1.2k sats wrote:

lncli walletbalance and channelbalance show

  • channel
    • balance
    • pending_open
    • total
  • wallet
    • confirmed
    • unconfirmed

listchannels shows all local balances

Factors:

  1. For on-chain, fees are going to be different at different times
  2. For lightning, I may or may not have enough outgoing capacity to spend everything

If I would like to spend all my sats, how much is available for immediate use?

lnd
ADD INCENTIVE   ADD COMMENTlink written 18 months ago by sloppy-weasel-of-politeness1.2k sats
52
avatar for sloppy-weasel-of-politeness
12 months ago by
avatar for sloppy-weasel-of-politeness sloppy-weasel-of-politeness1.2k sats wrote:

Use Faraday to keep track of your sats. It will tack rich set of info for the on and off chain transactions. Here is the complete list https://github.com/lightninglabs/faraday/blob/master/accounting/docs.md

You would need to use the official LND release binary or build it with make install tags="signrpc walletrpc chainrpc invoicesrpc" flags. Then follow https://github.com/lightninglabs/faraday#lnd

ADD COMMENTlink written 12 months ago by sloppy-weasel-of-politeness1.2k sats
13
avatar for magic-loon-of-beauty (not signed)
18 months ago by

Python script to get the total balance and tracks it over time: https://github.com/alevchuk/minibank/blob/master/scripts/treasury_report.py

Example Output:

Time                       Wallet       Pending      Channel      Fees         Balance
2018-07-15T18:00:01-07:00  1,599,749    208,344,076  150,652,120  248,117      360,595,945
2018-00-14T19:00:01-0700   18,113,811   208,312,757  134,928,908  248,117      361,355,476
ADD COMMENTlink written 18 months ago by magic-loon-of-beauty (not signed)55k sats
2

The formula for this script is:

pending = 
   int(channel_balance["pending_open_balance"]) +
   limbo_balance +
   pending_htlcs +
   wallet_unconfirmed

balance = wallet + channel + pending
ADD REPLYlink written 18 months ago by magic-loon-of-beauty (not signed)55k sats

I noticed, the example output get cut off...

Example Output (shorter version):

Time                       Fees         Balance
2018-07-15T18:00:01-07:00  248,117      360,595,945
2018-00-14T19:00:01-0700   248,117      361,355,476
ADD REPLYlink written 18 months ago by magic-loon-of-beauty (not signed)55k sats

Script updated. Output format calculates fees percentage

Time                 Wallet     Pending    Channel    Fees     Fees       Balance
2020-05-26T13:00:02  5,338      0          1,335,398  128,053  8.72%      1,340,736
2020-05-26T14:00:01  5,338      0          1,335,398  128,053  8.72%      1,340,736
2020-05-26T15:00:01  5,338      0          1,335,400  123,077  8.41%      1,340,738
ADD REPLYlink written 15 months ago by magic-loon-of-beauty (not signed)55k sats

Add your answer

Note:

  • Answers should ONLY be used to respond to the original question at the top of this page! Use the ADD COMMENT or ADD REPLY buttons above to respond to someone, ask for clarifications, request more details, etc.
  • Maximum answer length is 500 characters due to limits on Lightning invoice size. After posting you can use comments to expand.
  • Incentive is awarded to signed answers only

Help

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by ln-central open soruce Q&A software running code change a5ae7af8 which was committed 8 months ago