抗量子 SPHINCS+ Lock 约束Quantum-resistant SPHINCS+ Lock Constraints
来源:cryptape/quantum-resistant-lock-script / contracts/c-sphincs-all-in-one-lock/ckb-sphincsplus-root-lock.c、docs/advanced.md · mainnet 0x302d…cedf (type) / testnet 0x147e…7eaf (data1) · 部署见 README.mdSource: cryptape/quantum-resistant-lock-script / contracts/c-sphincs-all-in-one-lock/ckb-sphincsplus-root-lock.c, docs/advanced.md · mainnet 0x302d…cedf (type) / testnet 0x147e…7eaf (data1) · deployments in README.md
AM-of-N SPHINCS+(SLH-DSA, FIPS 205)多签解锁;单签是 1-of-1 特例M-of-N SPHINCS+ (SLH-DSA, FIPS 205) multisig unlock; single key is the 1-of-1 case
Inputs 输入Inputs
inputCell{ lock: { codeHash: SPHINCS_LOCK, args: config_hash 32B } }
witnessWitnessArgs{ lock: S ‖ R ‖ M ‖ N ‖ PWOS × N }
➜
Outputs 输出Outputs
outputs:任意outputs: any任意any
args = blake2b(personal "ckb-sphincs+-sct", multisig 配置),32 字节args = blake2b(personal "ckb-sphincs+-sct", multisig configuration), 32 bytes
S1B
R1B
M1B
N1B
param flag1B
pubkey32/48/64B
… × N
- S 1B 保留,固定 0x80reserved, fixed 0x80 = 0x80= 0x80 (103)
- R 1B 前 R 个公钥必须签名first R pubkeys must sign R ≤ MR ≤ M (103)
- M 1B 阈值threshold 0 < M ≤ N0 < M ≤ N (103)
- N 1B 公钥个数number of pubkeys > 0> 0 (103)
- param flag 1B 高 7 位 param ID,最低位(签名标志)为 0high 7 bits param ID, lowest bit (signature flag) 0 48–5948–59 (106)
- pubkey 32/48/64B SPHINCS+ 公钥SPHINCS+ public key 长度由 param ID 决定length set by param ID (106)
- … × N
witness.lock 布局witness.lock layout
S1B
R1B
M1B
N1B
param flag1B
pubkey32/48/64B
signature?7856–49856B
… × N
- S 1B 保留,固定 0x80reserved, fixed 0x80 = 0x80= 0x80 (103)
- R 1B 前 R 个公钥必须签名first R pubkeys must sign R ≤ MR ≤ M (103)
- M 1B 阈值threshold 0 < M ≤ N0 < M ≤ N (103)
- N 1B 公钥个数number of pubkeys > 0> 0 (103)
- param flag 1B param ID ≪ 1 | 有签名param ID ≪ 1 | has signature —— (106)
- pubkey 32/48/64B 公钥public key —— (106)
- signature? 7856–49856B 有签名标志时存在present when the flag is set 恰 M 个exactly M (107)
- … × N 按配置中公钥顺序in configuration order
param ID(crates/ckb-fips205-utils/src/lib.rs;尺寸取自 FIPS 205 表 2)param ID (crates/ckb-fips205-utils/src/lib.rs; sizes from FIPS 205 Table 2)
48 / 49
50 / 51
52 / 53
54–59
- 48 / 49 SHA2-128f / 128sSHA2-128f / 128s pk 32B;sig 17088 / 7856pk 32B; sig 17088 / 7856
- 50 / 51 SHA2-192f / 192sSHA2-192f / 192s pk 48B;sig 35664 / 16224pk 48B; sig 35664 / 16224
- 52 / 53 SHA2-256f / 256sSHA2-256f / 256s pk 64B;sig 49856 / 29792pk 64B; sig 49856 / 29792
- 54–59 SHAKE 同上顺序SHAKE, same order 尺寸同 SHA2sizes as SHA2
限制Constraints
- args:: 恰为 32 字节exactly 32 bytes (104)
- witness:: 第一个 group witness 是 WitnessArgs,lock 非空first group witness is WitnessArgs with non-empty lock (106)
- header:: S = 0x80,N > 0,0 < M ≤ N,R ≤ MS = 0x80, N > 0, 0 < M ≤ N, R ≤ M (103)
- PWOS:: N 个;param ID 合法;前 R 个必须有签名;恰好 M 个签名;之后无多余字节N of them; valid param ID; first R must be signed; exactly M signatures; no trailing bytes (106)
- config hash:: blake2b("ckb-sphincs+-sct", S‖R‖M‖N‖(flag & 0xFE ‖ pubkey)×N) = argsblake2b("ckb-sphincs+-sct", S‖R‖M‖N‖(flag & 0xFE ‖ pubkey)×N) = args (105)
- signature:: 每个签名覆盖 CKB_TX_MESSAGE_ALL(blake2b personal "ckb-sphincs+-msg"),由 leaf lock 经 exec/spawn 验证(未检查)each signature covers CKB_TX_MESSAGE_ALL (blake2b personal "ckb-sphincs+-msg"), verified by the leaf lock via exec/spawn (not checked) (102 / 107 / 111)
部署与来源Deployments & source 未核验unverified
源码source cryptape/quantum-resistant-lock-script@082c0a19 · contracts/c-sphincs-all-in-one-lock/ckb-sphincsplus-root-lock.c · docs/advanced.md (commit read when writing this spec)
二进制核验binary check 未核验unverified hash appears in the repo only as a deployment record or doc, which does not prove the recorded commit builds this binary (reproducible build not attempted)
0x49417a0ed3…1787565e: listed in deployment/mainnet/migrations/2026-01-13-005758.json
0x147ecbb5c5…aa0a7eaf: listed in README.md
0x49417a0ed3…1787565e: listed in deployment/mainnet/migrations/2026-01-13-005758.json
0x147ecbb5c5…aa0a7eaf: listed in README.md
| 网络network | code_hash | cell_dep | type_id args | 数据哈希data hash | 部署交易deploy tx |
|---|---|---|---|---|---|
| mainnet | 0x302d35982f865ebcbedb9a9360e40530ed32adb8e10b42fbbe70d8312ff7cedf type | 0x4598d00df2…a60f500a:0 code | 0xf75c922a8a…71c7c25b | 0x49417a0ed3…1787565e | 0x4598d00df2…a60f500a #18363853 |
| testnet | 0x147ecbb5c5127d982ee1362d2c2bb4267803da2eb006d150e88af6caaa0a7eaf data1 | 0x631d9a6049…10f0b106:0 code | — | 0x147ecbb5c5…aa0a7eaf | 0x631d9a6049…10f0b106 #19249395 |
链上数据核对于 on-chain data checked 2026-10-20
错误码(ckb-sphincsplus-common.h):101 ARGUMENTS_LEN · 102 MESSAGE · 103 ENCODING · 104 ARGS · 105 MULTISIG_HASH · 106 WITNESS · 107 VERIFY · 108 ARGV · 109 PARAMS · 110 UNEXPECTED · 111 LEAF_VERIFYError codes (ckb-sphincsplus-common.h): 101 ARGUMENTS_LEN · 102 MESSAGE · 103 ENCODING · 104 ARGS · 105 MULTISIG_HASH · 106 WITNESS · 107 VERIFY · 108 ARGV · 109 PARAMS · 110 UNEXPECTED · 111 LEAF_VERIFY
部署的是纯 C 版本(deployment/mainnet/deployment.toml 指向 build/release/c-sphincs-all-in-one-lock);Rust 版与混合版仅作对比,未部署The deployed build is the pure C one (deployment/mainnet/deployment.toml points at build/release/c-sphincs-all-in-one-lock); the Rust and hybrid versions are comparisons, not deployed
mainnet 升级由 3-of-5 multisig 控制(deployment/mainnet/README.md)Mainnet upgrades are controlled by a 3-of-5 multisig (deployment/mainnet/README.md)
部署的是纯 C 版本(deployment/mainnet/deployment.toml 指向 build/release/c-sphincs-all-in-one-lock);Rust 版与混合版仅作对比,未部署The deployed build is the pure C one (deployment/mainnet/deployment.toml points at build/release/c-sphincs-all-in-one-lock); the Rust and hybrid versions are comparisons, not deployed
mainnet 升级由 3-of-5 multisig 控制(deployment/mainnet/README.md)Mainnet upgrades are controlled by a 3-of-5 multisig (deployment/mainnet/README.md)