CKB Pulse

Todas as lições · CCC (TypeScript SDK) · Começa aqui · Glossário

Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactionsPráticoReproduzida

Reproduzida · Verificação: certa · Verificada em 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.

Porque importa: 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.

Padrão

Preferir
await tx.prepareSighashAllWitness(await lockOf(s), SECP_SIGNATURE_LEN, client);

Tirado do commit, encurtado.

Reproduzida por um teste

Um teste público corre o que esta lição diz em @ckb-ccc/core 1.23.1, sem nó. Qualquer pessoa o pode correr.

tests/ccc/cosigner-witness-before-fee.test.mjs

Conceitos
Transaction building and fees, Witnesses and signatures
Evidência
Reproduzida: reproduzida por um teste público
Vista pela primeira vez
2026-10-06
Última mudança
2026-10-06
Ú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 (1)

Mais sobre CCC (TypeScript SDK)

Ver as 33 deste tema

Manténs um projeto de onde esta lição veio? Confirma ou corrige

Citar esta lição
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.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.