ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.83k stars 899 forks source link

It is hard to read output of `listfunds` #3323

Closed Sword-Smith closed 4 years ago

Sword-Smith commented 4 years ago

When reading the output of listfunds I have to count the number of digits to understand how many bitcoins are present in the utxos and channels. Is it possible to add one or more extra fields showing the amount in mBTC and/or BTC? It would also be nice to see the total amount tied up in utxos, total amount tied up in channels, total amount tied up in channels with connected nodes, and total amount tied up in channels with disconnected nodes.

Example output from listfunds to illustrate the problem

{
    "outputs": [{
        "txid": "440bdba1d5209b15f22998a413ac1248b50e7db195a679e0f117546e7f72c6ec",
        "output": 1,
        "value": 6623954,
        "amount_msat": "6623954000msat",
        "address": "tb1qrx3qen27fk0a74u757c3axc6rt88e3hf6u5678",
        "status": "confirmed",
        "blockheight": 1611377
    }, {
        "txid": "ebdd6bf9fd356efb033fcb8aad4dd4849582de71ae4a3c66785fd13c5701011b",
        "output": 0,
        "value": 1828,
        "amount_msat": "1828000msat",
        "address": "tb1q2uxuctk2admcgrwzq632exfkfewzp99z43afr7",
        "status": "confirmed",
        "blockheight": 1611377
    }],
    "channels": [{
        "peer_id": "031c64a68e6d1b9e50711336d92b434c584ce668b2fae59ee688bd73713fee1569",
        "connected": true,
        "state": "CHANNELD_NORMAL",
        "short_channel_id": "1611042x98x0",
        "channel_sat": 11418091,
        "our_amount_msat": "11418091000msat",
        "channel_total_sat": 11627500,
        "amount_msat": "11627500000msat",
        "funding_txid": "f2f8e9fade793d3177d21f698131657eb8b093c3e8c95414ddda823a1869df00",
        "funding_output": 0
    }]
}
darosior commented 4 years ago

Hi, you can use https://github.com/lightningd/plugins/tree/master/summary

cdecker commented 4 years ago

With the rpc_command hook you can even change the output on the fly to enrich the returned output :-)

whitslack commented 4 years ago

Is it possible to add one or more extra fields showing the amount in mBTC and/or BTC?

Concept NAK. This is a display/UI issue. Please do not bloat the RPC protocol with superfluous fields.

rustyrussell commented 4 years ago

Yeah, our trend has been to remove duplicated fields and rely on plugins to do the "human-readable" stuff. JSON will never truly be human readable anyway :(

cdecker commented 4 years ago

Yeah, our trend has been to remove duplicated fields and rely on plugins to do the "human-readable" stuff. JSON will never truly be human readable anyway :(

It is "human-readable" for a very limited interpretation of "human" :-)