CKB Pulse

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

Prefer
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)

More about CCC (TypeScript SDK)

All 33 in this topic

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.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.