All lessons · CCC (TypeScript SDK) · Start here · Glossary
Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactionsWorkingReproduced
Reproduced · Check: right · Checked 2026-11-19
When a CCC transaction has inputs locked by several secp256k1 signers but the fee is paid by one, call tx.prepareSighashAllWitness(coSignerLock, 65, client) for each co-signer before tx.completeFeeBy(payer, feeRate). Otherwise the fee is estimated without their signature witnesses and may come out short. Each co-signer must own at least one input to have a script group to sign.
Why it matters: completeFeeBy only prepares the payer's witness, so co-signer signatures added later grow the transaction past the size the fee was paid for, and the fee can fall short of the fee rate.
Pattern
await tx.prepareSighashAllWitness(await lockOf(s), SECP_SIGNATURE_LEN, client);Taken from the commit, shortened.
Reproduced by a test
A public test runs what this lesson says on @ckb-ccc/core 1.23.1, with no node. Anyone can run it.
tests/ccc/cosigner-witness-before-fee.test.mjs
- Concepts
- Transaction building and fees, Witnesses and signatures
- Evidence
- Reproduced: reproduced by a public test
- First seen
- 2026-10-06
- Last changed
- 2026-10-06
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-10-06 · salmansarwarr/Kirea-finance · more from this project
More about CCC (TypeScript SDK)
- Sign each lock group with its own placeholder length and witness shape
- completeFeeBy adds change instead of shrinking outputs, breaking output bound proofs
- Plain CKB transfer with a CCC signer
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactions", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/reserve-co-signer-witness-space-before-completefeeby-in-mult, CC BY 4.0, last changed 2026-10-06.