Omnilock V1 约束(2022 年早期版本)Omnilock V1 Constraints (early 2022 build)
来源:nervosnetwork/ckb-production-scripts@ddaeae8 c/omni_lock.c + c/ckb_identity.h(build.rs 固定的二进制 hash = 主网 V1 data hash 0xf18e…dee5) · mainnet 0xa439…086d / testnet 0x79f9…2e1e,hash_type typeSource: nervosnetwork/ckb-production-scripts@ddaeae8 c/omni_lock.c + c/ckb_identity.h (binary hash pinned in build.rs = mainnet V1 data hash 0xf18e…dee5) · mainnet 0xa439…086d / testnet 0x79f9…2e1e, hash_type type
给 AI agent:For AI agents: omnilock_v1.md · llms.txt
A普通解锁(auth 签名)Normal unlock (auth signature)
Inputs 输入Inputs
input(同一 Omnilock group)input (same Omnilock group)Cell{
lock: { codeHash: OMNILOCK,
args: auth(21B) ‖ omnilock flags 1B ‖ optional fields }
}
witness[group 第 1 个]witness[group's first]WitnessArgs{
lock: OmniLockWitnessLock{
signature: Some(sig),
omni_identity: None,
preimage: None/Some
}
}WitnessArgs{
lock: OmniLockWitnessLock{
signature: Some(sig),
omni_identity: None,
preimage: None/Some
}
}
Outputs 输出Outputs
outputs:任意outputs: anyCell{ lock: 任意, type: 任意 }Cell{ lock: any, type: any }
args 字节布局args byte layout
auth flag1B
auth content20B
omnilock flags1B
omni_root?32B
acp min?2B
since?8B
info_cell?32B
- auth flag1B0 CKB / 1 ETH / 6 multisig / 0xFC owner lock / 0xFD exec / 0xFE dl(V1:2 EOS / 3 Tron / 4 BTC / 5 Doge 虽有定义但 ckb_verify_identity 不处理 → 4;0x12 未定义)0 CKB / 1 ETH / 6 multisig / 0xFC owner lock / 0xFD exec / 0xFE dl (V1: 2 EOS / 3 Tron / 4 BTC / 5 Doge are defined but ckb_verify_identity does not handle them → 4; 0x12 undefined)已知取值known valueCKB_INVALID_DATA (4)
- auth content20Bpubkey hash / 地址 / multisig script hash / lock script hash[0..20]pubkey hash / address / multisig script hash / lock script hash[0..20]与签名恢复结果一致matches the recovered signer-31
- omnilock flags1Bbit0 管理员(omni_root) · bit1 ACP · bit2 time-lock · bit3 supplybit0 admin (omni_root) · bit1 ACP · bit2 time-lock · bit3 supply决定后续字段selects the optional fields87
- omni_root?32BRC cell 的 type_id(bit0)RC cell type_id (bit0)—87
- acp min?2BCKB / UDT 最小转入(10^n)(bit1)min CKB / UDT payment as 10^n (bit1)—87
- since?8Btime-lock(bit2)time-lock (bit2)—87
- info_cell?32Bsupply info cell type hash(bit3)supply info cell type hash (bit3)—87
限制Constraints
- args长度 = 22 + 所选可选字段,多一字节少一字节都不行length = 22 + chosen optional fields, exactly87
- signatureauth flag 0 / 1:恰 65 字节auth flag 0 / 1: exactly 65 bytes71
- auth flag只接受 0、1、6、0xFC、0xFD、0xFE;其余(含 2–5、0x12)返回 CKB_INVALID_DATAonly 0, 1, 6, 0xFC, 0xFD, 0xFE are accepted; anything else (incl. 2–5, 0x12) returns CKB_INVALID_DATA4
- signature恢复出的地址 = auth contentrecovered signer = auth content-31
- auth flag 6multisig 规则同 secp multisigmultisig rules as in secp multisig-41…-52
- auth flag 0xFC某个 input 的 lock hash 前 20B = auth contentsome input lock hash[0..20] = auth content70
- since(bit2)每个 group input 的 since flags 相同且 ≥ args.sinceeach group input since has same flags and ≥ args.since-23 / -24
- supply(bit3)info cell 供应量不超上限、不得 burn 等info cell supply ≤ max, no burn, etc.90 / 91 / 92 / 93
BACP 模式(bit1 且无签名)ACP mode (bit1, no signature)
Inputs 输入Inputs
inputCell{
lock: OMNILOCK(args flags bit1),
capacity: C, data: udt amount?
}
witnesssignature: Nonesignature: None
Outputs 输出Outputs
同 lock 输出output with the same lockCell{
lock: same,
capacity: ≥ C + 10^ckb_min,
udt: ≥ + 10^udt_min
}
限制Constraints
- pairing每个输入 lock 必须有唯一对应输出each input lock pairs with exactly one output-44 / -45 / -46
- amountCKB 与 UDT 均不减少,且增加不少于最小值CKB and UDT don't decrease and grow by at least the minimum-42
- type最多 32 种 type hashat most 32 type hashes-43
C管理员模式(omni_identity)Administrator mode (omni_identity)
Inputs 输入Inputs
witnessOmniLockWitnessLock{
signature: Some,
omni_identity: Some(Identity{identity 21B, proofs})
}
cell_depscell_depsRC cell(type_id = omni_root),含白名单 SMT rootRC cell (type_id = omni_root) with whitelist SMT root
Outputs 输出Outputs
outputs任意;since / supply / ACP 均不生效any; since / supply / ACP don't apply
限制Constraints
- args必须带 omni_root(bit0)must have omni_root (bit0)47
- omni_identity必须带 proofsmust include proofs47
- RC rules至少一条,且为白名单at least one rule, whitelist82 / 83
- proof证明条数 = rule 数,identity 在白名单 SMT 中proof count = rule count, identity in whitelist SMT81 / 59
部署与来源Deployments & source 未核验unverified
源码source
nervosnetwork/ckb-production-scripts@ddaeae8f · c/omni_lock.c · c/ckb_identity.h · c/omni_lock_time_lock.h · c/omni_lock_acp.h · c/omni_lock_supply.h · build.rs (build.rs at this commit pins the omni_lock binary hash f18e295b…dee5 = mainnet OMNI Lock V1 code cell data hash (the checker below only scans checksum/deployment files, so it reports unverified). Testnet V1 / Force Bridge binary 0x1bf147d1…67d1 not matched to any commit.)
二进制核验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 | 0xa4398768d87bd17aea1361edc3accd6a0117774dc4ebc813bfa173e8ac0d086d type | 0x625696834d…9071473b:0 code | 0xf3a8efcb16…2539654d | 0xf18e295b6a…dadadee5 | 0x625696834d…9071473b #7469215 |
| testnet | 0x79f90bb5e892d80dd213439eeab551120eb417678824f282b4ffb5f21bad2e1e type | 0x9154df4f73…6d97f39c:0 code | 0x1b8572b16c…9f9615b7 | 0x1bf147d1c9…3ae267d1 | 0x9154df4f73…6d97f39c #2787244 |
| mainnet | 0x9f3aeaf2fc439549cbc870c653374943af96a0658bd6b51be8d8983183e6f52f type | 0xaa8ab7e97e…0c3ce10a:1 code | 0xf5ddc0db6e…f8859727 | 0x1bf147d1c9…3ae267d1 | 0xaa8ab7e97e…0c3ce10a #5361164 |
链上数据核对于 on-chain data checked 2026-11-06
版本核验:主网 OMNI Lock V1(0xa439…086d)的 code cell 数据 blake2b = 0xf18e295b…dee5,这个值写在 ckb-production-scripts 的 build.rs 里(commit ddaeae8 “Omnilock (#21)”,2022-03-07 起,直到 716433e 改掉),build.rs 会在构建时校验产物 hash,因此可判定 V1 即该时期的 c/omni_lock.c。本页规则按 ddaeae8 阅读。Version check: the mainnet OMNI Lock V1 (0xa439…086d) code cell data hashes (blake2b) to 0xf18e295b…dee5. That value is pinned in ckb-production-scripts build.rs from commit ddaeae8 "Omnilock (#21)" (2022-03-07) until 716433e changed it; build.rs checks build outputs against it, so V1 is c/omni_lock.c of that period. These rules were read at ddaeae8.
测试网 OMNI Lock V1(0x79f9…2e1e)的二进制 data hash 是 0x1bf147d1…67d1,与主网 V1 不同,未在 ckb-production-scripts / omnilock 历史中找到对应 commit;规则未针对该二进制核验。The testnet OMNI Lock V1 (0x79f9…2e1e) binary has data hash 0x1bf147d1…67d1, different from mainnet V1, and no matching commit was found in ckb-production-scripts / omnilock history; the rules are not verified for that binary.
同一个 0x1bf147d1 二进制也部署在主网 0x9f3a…f52f(CKB Explorer 叫它 “Force Bridge”):据 Explorer 公开 issue Magickbase/ckb-explorer-public-issues#532,它是 Force Bridge / Yokai Swap 在 Omnilock 主网发布前从未发布源码部署的 Omnilock。本插件也匹配它,但规则同样未核验。The same 0x1bf147d1 binary is deployed on mainnet as 0x9f3a…f52f (CKB Explorer calls it "Force Bridge"): per the Explorer public issue Magickbase/ckb-explorer-public-issues#532 it is an Omnilock that Force Bridge / Yokai Swap deployed from unreleased source before Omnilock launched on mainnet. This plugin matches it too, with the rules likewise unverified.
与 V2(omnilock 页)的差异:V1 不支持 auth flag 2–5 与 0x12;time-lock 只把绝对 epoch 分数 flag(0x20)按 epoch 比较(V2 还处理相对 epoch 0xA0);其余错误码与 V2 相同。Differences from V2 (omnilock page): V1 does not support auth flags 2–5 or 0x12; time-lock compares as epoch only for the absolute-epoch flag (0x20) (V2 also handles relative epoch 0xA0); other error codes are the same as V2.
错误码:80 UNKNOWN_FLAGS · 81 PROOF_LENGTH_MISMATCHED · 82 NO_OMNIRULE · 83 NO_WHITE_LIST · 84 INVALID_IDENTITY_ID · 85 INVALID_OMNI_LOCK_ARGS · 86 ISO9796_2_VERIFY · 87 ARGS_FORMAT;70–75 identity 错误(70 LOCK_SCRIPT_HASH_NOT_FOUND, 71 WRONG_ARGS);40–63 来自 rce.hError codes: 80 UNKNOWN_FLAGS · 81 PROOF_LENGTH_MISMATCHED · 82 NO_OMNIRULE · 83 NO_WHITE_LIST · 84 INVALID_IDENTITY_ID · 85 INVALID_OMNI_LOCK_ARGS · 86 ISO9796_2_VERIFY · 87 ARGS_FORMAT; 70–75 identity errors (70 LOCK_SCRIPT_HASH_NOT_FOUND, 71 WRONG_ARGS); 40–63 from rce.h
签名消息与 secp256k1_blake160 相同(sighash_all),ETH/BTC 等再按各链格式包装Signing message is the same sighash_all as secp256k1_blake160, then wrapped per chain format for ETH/BTC/etc.
witness 缺失不会立即失败(owner lock 模式可不需要 witness)A missing witness doesn't fail immediately (owner-lock mode may need none)
2026-11-19 上游审阅(非链上升级声明):V1 源码已迁仓删除;build.rs 原有主网 hash 为 f18e…dee5。HEAD 的共享 identity 多签数组修复不证明 V1 已升级;V2 已有独立 omnilock 插件。继续保留 V1 认证方式及部署;testnet/Force Bridge 二进制的精确源码仍未证实。2026-11-19 upstream review (not an on-chain upgrade claim): V1 files were removed on repository migration; the old build.rs records mainnet hash f18e…dee5. A later shared-identity multisig array fix is not evidence of a V1 upgrade; V2 has its own omnilock plugin. Retain V1 auth/deployments; exact source of testnet/Force Bridge binaries remains unproven.
测试网 OMNI Lock V1(0x79f9…2e1e)的二进制 data hash 是 0x1bf147d1…67d1,与主网 V1 不同,未在 ckb-production-scripts / omnilock 历史中找到对应 commit;规则未针对该二进制核验。The testnet OMNI Lock V1 (0x79f9…2e1e) binary has data hash 0x1bf147d1…67d1, different from mainnet V1, and no matching commit was found in ckb-production-scripts / omnilock history; the rules are not verified for that binary.
同一个 0x1bf147d1 二进制也部署在主网 0x9f3a…f52f(CKB Explorer 叫它 “Force Bridge”):据 Explorer 公开 issue Magickbase/ckb-explorer-public-issues#532,它是 Force Bridge / Yokai Swap 在 Omnilock 主网发布前从未发布源码部署的 Omnilock。本插件也匹配它,但规则同样未核验。The same 0x1bf147d1 binary is deployed on mainnet as 0x9f3a…f52f (CKB Explorer calls it "Force Bridge"): per the Explorer public issue Magickbase/ckb-explorer-public-issues#532 it is an Omnilock that Force Bridge / Yokai Swap deployed from unreleased source before Omnilock launched on mainnet. This plugin matches it too, with the rules likewise unverified.
与 V2(omnilock 页)的差异:V1 不支持 auth flag 2–5 与 0x12;time-lock 只把绝对 epoch 分数 flag(0x20)按 epoch 比较(V2 还处理相对 epoch 0xA0);其余错误码与 V2 相同。Differences from V2 (omnilock page): V1 does not support auth flags 2–5 or 0x12; time-lock compares as epoch only for the absolute-epoch flag (0x20) (V2 also handles relative epoch 0xA0); other error codes are the same as V2.
错误码:80 UNKNOWN_FLAGS · 81 PROOF_LENGTH_MISMATCHED · 82 NO_OMNIRULE · 83 NO_WHITE_LIST · 84 INVALID_IDENTITY_ID · 85 INVALID_OMNI_LOCK_ARGS · 86 ISO9796_2_VERIFY · 87 ARGS_FORMAT;70–75 identity 错误(70 LOCK_SCRIPT_HASH_NOT_FOUND, 71 WRONG_ARGS);40–63 来自 rce.hError codes: 80 UNKNOWN_FLAGS · 81 PROOF_LENGTH_MISMATCHED · 82 NO_OMNIRULE · 83 NO_WHITE_LIST · 84 INVALID_IDENTITY_ID · 85 INVALID_OMNI_LOCK_ARGS · 86 ISO9796_2_VERIFY · 87 ARGS_FORMAT; 70–75 identity errors (70 LOCK_SCRIPT_HASH_NOT_FOUND, 71 WRONG_ARGS); 40–63 from rce.h
签名消息与 secp256k1_blake160 相同(sighash_all),ETH/BTC 等再按各链格式包装Signing message is the same sighash_all as secp256k1_blake160, then wrapped per chain format for ETH/BTC/etc.
witness 缺失不会立即失败(owner lock 模式可不需要 witness)A missing witness doesn't fail immediately (owner-lock mode may need none)
2026-11-19 上游审阅(非链上升级声明):V1 源码已迁仓删除;build.rs 原有主网 hash 为 f18e…dee5。HEAD 的共享 identity 多签数组修复不证明 V1 已升级;V2 已有独立 omnilock 插件。继续保留 V1 认证方式及部署;testnet/Force Bridge 二进制的精确源码仍未证实。2026-11-19 upstream review (not an on-chain upgrade claim): V1 files were removed on repository migration; the old build.rs records mainnet hash f18e…dee5. A later shared-identity multisig array fix is not evidence of a V1 upgrade; V2 has its own omnilock plugin. Retain V1 auth/deployments; exact source of testnet/Force Bridge binaries remains unproven.