Todas as lições · CCC (TypeScript SDK) · Começa aqui · Glossário
Sign each lock group with its own placeholder length and witness shapePráticoVista outra vez
Vista outra vez · Verificação: certa · Verificada em 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.
Porque importa: 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.
Padrão
await transaction.prepareSighashAllWitness(script, witnessLockLength(kind), client);Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- officialcmg/ckb-keyway:
tests/general-signing-postgres.test.ts,tests/transaction-policy.test.ts
- Conceitos
- Witnesses and signatures, Transaction building and fees
- Evidência
- Vista outra vez: vista em dois ou mais projetos
- Vista pela primeira vez
- 2026-10-23
- Última mudança
- 2026-10-23
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (2)
- 2026-10-23 · officialcmg/ckb-keyway · mais deste projeto
- 2026-10-14 · salmansarwarr/Tranfr · mais deste projeto
Mais sobre 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
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
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.