Unique Cell 约束Unique Cell Constraints

来源:utxostack/unique-cell / contracts/unique-type/src/entry.rs · mainnet 0x2c8c…c628 (data1) / testnet 0x8e34…df8b (type)Source: utxostack/unique-cell / contracts/unique-type/src/entry.rs · mainnet 0x2c8c…c628 (data1) / testnet 0x8e34…df8b (type)
Type 脚本Type script代币 / UDTToken / UDTBTC / RGB++BTC / RGB++主网Mainnet测试网Testnet开源Open source社区Community

A创建(唯一允许的操作)Create (the only allowed operation)

Inputs 输入Inputs
inputs[0]:任意inputs[0]: anyCellInput{ since, previous_output } (不得含该 unique type)CellInput{ since, previous_output } (must not carry this unique type)
➜
Outputs 输出Outputs
唯一输出single outputCell{ type: { codeHash: UNIQUE_TYPE, args: unique_id 20B }, data: any (e.g. token info, convention) }
args 字节布局args byte layout
unique_id20B
  • unique_id 20B blake2b(inputs[0] ‖ 首个输出序号 u64 LE)[0..20]blake2b(inputs[0] ‖ first output index u64 LE)[0..20] 必须恰好相等must match exactly (6)

限制Constraints

  • outputs:: group 输出 ≤ 1group outputs ≤ 1 (8)
  • args = blake2b(第一个 CellInput ‖ 首个匹配输出序号)前 20 字节,长度必须为 20= first 20 bytes of blake2b(first CellInput ‖ first matching output index); length must be 20 (6)
  • inputs:: 输入中出现该 type 即失败:不可更新、不可销毁fails if this type is in inputs: no update, no destroy (7)
  • outputs:: 只出现在输入时找不到输出only in inputs: no matching output (4)
部署与来源Deployments & source 未核验unverified
源码source utxostack/unique-cell@beabe978 · contracts/unique-type/src/entry.rs (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)
0x2c8c11c985…00aec628: listed in deloyments/mainnet/deloyments/2024-04-03-info.json
网络networkcode_hashcell_deptype_id args数据哈希data hash部署交易deploy tx
mainnet0x2c8c11c985da60b0a330c61a85507416d6382c130ba67f0c47ab071e00aec628 data10x67524c01c0…9808c2ad:0 code—0x2c8c11c985…00aec6280x67524c01c0…9808c2ad #12620882
testnet0x8e341bcfec6393dcd41e635733ff2dca00a6af546949f70c57a706c0f344df8b type0xff91b063c7…17cf4cef:0 code0xe04976b676…117884b50xcc2518c2c1…4c1350400xff91b063c7…17cf4cef #12737020
链上数据核对于 on-chain data checked 2026-10-20
错误码(error.rs):1 IndexOutOfBound · 2 ItemMissing · 3 LengthNotEnough · 4 Encoding · 6 UniqueTypeIdInvalid · 7 InputUniqueCellForbidden · 8 OnlyOneUniqueOutputCellAllowedError codes (error.rs): 1 IndexOutOfBound · 2 ItemMissing · 3 LengthNotEnough · 4 Encoding · 6 UniqueTypeIdInvalid · 7 InputUniqueCellForbidden · 8 OnlyOneUniqueOutputCellAllowed
data 内容不被合约检查;RGB++ 用它存 xUDT 代币信息(decimal ‖ name ‖ symbol),属约定,未核实Data is not checked by the script; RGB++ stores xUDT token info (decimal ‖ name ‖ symbol) there by convention (unverified)
GitHub · gpBlockchain/ckb-contract-flow-html