Deterministic Bitcoin Commitments
Both lines use the same commitment rules; the only byte-level difference is the tapret script prefix. See Two RGB lines.
A deterministic Bitcoin commitment (DBC) puts a 32-byte hash of RGB client-side data into a Bitcoin transaction so that:
- the transaction provably carries one and only one commitment, and
- anyone holding the data and a short proof can check that commitment against the transaction.
That uniqueness is what makes a single-use seal safe. If a transaction could hold two commitments, its owner could show different histories to different people.
The transaction that closes a seal and carries the commitment is called the witness transaction.
What gets committed​
The 32 bytes in the transaction are an MPC commitment, the root of a multi-protocol commitment tree. Each leaf of the tree belongs to one RGB contract. The leaf holds:
- v0.11 (rgb-cmd)
- v0.12 (rgb-wallet)
The BundleId of the contract's transition bundle: all state transitions of that contract closed by this witness transaction (rgb-consensus 0.11.1 src/validation/validator.rs).
The commitment of a multi-message bundle (mmb::BundleProof): a map from each witness-transaction input index to the operation it closes. Tag urn:lnp-bp:mmb:bundle#2024-11-18 (bp-core 0.12.0 seals/src/txout.rs).
Genesis, schemas, codexes and contract metadata are not anchored. They reach the verifier inside the consignment and are checked by hash.
The first-output rule​
The only output that can hold an RGB commitment is the first output of the witness transaction that is either an
OP_RETURNor a P2TR (taproot) output.
- If that output is
OP_RETURN, it must hold an opret commitment. - If it is P2TR, it must hold a tapret commitment.
- Every later
OP_RETURNor P2TR output is ignored.
Both lines enforce this in the verifier:
- Line A:
bp-core0.12.0seals/src/txout.rs,verify_commitmenttakes the first output whereis_op_return() || is_p2tr(). - Line B:
rgb-consensus0.11.1src/validation/validator.rsdoes the same search, and the proof type must match the output type.
Line B genesis also records the rule as SealClosingStrategy::FirstOpretOrTapret, its only variant (src/operation/operations.rs).
If a wallet places a P2TR payment output (change, or the recipient's taproot address) before the intended OP_RETURN commitment, the verifier looks for the commitment in the wrong output and the anchor fails. The RGB state that transaction tried to move is then lost. Let the RGB wallet build the transaction, and don't reorder its outputs in another tool.
Commitment schemes​
| Opret | Tapret | |
|---|---|---|
| Where | A zero-value OP_RETURN output | A leaf in the taproot script tree of a P2TR output |
| Script | OP_RETURN OP_PUSHBYTES_32 <mpc::Commitment>, 34 bytes | 64-byte leaf script: 29-byte prefix, OP_RETURN OP_PUSHBYTES_33, the commitment, a 1-byte nonce |
| Extra output | Yes | No, it reuses a P2TR output |
| Visible on chain | Yes, as a 32-byte OP_RETURN | No, the output looks like any taproot output |
| Spending | No key change | The output key is tweaked; the wallet must keep the tweak to spend it |
| Line A vs B | Identical | Prefix differs: A uses 29 × OP_NOP (0x61), B uses 29 × OP_RESERVED (0x50) |
Which one gets used depends on the wallet:
- v0.11 (rgb-cmd)
- v0.12 (rgb-wallet)
rgb-lib, Line B's wallet library, always sets CloseMethod::OpretFirst (rgb-lib src/wallet/online.rs). rgb-cmd can also run a taproot wallet: rgb create takes --tapret-key-only <KEY> or --wpkh <KEY>.
rgb create <NAME> <DESCRIPTOR> takes the switch --tapret-key-only (tapret) or --wpkh (opret) (RGB-WG/rgb cli/src/exec.rs).
How a verifier checks it​
- Find the first
OP_RETURNor P2TR output of the witness transaction. If there is none, the anchor is invalid. - Check that the proof type matches the output type: opret for
OP_RETURN, tapret for P2TR. - Rebuild the MPC commitment from the contract's leaf (B: the
BundleId; A: the MMB commitment) and its Merkle path. Compare it with the output: theOP_RETURNpayload for opret, or the taproot output key recomputed from the tapret proof. - Check that the transaction spends the seals the operation claims to close. Line A also checks that the MMB maps each of those inputs to this operation.
A witness transaction seen only in the mempool gives a tentative result. Wait for confirmations before treating a transfer as final.
Further reading​
- Deterministic Bitcoin Commitments on docs.rgb.info, Line B's official docs. The first-output rule above follows that page.
bp-corev0.12.0, cratesbp-dbcandbp-seals(Line A).rgb-consensus0.11.1, modulesdbcandseals(Line B). It carries its own copy of the commitment code instead of depending onbp-core.