CKB Pulse

All lessons · Developer tooling · Start here · Glossary

Absence of on-chain references does not mean a code cell is safe to consumeWorkingFrom one fix

From one fix · Check: partly right · Checked 2026-11-19

Before consuming a deployed code cell, search live cells for its data hash as lock and type script code hash (prefix mode, hash types data, data1 and data2), and compare its data hash (blake2b with personalization ckb-default-hash) against the binaries you currently build. Zero references does not mean superseded: a contract unchanged by a rebuild has no users yet and is still the live deployment. This search does not see type ID references or cell dep use, so treat a cell that anything may resolve by type ID or as a dep as still needed.

Why it matters: Reclaiming every unreferenced code cell would have consumed the current dao-lock deployment and forced a pointless redeploy, and consuming a code cell cannot be undone.

Pattern

Prefer
digest = hashlib.blake2b(path.read_bytes(), digest_size=32, person=b"ckb-default-hash").hexdigest()

Taken from the commit, shortened.

Concepts
Type ID and upgrades, Indexer queries and cell collection, Cell deps and script lookup
Evidence
From one fix: from one project, checked against its commit
First seen
2026-09-20
Last changed
2026-09-20
Last checked
2026-11-19
Check against the commit
partly right: a true core, with a part that is loose or too wide

Sources (1)

More about Developer tooling

All 35 in this topic

Do you maintain a project this lesson came from? Confirm or correct it

Cite this lesson
LusoCryptoLabs, "Absence of on-chain references does not mean a code cell is safe to consume", CKB lessons, https://pulse.lusocryptolabs.com/learned/tooling/absence-of-on-chain-references-does-not-mean-a-code-cell-is, CC BY 4.0, last changed 2026-09-20.

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.