Skip to main content

Opret

Applies to both RGB lines

The opret format is byte-identical in both lines. See Two RGB lines.

Opret is the simpler of the two deterministic Bitcoin commitment schemes. The 32-byte MPC commitment goes into a zero-value OP_RETURN output of the witness transaction.

The script​

OP_RETURN  OP_PUSHBYTES_32  <mpc::Commitment>
0x6a 0x20 32 bytes = 34 bytes

That is all: no protocol tag, no version byte. The 32 bytes are the tagged MPC commitment (tag urn:ubideco:mpc:commitment#2024-01-31), and nothing in the script itself says "RGB". The verifier rejects an OP_RETURN script of any other length (bp-core 0.12.0 dbc/src/opret/spk.rs; rgb-consensus 0.11.1 src/dbc/opret/). The format is documented on the docs.rgb.info opret page.

The full output is 43 bytes: an 8-byte value (zero), a 1-byte script length and the 34-byte script.

The rules​

  • First output only. The commitment must be in the first output of the transaction that is OP_RETURN or P2TR. If a P2TR output comes before the OP_RETURN, the verifier looks for a tapret commitment in that P2TR output instead, and the opret output is ignored. See the first-output rule.
  • One commitment per transaction. Several contracts share it through the MPC tree.
  • Placeholder, then fill. When building the transaction, the wallet adds a bare OP_RETURN output (a 1-byte script). After the MPC tree is built, it replaces that output's script with the 34-byte commitment. The embed code refuses any other starting script (bp-core dbc/src/opret/spk.rs, embed_commit).
Don't edit the transaction after the commitment

Sign and broadcast the transaction exactly as the RGB wallet produced it. If you add a P2TR output in front of the OP_RETURN, or change the OP_RETURN payload, the anchor is invalid and the RGB state moved by that transaction is lost. Also send the consignment to the recipient, and keep your own copy, before you broadcast.

Who uses it​

  • Line B. rgb-lib, the library behind most Line B wallets, always builds opret commitments: it calls set_rgb_close_method(CloseMethod::OpretFirst) (rgb-lib src/wallet/online.rs). rgb-cmd uses opret for --wpkh wallets.
  • Line A. rgb create --wpkh makes an opret wallet. --tapret-key-only makes a tapret one.

Opret has not been deprecated in either line.

Trade-offs against tapret​

OpretTapret
Extra outputOne 43-byte zero-value outputNone
On-chain visibilityA 32-byte OP_RETURN is visible and easy to fingerprintLooks like an ordinary taproot output
Spending the changeOrdinary; no key tweak to back upThe tweak must be backed up, or the output can't be spent
Wallet supportWorks with any output type for the other outputsNeeds a taproot wallet that tracks tapret tweaks

Bitcoin relay policy​

OP_RETURN outputs are unspendable and are never added to the UTXO set. Since Bitcoin Core 0.11.0 (July 2015) the default relay limit for data carrier scripts was 83 bytes, with one such output per transaction. Bitcoin Core 30.0 (October 10, 2025) raised the default -datacarriersize to 100,000 and allows several OP_RETURN outputs per transaction (release notes). A 34-byte opret script fits under both the old and new policy. These are relay-policy defaults, not consensus rules. Background: OP_RETURN on the Bitcoin wiki.

Even when a transaction has several OP_RETURN outputs, RGB looks only at the first OP_RETURN-or-P2TR output.