All lessons · CKB node, RPC and indexer · Start here · Glossary
Check chain-wide script users before consuming a deployed code cellWorkingChecked by the owner
Checked by the owner · Check: right · Checked 2026-11-19
Before consuming a deployed code cell, call indexer get_cells across the whole chain with script_search_mode "prefix" and args "0x", once as lock and once as type. Query the cell's data hash with hash_type data, data1 and data2, and for a Type ID cell also its type script hash with hash_type type. Zero results only means no live cell uses the binary right now. Consuming the cell is irreversible, and a Type ID identity cannot be recreated, so treat unused Type ID cells with extra caution.
Why it matters: If you only check your own wallet's cells, you can consume a binary that someone else's live cells still depend on, and those cells become unspendable. Consuming a Type ID cell destroys an identity that cannot be recreated.
Pattern
script: { code_hash: codeHash, hash_type: hashType, args: "0x" }, script_type: scriptType, script_search_mode: "prefix"Taken from the commit, shortened.
- Concepts
- Cell deps and script lookup, Indexer queries and cell collection, Type ID and upgrades
- Evidence
- Checked by the owner: checked by the owner of the project it came from, who is also the publisher of these lessons
- First seen
- 2026-09-18
- Last changed
- 2026-10-10
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (2)
- 2026-09-18 · toastmanAu/daowow · more from this project
- 2026-10-10 · LusoCryptoLabs/ckb-pulse · more from this project
More about CKB node, RPC and indexer
- Search for a script's cells under both its data hash and its type id code hash
- Filtering get_cells for plain, typeless, empty funding cells
- get_live_cell may return "unknown" rather than "dead" for a spent output
Checked by @LusoCryptoLabs (owner of the project), 2026-11-19.
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Check chain-wide script users before consuming a deployed code cell", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/check-chain-wide-script-users-before-consuming-a-deployed-co, CC BY 4.0, last changed 2026-10-10.