Skip to main content

RGB Invoices

Applies to both RGB lines

Both lines use URI-style invoices, but the formats differ and neither line can parse the other's. See Two RGB lines.

An RGB invoice is a string the receiver gives the payer. It names the contract, the amount (or token), and the seal that should receive the state. That seal is either a UTXO of the receiver's wallet (blinded with a secret in v0.11, referenced by an auth token in v0.12, which has no blinded seals) or an output of the payer's own transaction. The payer's wallet reads the invoice, builds the transfer and writes a consignment for the receiver.

An invoice is only a request. It doesn't carry bitcoin or any proof of payment.

Try it

rgbjs reads an invoice of either line in your browser and shows its contract, network, amount and seal. Its Create page makes test-network invoices. It is an independent project in early development, offline, and not for real funds.

Format (rgb-invoicing 0.11.1, invoice/src/parse.rs):

rgb:<contract-id|~>/<schema-id|~>/<state|~>/<chain>:<beneficiary>[?<query>]
PartMeaning
rgb:<contract-id>The contract id in Baid64 (rgb HRI, chunked). rgb:~ leaves it open
<schema-id>The schema id without its rgb:sch: prefix or mnemonic, or ~. rgb invoice always writes ~ here
<state>The amount; for a UDA token, <fraction>@<token-index>; or ~
<chain>bc (mainnet), tb3 (testnet3), tb4 (testnet4), sb (signet), sbc (custom signet) or bcrt (regtest). The code also defines lq and tl for Liquid (rgb-consensus 0.11.1 src/operation/layer1.rs)
<beneficiary>utxob:…, a blinded UTXO; or wvout:…, a witness output (an address payload), optionally followed by +<internal key>
?<query>expiry=<unix seconds>, endpoints=<url>,<url> (transports rpc://, rpcs://, http(s)://, ws(s):// or storm://; RGB proxies use rpc/rpcs) and assignment_name=<name>. Unknown keys are kept

Amounts aren't decimal. <state> holds the amount's little-endian bytes in a base32 alphabet with no digits, abcdefghkmnABCDEFGHKMNPQRSTVWXYZ (invoice/src/amount.rs). So BF is 100 and Sa is 200. Read and write invoices with the library or the CLI, not by hand.

Examples. From the rgb-invoicing 0.11.1 tests, a 100-unit NIA invoice to a blinded UTXO:

rgb:eIbQx5Am-XRDjj01-RM~5eo7-rv2nluD-OnBJRAy-S9~Yfts/XvmU3d4_nQQ8S7oagbXi07x5vjMm7P~ERukQNX6SC4M/BF/bc:utxob:4vm1CX2Z-K8hMo59-e7dgGBS-Jka7mYn-Xe~yP85-yUiHHxr-aVlYa

From the rgb-sandbox README, the output of rgb invoice --amount 100 <contract> on regtest:

rgb:Tk3d0h5w-8v4XYCg-7e~Sc0o-Lu6rp~X-~Jt7VHS-jqgzFD8/~/BF/bcrt:utxob:MSLQCKkW-w6caphB-12do1nJ-HNfgxvv-WE3zOOC-s8yZyHq-Ihoa5

Creating an invoice:

rgb invoice --amount 100 <CONTRACT_ID>                   # blinded UTXO (utxob:)
rgb invoice --address-based --amount 100 <CONTRACT_ID> # witness output (wvout:)

A blinded invoice needs an unspent output in the wallet. Without one it fails with blinded invoice requested but no suitable outpoint is available. rgb invoice stores the blinding secret in the stash, and the receiver can't accept the transfer without it. See invoice for the flags.

Apps use rgb-lib instead (blind_receive and witness_receive), which also fills in the transport endpoints. The official description is in Invoices on docs.rgb.info.

Lightning​

This section covers Line B's RGB Lightning Node; this site hasn't checked Bitlight Labs' separate v0.12 Lightning stack. The RGB Lightning Node uses ordinary BOLT11 invoices (lnbc…, lntb…, lnbcrt…) with two extra tagged fields: 30 for the RGB amount and 31 for the contract id (lightning-invoice/src/lib.rs in the RGB-Tools rust-lightning fork). There is no lnrgb: scheme.

Pay only from the same line and network

An invoice from one line can't be paid from the other, and a tb or bcrt invoice isn't a mainnet invoice. Always pay with a wallet on the same line and network as the receiver's.

Further reading​