[c-lightning] Moving to amount unification in JSON APIs

ZmnSCPxj ZmnSCPxj at protonmail.com
Thu Jan 24 22:04:22 AEDT 2019

Suggest creating a separate struct coin_amount wrapping a u64, and adding two param parsers (one which defaults to sat, the other defaults to msat, if a suffix is not provided).
Then have accessrs to this struct coin_amount that returns sat or msat for the purpose of the caller (i.e. the u64 representation is "up to the struct coin_amount").

Suggest supporting the most common metric prefixes: M, k, m, u, n.
And support btc or sat afterward.
so you can use 21Mbtc 9kbtc 10mbtc 100ubtc 2630nbtc, and possibly Msat ksat msat usat nsat (okay, maybe not the latter two).


Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, January 23, 2019 6:38 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:

> Hi all,
> A common complaint for c-lightning, and a mistake I've made
> myself, is using satoshis in APIs that take millisatoshis. All onchain
> commands (eg. fundchannel) use satoshis, and lightning commands
> (eg. invoice, pay) use millisatoshis.
> This is generally spelled out in the parameter name (satoshi or
> msatoshi), but that doesn't help those of us who use parameters by order
> not keyword!
> So, for the next version I want to add optional suffixes: 'btc', 'sat'
> or 'msat'. We would also require us handling decimal amounts, and fail
> if you specify more accuracy than we support (eg. 1000000.1sat to
> fundchannel).
> I may also require exactly 8 or 11 decimals for btc with '.', and 3 for
> sat with '.', the first of which copies bitcoind's format for btc.
> Any bikeshedding to add? Either the names or other details?
> Thanks!
> Rusty,
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> c-lightning mailing list
> c-lightning at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/c-lightning

More information about the c-lightning mailing list