-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pico amount example to Bolt11 test vectors #692
Comments
Libraries and web services unable to decode this invoice 0: btcpayserver/BTCPayServer.Lightning#25 (interprets p as 10^(-11) BTC) |
This addresses lightning#692
This addresses lightning#692
In BTCPay our conversion in Millisatoshi is the following:
So 1000 millisatoshi = 1000 pico = 1 satoshi. I can't see the issue. |
ah sorry 10 milli satoshi = 1 pico ? |
Ah got it... a pico is less than a milli satoshi, but all API deals with Milli satoshi... |
@Sword-Smith I am wondering if I fix it as nobody is using less than MilliSatoshi. Internally our class is doing math on a As you can see, we can represent 21 millions bitcoin in term of MilliSatoshi on a long:
But if we do our arithmetic on pico, then we can't represent the maximum amount of bitcoin on a long. |
Sorry for the spam. I decided to not support pico for now: |
I decided to support pico, just not values that are not multiple of 10. Changing the minimum denomination below 1 millisatoshi is impossible at this point in my library without breaking lot's of things. I think that a similar restriction should be placed in BOLT11, as sub milli satoshi is not possible at the protocol level. |
I honestly think this is the correct solution in that this is what every one else is doing. I couldn't find that requirement in the specification. If it isn't there, I fully agree that it should be. |
This closes lightning#692. + +Breakdown: + +* `lnbc`: prefix, Lightning on bitcoin mainnet +* `9678785340p`: amount (9678785340 pico-bitcoin = 967878534 milli satoshi) +* `1`: Bech32 separator +* `pwmna7l`: timestamp (1572468703) +* `p`: payment hash... +* `d`: short description + * `8d`: `data_length` (`8` = 7, `d` = 13; 7 * 32 + 13 == 237) + * `gfkx7cmtwd68yetpd5s9xar0wfjn5gpc8qhrsdfq24f5ggrxdaezqsnvda3kkum5wfjkzmfqf3jkgem9wgsyuctwdus9xgrcyqcjcgpzgfskx6eqf9hzqnteypzxz7fzypfhg6trddjhygrcyqezcgpzfysywmm5ypxxjemgw3hxjmn8yptk7untd9hxwg3q2d6xjcmtv4ezq7pqxgsxzmnyyqcjqmt0wfjjq6t5v4khx`: 'Blockstream Store: 88.85 USD for Blockstream Ledger Nano S x 1, \"Back In My Day\" Sticker x 2, \"I Got Lightning Working\" Sticker x 2 and 1 more items' +* `x`: expiry time + * `qy`: `data_length` (`q` = 0, `y` = 2; 0 * 32 + 4 == 4) + * `jw5q`: 604800 seconds (`j` = 18, `w` = 14, `5` = 20, `q` = 0; 18 * 32^3 + 14 * 32^2 + 20 * 32 + 0 == 604800) +* `r`: tagged field: route information + * `zj`: `data_length` (`z` = 2, `j` = 18; 2 * 32 + 18 == 82) +* `s4x9qlmd57lq7wwr23n3a6pkayy3jpfucyptlncs2maswe3dnnjy3ce2cgrvykmxlfpvn6ptqfqz4df5uaulvd4hjkckuqxrqqkz8jgp`: signature +* `hputwh`: Bech32 checksum + > ### Please send $30 for coffee beans to the same peer, which supports features 1 and 9 > lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdees9qzsze992adudgku8p05pstl6zh7av6rx2f297pv89gu5q93a0hf3g7lynl3xq56t23dpvah6u7y9qey9lccrdml3gaqwc6nxsl5ktzm464sq73t7cl
This addresses lightning#692.
This addresses lightning#692.
Several libraries (at least two libraries and one web service) have problems with the
p
numbers representing 10^(-12) BTC. So an example with this encoding should be included in the test vectors. You can use this one if you like:The text was updated successfully, but these errors were encountered: