PW lock 约束PW lock Constraints
来源:lay2dev/pw-lock / c/secp256k1_keccak256_sighash_all_acpl.c(假定部署的是 acpl 版本,未核实) · mainnet 0xbf43…febc / testnet 0x58c5…5a63,hash_type type(ccc)Source: lay2dev/pw-lock / c/secp256k1_keccak256_sighash_all_acpl.c (deployed build assumed to be acpl, unverified) · mainnet 0xbf43…febc / testnet 0x58c5…5a63, hash_type type (ccc)
A以太坊签名花费Spend with an Ethereum signature
Inputs 输入Inputs
inputCell{
lock: { codeHash: PW_LOCK,
args: eth_address 20B ‖ ckb_min? ‖ udt_min? }
}
witnessWitnessArgs{ lock: signature 65B }
➜
Outputs 输出Outputs
outputs:任意outputs: anyCell{ lock: 任意 }Cell{ lock: any }
args 字节布局args byte layout
eth_address20B
ckb_min?1B
udt_min?1B
- eth_address 20B keccak256(未压缩公钥)[12..32]keccak256(uncompressed pubkey)[12..32] = 签名恢复结果= recovered signer (-31)
- ckb_min? 1B 最小转入 CKB = 10^xmin CKB payment = 10^x 可选optional (-1)
- udt_min? 1B 最小转入 UDT = 10^xmin UDT payment = 10^x 可选optional (-1)
限制Constraints
- args:: 20–22 字节20–22 bytes (-1)
- witness.lock:: 非空即走签名路径,且必须恰 65 字节non-empty selects the signature path and must be exactly 65 bytes (-1)
- signature:: keccak256 sighash_all(witness.lock 置 0)恢复出的地址 = args[0..20]address recovered from keccak256 sighash_all (lock zeroed) = args[0..20] (-11 / -14 / -15 / -31)
B无签名付款(与 anyone_can_pay 相同)Payment without signature (same as anyone_can_pay)
Inputs 输入Inputs
PW lock 输入PW lock inputsCell{ lock: PW_LOCK(args), capacity: C, type: T?, data: udt? }
witnesswitness 缺失或 lock 为空witness missing or lock empty
➜
Outputs 输出Outputs
同 lock 输出same-lock outputsCell{ lock: same, type: same T,
capacity ≥ C + 10^ckb_min or = C,
udt ≥ U + 10^udt_min or = U }
限制Constraints
- amount:: CKB 或 UDT 至少一个按最小值增加,另一个不变CKB or UDT grows by ≥ minimum, the other unchanged (-42)
- pairing:: 输入输出按 type 一一配对inputs and outputs pair 1:1 by type (-44 / -45 / -46)
- data:: 无 type 的 data 为空;有 type 的 data ≥ 16Bno-type data empty; typed data ≥ 16B (-2)
- inputs ≤ 256≤ 256 (-43)
部署与来源Deployments & source 未核验unverified
源码source lay2dev/pw-lock@9445db0a · c/secp256k1_keccak256_sighash_all_acpl.c (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 | 0xbf43c3602455798c1a61a596e0d95278864c552fafe231c063b3fabf97a8febc type | 0x1d60cb8f46…924d15d4:0 code | 0x42ade2f25e…b6175261 | 0xd6a5a0edb1…a1bde3ee | 0x1d60cb8f46…924d15d4 #2479211 |
| testnet | 0x58c5f491aba6d61678b7cf7edf4910b1f5e00ec0cde2f42e0abb4fd9aff25a63 type | 0x57a62003da…dde61b38:0 code | 0xf6d90bfe30…9f523268 | 0xeffe377419…5b9f9878 | 0x57a62003da…dde61b38 #412378 |
链上数据核对于 on-chain data checked 2026-10-20
错误码(common.h):-1 ARGUMENTS_LEN · -2 ENCODING · -3 SYSCALL · -11/-12/-13/-14/-15 secp · -18 TOO_MANY_OUTPUT_CELLS · -21 SCRIPT_TOO_LONG · -22 WITNESS_SIZE · -31 PUBKEY_BLAKE160_HASH · -41…-46 ACPError codes (common.h): -1 ARGUMENTS_LEN · -2 ENCODING · -3 SYSCALL · -11/-12/-13/-14/-15 secp · -18 TOO_MANY_OUTPUT_CELLS · -21 SCRIPT_TOO_LONG · -22 WITNESS_SIZE · -31 PUBKEY_BLAKE160_HASH · -41…-46 ACP