全部经验 · CCC (TypeScript SDK) · 从这里开始 · 术语表
Sign each lock group with its own placeholder length and witness shape实践再次出现
再次出现 · 核对结果:正确 · 核对于 2026-11-19
When one key controls several lock groups in a CCC transaction, call transaction.prepareSighashAllWitness(script, len, client) for each group with the final witness lock length of that lock, then getSignHashInfo and sign that group's own digest. In KeyWay's case the length is 65 bytes for secp256k1 and 85 bytes for an Omnilock owner witness holding one 65-byte signature; write the bare signature for secp256k1 and wrap it in the OmniLockWitnessLock molecule for Omnilock. A custom lock with its own witness layout needs its own length the same way.
为什么重要: If a group's digest is computed over a placeholder of the wrong length, or one group's signature is reused for another lock, the witness the lock script hashes on chain differs from what was signed and verification fails.
代码模式
await transaction.prepareSighashAllWitness(script, witnessLockLength(kind), client);摘自提交,已缩短。
同一提交中改动了测试
它与修复在一起,我们没有运行它。
- officialcmg/ckb-keyway:
tests/general-signing-postgres.test.ts,tests/transaction-policy.test.ts
- 概念
- Witnesses and signatures, Transaction building and fees
- 证据
- 再次出现: 在两个或以上项目中出现
- 首次出现
- 2026-10-23
- 最近改动
- 2026-10-23
- 最近核对
- 2026-11-19
- 对照提交的核对结果
- 正确:这条经验出自该提交,并且在今天的代码中仍然成立
来源(2)
- 2026-10-23 · officialcmg/ckb-keyway · 这个项目的更多经验
- 2026-10-14 · salmansarwarr/Tranfr · 这个项目的更多经验
更多关于CCC (TypeScript SDK)
- Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactions
- completeFeeBy adds change instead of shrinking outputs, breaking output bound proofs
- Plain CKB transfer with a CCC signer
引用这条经验
LusoCryptoLabs, "Sign each lock group with its own placeholder length and witness shape", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/sign-each-lock-group-with-its-own-placeholder-length-and-wit, CC BY 4.0, last changed 2026-10-23.