2021-01-08 05:18:47 +10:30
|
|
|
lightning-decode -- Command for decoding an invoice string (low-level)
|
|
|
|
=======================================================================
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
|
|
|
|
**decode** *string*
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
|
2022-07-16 22:48:27 +09:30
|
|
|
The **decode** RPC command checks and parses:
|
|
|
|
|
|
|
|
- a *bolt11* or *bolt12* string (optionally prefixed by `lightning:`
|
|
|
|
or `LIGHTNING:`) as specified by the BOLT 11 and BOLT 12
|
|
|
|
specifications.
|
|
|
|
- a *rune* as created by lightning-commando-rune(7).
|
|
|
|
|
|
|
|
It may decode other formats in future.
|
2021-01-08 05:18:47 +10:30
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
------------
|
|
|
|
|
2021-05-26 15:24:01 +09:30
|
|
|
[comment]: # (GENERATE-FROM-SCHEMA-START)
|
|
|
|
On success, an object is returned, containing:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2022-07-16 22:48:27 +09:30
|
|
|
- **type** (string): what kind of object it decoded to (one of "bolt12 offer", "bolt12 invoice", "bolt12 invoice_request", "bolt11 invoice", "rune")
|
2021-05-26 15:24:01 +09:30
|
|
|
- **valid** (boolean): if this is false, you *MUST* not use the result except for diagnostics!
|
|
|
|
|
|
|
|
If **type** is "bolt12 offer", and **valid** is *true*:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2022-09-06 07:15:06 +09:30
|
|
|
- **offer\_id** (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters)
|
|
|
|
- **node\_id** (point32): x-only public key of the offering node
|
2021-05-26 15:24:01 +09:30
|
|
|
- **description** (string): the description of the purpose of the offer
|
2021-07-02 09:41:34 +09:30
|
|
|
- **signature** (bip340sig, optional): BIP-340 signature of the *node_id* on this offer
|
2021-05-26 15:24:01 +09:30
|
|
|
- **chains** (array of hexs, optional): which blockchains this offer is for (missing implies bitcoin mainnet only):
|
|
|
|
- the genesis blockhash (always 64 characters)
|
|
|
|
- **currency** (string, optional): ISO 4217 code of the currency (missing implies Bitcoin) (always 3 characters)
|
2022-09-06 07:15:06 +09:30
|
|
|
- **minor\_unit** (u32, optional): the number of decimal places to apply to amount (if currency known)
|
2021-05-26 15:24:01 +09:30
|
|
|
- **amount** (u64, optional): the amount in the *currency* adjusted by *minor_unit*, if any
|
2022-09-06 07:15:06 +09:30
|
|
|
- **amount\_msat** (msat, optional): the amount in bitcoin (if specified, and no *currency*)
|
|
|
|
- **send\_invoice** (boolean, optional): present if this is a send_invoice offer (always *true*)
|
|
|
|
- **refund\_for** (hex, optional): the *payment_preimage* of invoice this is a refund for (always 64 characters)
|
2021-05-26 15:24:01 +09:30
|
|
|
- **vendor** (string, optional): the name of the vendor for this offer
|
|
|
|
- **features** (hex, optional): the array of feature bits for this offer
|
2022-09-06 07:15:06 +09:30
|
|
|
- **absolute\_expiry** (u64, optional): UNIX timestamp of when this offer expires
|
2021-05-26 15:24:01 +09:30
|
|
|
- **paths** (array of objects, optional): Paths to the destination:
|
|
|
|
- **blinding** (pubkey): blinding factor for this path
|
|
|
|
- **path** (array of objects): an individual path:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **node\_id** (pubkey): node_id of the hop
|
|
|
|
- **encrypted\_recipient\_data** (hex): encrypted TLV entry for this hop
|
|
|
|
- **quantity\_min** (u64, optional): the minimum quantity
|
|
|
|
- **quantity\_max** (u64, optional): the maximum quantity
|
2021-05-26 15:24:01 +09:30
|
|
|
- **recurrence** (object, optional): how often to this offer should be used:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **time\_unit** (u32): the BOLT12 time unit
|
2021-05-26 15:24:01 +09:30
|
|
|
- **period** (u32): how many *time_unit* per payment period
|
2022-09-06 07:15:06 +09:30
|
|
|
- **time\_unit\_name** (string, optional): the name of *time_unit* (if valid)
|
2021-05-26 15:24:01 +09:30
|
|
|
- **basetime** (u64, optional): period starts at this UNIX timestamp
|
2022-09-06 07:15:06 +09:30
|
|
|
- **start\_any\_period** (u64, optional): you can start at any period (only if **basetime** present)
|
2021-05-26 15:24:01 +09:30
|
|
|
- **limit** (u32, optional): maximum period number for recurrence
|
|
|
|
- **paywindow** (object, optional): when within a period will payment be accepted (default is prior and during the period):
|
2022-09-06 07:15:06 +09:30
|
|
|
- **seconds\_before** (u32): seconds prior to period start
|
|
|
|
- **seconds\_after** (u32): seconds after to period start
|
|
|
|
- **proportional\_amount** (boolean, optional): amount should be scaled if payed after period start (always *true*)
|
2021-05-26 15:24:01 +09:30
|
|
|
- the following warnings are possible:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **warning\_offer\_unknown\_currency**: The currency code is unknown (so no **minor_unit**)
|
2021-05-26 15:24:01 +09:30
|
|
|
|
|
|
|
If **type** is "bolt12 offer", and **valid** is *false*:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2021-05-26 15:24:01 +09:30
|
|
|
- the following warnings are possible:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **warning\_offer\_missing\_description**: No **description**
|
2021-05-26 15:24:01 +09:30
|
|
|
|
|
|
|
If **type** is "bolt12 invoice", and **valid** is *true*:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2022-09-06 07:15:06 +09:30
|
|
|
- **node\_id** (point32): x-only public key of the offering node
|
2021-05-26 15:24:01 +09:30
|
|
|
- **signature** (bip340sig): BIP-340 signature of the *node_id* on this offer
|
2022-09-06 07:15:06 +09:30
|
|
|
- **amount\_msat** (msat): the amount in bitcoin
|
2021-05-26 15:24:01 +09:30
|
|
|
- **description** (string): the description of the purpose of the offer
|
2022-09-06 07:15:06 +09:30
|
|
|
- **created\_at** (u64): the UNIX timestamp of invoice creation
|
|
|
|
- **payment\_hash** (hex): the hash of the *payment_preimage* (always 64 characters)
|
|
|
|
- **relative\_expiry** (u32): the number of seconds after *created_at* when this expires
|
|
|
|
- **min\_final\_cltv\_expiry** (u32): the number of blocks required by destination
|
|
|
|
- **offer\_id** (hex, optional): the id of this offer (merkle hash of non-signature fields) (always 64 characters)
|
2021-10-10 14:31:39 +10:30
|
|
|
- **chain** (hex, optional): which blockchain this invoice is for (missing implies bitcoin mainnet only) (always 64 characters)
|
2022-09-06 07:15:06 +09:30
|
|
|
- **send\_invoice** (boolean, optional): present if this offer was a send_invoice offer (always *true*)
|
|
|
|
- **refund\_for** (hex, optional): the *payment_preimage* of invoice this is a refund for (always 64 characters)
|
2021-05-26 15:24:01 +09:30
|
|
|
- **vendor** (string, optional): the name of the vendor for this offer
|
|
|
|
- **features** (hex, optional): the array of feature bits for this offer
|
|
|
|
- **paths** (array of objects, optional): Paths to the destination:
|
|
|
|
- **blinding** (pubkey): blinding factor for this path
|
|
|
|
- **path** (array of objects): an individual path:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **node\_id** (pubkey): node_id of the hop
|
|
|
|
- **encrypted\_recipient\_data** (hex): encrypted TLV entry for this hop
|
2021-05-26 15:24:01 +09:30
|
|
|
- **quantity** (u64, optional): the quantity ordered
|
2022-09-06 07:15:06 +09:30
|
|
|
- **recurrence\_counter** (u32, optional): the 0-based counter for a recurring payment
|
|
|
|
- **recurrence\_start** (u32, optional): the optional start period for a recurring payment
|
|
|
|
- **recurrence\_basetime** (u32, optional): the UNIX timestamp of the first recurrence period start
|
|
|
|
- **payer\_key** (point32, optional): the transient key which identifies the payer
|
|
|
|
- **payer\_info** (hex, optional): the payer-provided blob to derive payer_key
|
2021-05-26 15:24:01 +09:30
|
|
|
- **fallbacks** (array of objects, optional): onchain addresses:
|
|
|
|
- **version** (u8): Segwit address version
|
|
|
|
- **hex** (hex): Raw encoded segwit address
|
|
|
|
- **address** (string, optional): bech32 segwit address
|
2022-09-06 07:15:06 +09:30
|
|
|
- **refund\_signature** (bip340sig, optional): the payer key signature to get a refund
|
2021-05-26 15:24:01 +09:30
|
|
|
|
|
|
|
If **type** is "bolt12 invoice", and **valid** is *false*:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2021-05-26 15:24:01 +09:30
|
|
|
- **fallbacks** (array of objects, optional):
|
|
|
|
- the following warnings are possible:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **warning\_invoice\_fallbacks\_version\_invalid**: **version** is > 16
|
2021-05-26 15:24:01 +09:30
|
|
|
- the following warnings are possible:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **warning\_invoice\_missing\_amount**: **amount_msat* missing
|
|
|
|
- **warning\_invoice\_missing\_description**: No **description**
|
|
|
|
- **warning\_invoice\_missing\_blinded\_payinfo**: Has **paths** without payinfo
|
|
|
|
- **warning\_invoice\_invalid\_blinded\_payinfo**: Does not have exactly one payinfo for each of **paths**
|
|
|
|
- **warning\_invoice\_missing\_recurrence\_basetime**: Has **recurrence_counter** without **recurrence_basetime**
|
|
|
|
- **warning\_invoice\_missing\_created\_at**: Missing **created_at**
|
|
|
|
- **warning\_invoice\_missing\_payment\_hash**: Missing **payment_hash**
|
|
|
|
- **warning\_invoice\_refund\_signature\_missing\_payer\_key**: Missing **payer_key** for refund_signature
|
|
|
|
- **warning\_invoice\_refund\_signature\_invalid**: **refund_signature** incorrect
|
|
|
|
- **warning\_invoice\_refund\_missing\_signature**: No **refund_signature**
|
2021-05-26 15:24:01 +09:30
|
|
|
|
|
|
|
If **type** is "bolt12 invoice_request", and **valid** is *true*:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2022-09-06 07:15:06 +09:30
|
|
|
- **offer\_id** (hex): the id of the offer this is requesting (merkle hash of non-signature fields) (always 64 characters)
|
|
|
|
- **payer\_key** (point32): the transient key which identifies the payer
|
2021-10-10 14:31:39 +10:30
|
|
|
- **chain** (hex, optional): which blockchain this invoice_request is for (missing implies bitcoin mainnet only) (always 64 characters)
|
2022-09-06 07:15:06 +09:30
|
|
|
- **amount\_msat** (msat, optional): the amount in bitcoin
|
2021-05-26 15:24:01 +09:30
|
|
|
- **features** (hex, optional): the array of feature bits for this offer
|
|
|
|
- **quantity** (u64, optional): the quantity ordered
|
2022-09-06 07:15:06 +09:30
|
|
|
- **recurrence\_counter** (u32, optional): the 0-based counter for a recurring payment
|
|
|
|
- **recurrence\_start** (u32, optional): the optional start period for a recurring payment
|
|
|
|
- **payer\_info** (hex, optional): the payer-provided blob to derive payer_key
|
|
|
|
- **recurrence\_signature** (bip340sig, optional): the payer key signature
|
2021-05-26 15:24:01 +09:30
|
|
|
|
|
|
|
If **type** is "bolt12 invoice_request", and **valid** is *false*:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2021-05-26 15:24:01 +09:30
|
|
|
- the following warnings are possible:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **warning\_invoice\_request\_missing\_offer\_id**: No **offer_id**
|
|
|
|
- **warning\_invoice\_request\_missing\_payer\_key**: No **payer_key**
|
|
|
|
- **warning\_invoice\_request\_missing\_recurrence\_signature**: No **recurrence_signature**
|
|
|
|
- **warning\_invoice\_request\_invalid\_recurrence\_signature**: **recurrence_signature** incorrect
|
2021-05-26 15:24:01 +09:30
|
|
|
|
|
|
|
If **type** is "bolt11 invoice", and **valid** is *true*:
|
2022-09-06 07:03:09 +09:30
|
|
|
|
2021-05-26 15:24:01 +09:30
|
|
|
- **currency** (string): the BIP173 name for the currency
|
2022-09-06 07:15:06 +09:30
|
|
|
- **created\_at** (u64): the UNIX-style timestamp of the invoice
|
2021-05-26 15:24:01 +09:30
|
|
|
- **expiry** (u64): the number of seconds this is valid after *timestamp*
|
|
|
|
- **payee** (pubkey): the public key of the recipient
|
2022-09-06 07:15:06 +09:30
|
|
|
- **payment\_hash** (hex): the hash of the *payment_preimage* (always 64 characters)
|
2021-05-26 15:24:01 +09:30
|
|
|
- **signature** (signature): signature of the *payee* on this invoice
|
2022-09-06 07:15:06 +09:30
|
|
|
- **min\_final\_cltv\_expiry** (u32): the minimum CLTV delay for the final node
|
|
|
|
- **amount\_msat** (msat, optional): Amount the invoice asked for
|
2021-05-26 15:24:01 +09:30
|
|
|
- **description** (string, optional): the description of the purpose of the purchase
|
2022-09-06 07:15:06 +09:30
|
|
|
- **description\_hash** (hex, optional): the hash of the description, in place of *description* (always 64 characters)
|
|
|
|
- **payment\_secret** (hex, optional): the secret to hand to the payee node (always 64 characters)
|
2021-05-26 15:24:01 +09:30
|
|
|
- **features** (hex, optional): the features bitmap for this invoice
|
2022-09-06 07:15:06 +09:30
|
|
|
- **payment\_metadata** (hex, optional): the payment_metadata to put in the payment
|
2021-05-26 15:24:01 +09:30
|
|
|
- **fallbacks** (array of objects, optional): onchain addresses:
|
|
|
|
- **type** (string): the address type (if known) (one of "P2PKH", "P2SH", "P2WPKH", "P2WSH")
|
|
|
|
- **hex** (hex): Raw encoded address
|
|
|
|
- **addr** (string, optional): the address in appropriate format for *type*
|
|
|
|
- **routes** (array of arrays, optional): Route hints to the *payee*:
|
|
|
|
- hops in the route:
|
|
|
|
- **pubkey** (pubkey): the public key of the node
|
2022-09-08 10:38:00 +09:30
|
|
|
- **short\_channel\_id** (short\_channel\_id): a channel to the next peer
|
2022-09-06 07:15:06 +09:30
|
|
|
- **fee\_base\_msat** (msat): the base fee for payments
|
|
|
|
- **fee\_proportional\_millionths** (u32): the parts-per-million fee for payments
|
|
|
|
- **cltv\_expiry\_delta** (u32): the CLTV delta across this hop
|
2021-05-26 15:24:01 +09:30
|
|
|
- **extra** (array of objects, optional): Any extra fields we didn't know how to parse:
|
|
|
|
- **tag** (string): The bech32 letter which identifies this field (always 1 characters)
|
|
|
|
- **data** (string): The bech32 data for this field
|
2021-09-03 19:37:59 +09:30
|
|
|
|
2022-07-25 10:53:30 +09:30
|
|
|
If **type** is "rune", and **valid** is *true*:
|
2022-09-06 07:15:04 +09:30
|
|
|
|
2022-07-25 10:53:30 +09:30
|
|
|
- **valid** (boolean) (always *true*)
|
2022-07-16 22:48:27 +09:30
|
|
|
- **string** (string): the string encoding of the rune
|
|
|
|
- **restrictions** (array of objects): restrictions built into the rune: all must pass:
|
|
|
|
- **alternatives** (array of strings): each way restriction can be met: any can pass:
|
|
|
|
- the alternative of form fieldname condition fieldname
|
|
|
|
- **summary** (string): human-readable summary of this restriction
|
2022-09-06 07:15:06 +09:30
|
|
|
- **unique\_id** (string, optional): unique id (always a numeric id on runes we create)
|
2022-07-16 22:48:27 +09:30
|
|
|
- **version** (string, optional): rune version, not currently set on runes we create
|
2022-07-25 10:53:30 +09:30
|
|
|
|
|
|
|
If **type** is "rune", and **valid** is *false*:
|
2022-09-06 07:15:04 +09:30
|
|
|
|
2022-07-25 10:53:30 +09:30
|
|
|
- **valid** (boolean) (always *false*)
|
|
|
|
- **hex** (hex, optional): the raw rune in hex
|
|
|
|
- the following warnings are possible:
|
2022-09-06 07:15:06 +09:30
|
|
|
- **warning\_rune\_invalid\_utf8**: the rune contains invalid UTF-8 strings
|
2022-07-16 22:48:27 +09:30
|
|
|
|
2021-05-26 15:24:01 +09:30
|
|
|
[comment]: # (GENERATE-FROM-SCHEMA-END)
|
2021-01-08 05:18:47 +10:30
|
|
|
|
|
|
|
AUTHOR
|
|
|
|
------
|
|
|
|
|
|
|
|
Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible.
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
|
|
|
|
2022-07-16 22:48:27 +09:30
|
|
|
lightning-pay(7), lightning-offer(7), lightning-offerout(7), lightning-fetchinvoice(7), lightning-sendinvoice(7), lightning-commando-rune(7)
|
2021-01-08 05:18:47 +10:30
|
|
|
|
2022-07-27 13:43:02 +09:30
|
|
|
[BOLT #11](https://github.com/lightningnetwork/bolts/blob/master/11-payment-encoding.md).
|
2021-01-08 05:18:47 +10:30
|
|
|
|
2022-07-27 13:43:02 +09:30
|
|
|
[BOLT #12](https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md).
|
2021-01-08 05:18:47 +10:30
|
|
|
|
|
|
|
|
|
|
|
RESOURCES
|
|
|
|
---------
|
|
|
|
|
|
|
|
Main web site: <https://github.com/ElementsProject/lightning>
|
|
|
|
|
2022-09-08 10:38:00 +09:30
|
|
|
[comment]: # ( SHA256STAMP:610b6f9d61e79b503ff81cc164f79ea90883c6d10f5e7b28555aefabfd6e17bb)
|