All lessons · CCC (TypeScript SDK) · Start here · Glossary
Verifying an immutable data1 script code cell after deploymentWorkingFrom one fix
From one fix · Check: partly right · Checked 2026-11-19
For a script referenced by hashType 'data1', put the binary in a cell whose lock is the always fail lock (codeHash 32 zero bytes, hashType data1, args 0x, which no code cell can match) and with no type, so the cell can never be spent and the cell dep stays live; the capacity is locked forever. After sending, read the cell with client.getCellLive(outPoint, true) and assert that ccc.hashCkb(outputData) equals the pinned code hash, that the lock equals the always fail lock and that there is no type, ideally on more than one endpoint. The data1 code hash is already pinned by the binary's content; the immutable lock is what keeps the cell available.
Why it matters: If the code cell had a spendable lock, the deployer could consume it, and every transaction using that out point as a cell dep would fail. Without the post-deployment check, a wrong binary, lock or type would be recorded in the manifest unnoticed.
Pattern
assert(code&&ccc.hashCkb(code.outputData)===LOCK_V2.codeHash ...); assert(code.cellOutput.lock.eq(IMMUTABLE_LOCK)&&!code.cellOutput.type,`Code cell is not immutable on ${url}`);Taken from the commit, shortened.
A test changed in the same commit
It sits next to the fix. We did not run it.
- toastmanAu/openswap:
frontend/test/fixtures.ts,sdk/test/v2-sdk.test.ts
- Concepts
- Cell deps and script lookup, Type ID and upgrades
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-10-29
- Last changed
- 2026-10-29
- 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)
- 2026-10-29 · toastmanAu/openswap · more from this project
More about CCC (TypeScript SDK)
- CCC custom client scripts must include AnyoneCanPay for SignerCkbPrivateKey
- Registering NervosDao on devnet
- Convert Fiber RPC snake_case scripts to CCC camelCase ScriptLike
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Verifying an immutable data1 script code cell after deployment", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/verifying-an-immutable-data1-script-code-cell-after-deployme, CC BY 4.0, last changed 2026-10-29.