RGB++ lock 约束RGB++ lock Constraints
来源:utxostack/rgbpp / contracts/rgbpp-lock/src/main.rs + crates/core · mainnet 0xbc6c…6936 / testnet3 0x61ca…3248 / signet 0xd075…0364,hash_type type(rgbpp-sdk)Source: utxostack/rgbpp / contracts/rgbpp-lock/src/main.rs + crates/core · mainnet 0xbc6c…6936 / testnet3 0x61ca…3248 / signet 0xd075…0364, hash_type type (rgbpp-sdk)
RGB++ (UTXO Stack)
- GitHubGitHubgithub.com/utxostack/rgbpp
- XXx.com/utxostack
来源:Source: utxostack GitHub org profile (X); org website https://www.utxostack.network returned HTTP 402 to automated checks, so omitted
N → M同构绑定转移(BTC 交易驱动 CKB 交易)Isomorphic transfer (BTC tx drives the CKB tx)
Inputs 输入Inputs
RGB++ cell(绑定 BTC UTXO)RGB++ cell (bound to a BTC UTXO)Cell{
lock: { codeHash: RGBPP_LOCK,
args: out_index u32 ‖ btc_txid 32B },
type: xUDT / Spore …
}
witness[group 0].lockRGBPPUnlock{
version: 0,
extra_data: { input_len, output_len },
btc_tx: raw BTC tx,
btc_tx_proof: SPV proof
}
// 或 4 字节 u32 = 另一个 witness 的序号RGBPPUnlock{
version: 0,
extra_data: { input_len, output_len },
btc_tx: raw BTC tx,
btc_tx_proof: SPV proof
}
// or a 4-byte u32 index of another witness
cell_depsRGB++ config cell(BTC 轻客户端 type hash、BTC time lock type hash)+ 轻客户端 cellRGB++ config cell (BTC light client type hash, BTC time lock type hash) + light client cell
➜
Outputs 输出Outputs
新 RGB++ cell(重新绑定到本 BTC 交易的输出)new RGB++ cell (re-sealed to an output of this BTC tx)Cell{
lock: RGBPP_LOCK( i < btc_tx.outputs ‖ btc_tx.txid ),
type: same asset
}
或 BTC time lock(leap 到 CKB)or a BTC time lock (leap to CKB)Cell{ lock: BTC_TIME_LOCK{ lock_script, after ≥ 6, btc_txid = btc_tx.txid } }
args:RGBPPLock(struct 36B)args: RGBPPLock (struct 36B)
out_index4B
btc_txid32B
- out_index 4B BTC 输出序号 u32 LEBTC output index u32 LE BTC 交易花费 (txid, index)BTC tx spends (txid, index) (0x44 (68))
- btc_txid 32B BTC txid(内部字节序,浏览器显示需反转)BTC txid (internal byte order; reverse for explorers) — (0x31 (49))
BTC 交易中的 commitmentcommitment inside the BTC tx
OP_RETURN1B
PUSH321B
commitment32B
- OP_RETURN 1B 0x6a 第一个 OP_RETURN 输出first OP_RETURN output (0x33 (51))
- PUSH32 1B 0x20 脚本恰 34 字节script exactly 34 bytes (0x33 (51))
- commitment 32B sha256d("RGB++" ‖ version u16 ‖ input_len ‖ output_len ‖ 前 input_len 个 OutPoint ‖ 前 output_len 个 (CellOutput(RGB++/BTC time lock 的 btc_txid 置 0) ‖ data_len u32 ‖ data))sha256d("RGB++" ‖ version u16 ‖ input_len ‖ output_len ‖ first input_len OutPoints ‖ first output_len (CellOutput with RGB++/BTC-time-lock btc_txid zeroed ‖ data_len u32 ‖ data)) 与 CKB 交易一致matches the CKB tx (0x42 (66))
限制Constraints
- args:: 36 字节 RGBPPLock36-byte RGBPPLock (0x31)
- witness:: 存在且为 RGBPPUnlockpresent and a valid RGBPPUnlock (0x02 / 0x34)
- btc_tx:: 可解析(非 segwit 序列化,无尾随字节)parsable (non-segwit serialization, no trailing bytes) (0x30)
- UTXO seal:: BTC 交易的某个输入 = (args.btc_txid, args.out_index)a BTC tx input = (args.btc_txid, args.out_index) (0x44)
- SPV:: btc_tx 在 BTC 轻客户端中有证明btc_tx is proven in the BTC light client (0x20–0x23)
- commitment:: version = 0;input_len、output_len > 0version = 0; input_len, output_len > 0 (0x43 / 0x33)
- commitment:: 未被承诺的输入 / 输出都不能带 typeuncommitted inputs / outputs carry no type (0x42)
- commitment:: 重算值 = OP_RETURN 中的 32 字节recomputed value = the 32 bytes in OP_RETURN (0x42)
- outputs:: 每个带 type 的输出:RGB++ lock 且 btc_txid = 本 BTC 交易、out_index < 输出数;或 BTC time lock 且 btc_txid = 本交易、after ≥ 6each typed output: RGB++ lock with btc_txid = this BTC tx and out_index < output count, or BTC time lock with btc_txid = this tx and after ≥ 6 (0x41)
- config:: cell_deps 中有 RGB++ config cellRGB++ config cell is in cell_deps (0x10 / 0x11)
部署与来源Deployments & source 未核验unverified
源码source utxostack/rgbpp@4abd216d · contracts/rgbpp-lock/src/main.rs · crates/core (default-branch HEAD recorded at backfill 2026-10-21; spec/plugin were written from the default branch shortly before (exact read commit not recorded))
二进制核验binary check 未核验unverified no binary or checksum at the recorded commit matched the deployed data hash (reproducible build not attempted)
| 网络network | code_hash | cell_dep | type_id args | 数据哈希data hash | 部署交易deploy tx |
|---|---|---|---|---|---|
| mainnet | 0xbc6c568a1a0d0a09f6844dc9d74ddb4343c32143ff25f727c59edf4fb72d6936 type | 0xcb4d9f9726…ebe82a63:0 code | 0x68ad3d9e0b…d981452f | 0x1c629e18b5…88601324 | 0xcb4d9f9726…ebe82a63 #17659453 |
| testnet | 0x61ca7a4796a4eb19ca4f0d065cb9b10ddcf002f10f7cbb810c706cb6bb5c3248 type | 0x0d1567da09…7a1ed6e5:0 code | 0xa3bc8441df…f1c12c7f | 0x7e458568bc…36e6374a | 0x0d1567da09…7a1ed6e5 #18311920 |
| testnet | 0xd07598deec7ce7b5665310386b4abd06a6d48843e953c5cc2112ad0d5a220364 type | 0x61efdeddba…3c516eec:0 code | 0xb69fe766ce…18ebfa5a | 0x7e458568bc…36e6374a | 0x61efdeddba…3c516eec #13560148 |
链上数据核对于 on-chain data checked 2026-10-20
错误码(crates/core/src/error.rs,i8):0x01–0x05 ckb-std · 0x10 ConfigNotFound · 0x11 ConfigMalformed · 0x20 SpvClientNotFound · 0x21 SpvClientMalformed · 0x22 SpvProofIncorrect · 0x23 SpvProofMalformed · 0x30 BadBtcTx · 0x31 BadRGBPPLock · 0x32 BadBTCTimeLock · 0x33 BadBtcCommitment · 0x34 BadRGBPPUnlock · 0x35 BadBTCTimeUnlock · 0x40 OutputCellMismatch · 0x41 OutputCellWithUnknownLock · 0x42 CommitmentMismatch · 0x43 UnknownCommitmentVersion · 0x44 UtxoSealMismatchError codes (crates/core/src/error.rs, i8): 0x01–0x05 ckb-std · 0x10 ConfigNotFound · 0x11 ConfigMalformed · 0x20 SpvClientNotFound · 0x21 SpvClientMalformed · 0x22 SpvProofIncorrect · 0x23 SpvProofMalformed · 0x30 BadBtcTx · 0x31 BadRGBPPLock · 0x32 BadBTCTimeLock · 0x33 BadBtcCommitment · 0x34 BadRGBPPUnlock · 0x35 BadBTCTimeUnlock · 0x40 OutputCellMismatch · 0x41 OutputCellWithUnknownLock · 0x42 CommitmentMismatch · 0x43 UnknownCommitmentVersion · 0x44 UtxoSealMismatch
解码器会解析 btc_tx、计算 txid,并按 CKB 交易重算 commitment 与 OP_RETURN 对比;SPV 证明不检查The decoder parses btc_tx, computes its txid and recomputes the commitment from the CKB tx to compare with OP_RETURN; the SPV proof is not checked
解码器会解析 btc_tx、计算 txid,并按 CKB 交易重算 commitment 与 OP_RETURN 对比;SPV 证明不检查The decoder parses btc_tx, computes its txid and recomputes the commitment from the CKB tx to compare with OP_RETURN; the SPV proof is not checked