ckb-ccc-transactions
Installation
SKILL.md
CKB CCC — Transactions
The canonical CCC transaction pattern. This applies to plain CKB transfers and is the foundation that ckb-ccc-udt and ckb-ccc-spore build on top of — those skills only cover what's different for their asset type, not the full pattern again.
You need a connected Signer before any of this — see ckb-ccc-signer-setup.
Standard transaction composition pattern
- Resolve recipient —
const { script: lock } = await ccc.Address.fromString(toAddress, signer.client). - Build transaction —
const tx = ccc.Transaction.from({ outputs: [{ capacity: ccc.fixedPointFrom("100"), lock }] }). - Complete inputs —
await tx.completeInputsByCapacity(signer)— must come before fee calculation. - Pay fee —
await tx.completeFeeBy(signer)— omit fee rate argument to use automatic network rate. - Send —
const txHash = await signer.sendTransaction(tx). - Verify — Optionally wait for confirmation:
await signer.client.waitTransaction(txHash, 1).
This order is mandatory: outputs declared → completeInputsByCapacity → completeFeeBy → sendTransaction.
Calling completeFeeBy before completeInputsByCapacity produces an incorrect fee.