Skip to content

Commit ba7a34b

Browse files
authored
Merge pull request #59 from tnull/2025-03-add-bolt12-support-for-blip-51
Update bLIP-51 to add BOLT-12 support
2 parents c93a73d + 56b6dc4 commit ba7a34b

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

blip-0051.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ The client MUST check if [option_support_large_channel](https://bitcoinops.org/e
197197
"order_total_sat": "2008888",
198198
"invoice" : "lnbc252u1p3aht9ysp580g4633gd2x9lc5al0wd8wx0mpn9748jeyz46kqjrpxn52uhfpjqpp5qgf67tcqmuqehzgjm8mzya90h73deafvr4m5705l5u5l4r05l8cqdpud3h8ymm4w3jhytnpwpczqmt0de6xsmre2pkxzm3qydmkzdjrdev9s7zhgfaqxqyjw5qcqpjrzjqt6xptnd85lpqnu2lefq4cx070v5cdwzh2xlvmdgnu7gqp4zvkus5zapryqqx9qqqyqqqqqqqqqqqcsq9q9qyysgqen77vu8xqjelum24hgjpgfdgfgx4q0nehhalcmuggt32japhjuksq9jv6eksjfnppm4hrzsgyxt8y8xacxut9qv3fpyetz8t7tsymygq8yzn05"
199199
},
200+
"bolt12": {
201+
"state" : "EXPECT_PAYMENT",
202+
"expires_at": "2025-01-01T00:00:00Z",
203+
"fee_total_sat": "8888",
204+
"order_total_sat": "200888",
205+
"offer": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqvp3pwq2q3shxerxzzfqyxdxxkjqxfpt9tz94zj79m4n99kwjddq92uqryuwsu4nt0t3lthfq02jzqla96dtkf4rew8edxw0p85swe89wd8ldekdl5j262n76qyl2qgzajm08clzr74z6ssy0qlvvp9f5kvrxf27yz4pcy99jge69kxu8ttsqt8gw8jsk5397zvvdf4lfd52paf73thcg6xf57xmvtdrwny5mn2r4jw2d5jzalqrq537mmt6u9qpqytzzql6zemrme07jqqwtza76lldcj9wgc0ccd4d2w584cdcx6szsuupvy"
206+
},
200207
"onchain": {
201208
"state": "EXPECT_PAYMENT",
202209
"expires_at": "2015-01-25T19:29:44.612Z",
@@ -302,6 +309,13 @@ This section describes the `payment` object returned by `lsps1.create_order` and
302309
"order_total_sat": "200888",
303310
"invoice": "lnbc252u1p3aht9ysp580g4633gd2x9lc5al0wd8wx0mpn9748jeyz46kqjrpxn52uhfpjqpp5qgf67tcqmuqehzgjm8mzya90h73deafvr4m5705l5u5l4r05l8cqdpud3h8ymm4w3jhytnpwpczqmt0de6xsmre2pkxzm3qydmkzdjrdev9s7zhgfaqxqyjw5qcqpjrzjqt6xptnd85lpqnu2lefq4cx070v5cdwzh2xlvmdgnu7gqp4zvkus5zapryqqx9qqqyqqqqqqqqqqqcsq9q9qyysgqen77vu8xqjelum24hgjpgfdgfgx4q0nehhalcmuggt32japhjuksq9jv6eksjfnppm4hrzsgyxt8y8xacxut9qv3fpyetz8t7tsymygq8yzn05"
304311
},
312+
"bolt12": {
313+
"state" : "EXPECT_PAYMENT",
314+
"expires_at": "2025-01-01T00:00:00Z",
315+
"fee_total_sat": "8888",
316+
"order_total_sat": "200888",
317+
"offer": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqvp3pwq2q3shxerxzzfqyxdxxkjqxfpt9tz94zj79m4n99kwjddq92uqryuwsu4nt0t3lthfq02jzqla96dtkf4rew8edxw0p85swe89wd8ldekdl5j262n76qyl2qgzajm08clzr74z6ssy0qlvvp9f5kvrxf27yz4pcy99jge69kxu8ttsqt8gw8jsk5397zvvdf4lfd52paf73thcg6xf57xmvtdrwny5mn2r4jw2d5jzalqrq537mmt6u9qpqytzzql6zemrme07jqqwtza76lldcj9wgc0ccd4d2w584cdcx6szsuupvy"
318+
},
305319
"onchain": {
306320
"state": "EXPECT_PAYMENT",
307321
"expires_at": "2025-01-01T00:00:00Z",
@@ -378,7 +392,48 @@ The LSP MAY omit payment options.
378392
- MUST reject the payment.
379393
- MUST set the `payment.state` to `CANCELLED`.
380394

381-
#### 3.2 Onchain payments
395+
#### 3.2 Lightning Payments using BOLT-12
396+
397+
```json
398+
{
399+
"state" : "EXPECT_PAYMENT",
400+
"expires_at": "2025-01-01T00:00:00Z",
401+
"fee_total_sat": "8888",
402+
"order_total_sat": "200888",
403+
"offer": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqvp3pwq2q3shxerxzzfqyxdxxkjqxfpt9tz94zj79m4n99kwjddq92uqryuwsu4nt0t3lthfq02jzqla96dtkf4rew8edxw0p85swe89wd8ldekdl5j262n76qyl2qgzajm08clzr74z6ssy0qlvvp9f5kvrxf27yz4pcy99jge69kxu8ttsqt8gw8jsk5397zvvdf4lfd52paf73thcg6xf57xmvtdrwny5mn2r4jw2d5jzalqrq537mmt6u9qpqytzzql6zemrme07jqqwtza76lldcj9wgc0ccd4d2w584cdcx6szsuupvy"
404+
}
405+
```
406+
407+
- `state`
408+
- `EXPECT_PAYMENT` Payment expected.
409+
- `HOLD` Lighting payment arrived, preimage NOT released.
410+
- `PAID` When the has been preimage released
411+
- `REFUNDED` Lightning payment has been refunded.
412+
- `expires_at` <[LSPS0.datetime][]> The timestamp at which the payment option for this order expires
413+
- `fee_total_sat` <[LSPS0.sat][]> The total fee the LSP will charge to open this channel in satoshi.
414+
- `order_total_sat` <[LSPS0.sat][]> What the client needs to pay in total to open the requested channel.
415+
- MUST be the `fee_total_sat` plus the `client_balance_sat` requested in satoshi.
416+
- `offer <string>`
417+
- MUST be a [Lightning BOLT 12 offer](https://github.com/lightning/bolts/blob/master/12-offer-encoding.md) for the number of `order_total_sat`.
418+
- MUST be at most 2048 characters long.
419+
420+
**Client**
421+
422+
- MAY pay the `offer`.
423+
- MAY pull `lsps1.get_order` to check the success of the payment.
424+
- The client gets refunded automatically in case the channel open failed, the order expires, or just before the payment times out.
425+
426+
**LSP**
427+
428+
- MUST change the `payment.state` to `HOLD` when the payment arrived.
429+
- If the channel has been opened successfully
430+
- MUST release the preimage and therefore complete the payment.
431+
- MUST set the `payment.state` to `PAID`.
432+
- If the channel failed to open or the order expired or shortly before the payment times out:
433+
- MUST reject the payment.
434+
- MUST set the `payment.state` to `CANCELLED`.
435+
436+
#### 3.3 Onchain payments
382437

383438
Onchain payments dictionary MUST be omitted if the client didn't provide a `refund_onchain_address`
384439
and/or the LSP disabled onchain payments.

0 commit comments

Comments
 (0)