lightninglabs / lightninglabs/faraday
Calculating on-chain and off-chain balances from frcli audit data
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 130
- Forks
- 35
- Avg merge
- 7h 54m
- Merged PRs (30d)
- 5
Description
Hi,
I am trying to calculate the current balances of my node from the values of the csv file created by frcli audit. By balances I mean the wallet balance (on-chain balance) and the available outbound liquidity (off-chain balance) of the node.
I calculate the on-chain balance by adding all values with OnChain=true and Type!=CHANNEL_CLOSE_FEE and Type!=SWEEP_FEE. In other words:
SUM(OnChain=true) - SUM(Type=CHANNEL_CLOSE_FEE) - SUM(Type=SWEEP_FEE)
This works, and the result matches the wallet balance.
I calculate the off-chain balance (available outbound liquidity) as follows:
SUM(OnChain=false) - SUM(Type=LOCAL_CHANNEL_OPEN) - SUM(Type=CHANNEL_CLOSE) + SUM(Type=CHANNEL_CLOSE_FEE) - SUM(Type=SWEEP) + SUM(Type=SWEEP_FEE)
However, the result of this calculation does not correspond exactly to the available outgoing liquidity, but only approximately. Is this calculation correct in principle? And is it even possible to calculate the available outbound liquidity exactly from the data generated by frcli audit?
Initially, I naively calculated the sum of all values in the csv file and thought that this should correspond to the sum of off-chain and on-chain balance, but this also does not match at all.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the frcli audit CSV output and the meanings of its OnChain and Type values first. Establish whether the generated data can determine wallet balance and available outbound liquidity exactly, then document the correct calculation or the missing information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100