All lessons · Developer tooling · Start here · Glossary
ckb-cli tx init overwrites an existing tx file with an empty skeletonWorkingFrom one fix
From one fix · Check: right · Checked 2026-11-19
`ckb-cli tx init --tx-file` creates a new empty transaction file and exits 0, so running it on a prepared transaction silently destroys that transaction. For a prebuilt transaction, write ckb-cli's tx-file wrapper ({transaction, multisig_configs, signatures}) yourself and go straight to `tx info` and `tx sign-inputs`.
Why it matters: Running `tx init` on a prepared transaction file replaces it with an empty skeleton and still reports success, so the transaction is lost and the later steps produce no result.
Pattern
fs.writeFileSync(outFile, JSON.stringify({ transaction: tx, multisig_configs: {}, signatures: {} }, null, 2));Taken from the commit, shortened.
- Concepts
- Transaction building and fees, Witnesses and signatures
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-09-23
- Last changed
- 2026-09-23
- 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-09-23 · toastmanAu/daowow · more from this project
More about Developer tooling
- ckb-cli deploy info file layout for offline multisig signing
- ckb-cli needs --skip-check to sign and send transactions with custom locks
- ckb-cli tx sign-inputs stores signatures in the file's signatures map, not witness 0
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "ckb-cli tx init overwrites an existing tx file with an empty skeleton", CKB lessons, https://pulse.lusocryptolabs.com/learned/tooling/ckb-cli-tx-init-overwrites-an-existing-tx-file-with-an-empty, CC BY 4.0, last changed 2026-09-23.