CKB Pulse

All lessons · CCC (TypeScript SDK) · Start here · Glossary

Use findCellsOnChain for shared live stateWorkingFrom one fix

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

client.findCells merges results from the client's local cache, which can still hold outputs of your own earlier transactions after other parties spent them on chain. When you need the true live cell set, such as state shared with other actors or runners, use client.findCellsOnChain.

Why it matters: With findCells, a builder can pick up the signer's own earlier outputs that other parties already spent on chain, so it builds transactions over stale cells next to the live ones and they fail or misread state.

Medium confidence.

Pattern

client.findCells({script, scriptType, ...}) used to read shared on-chain state → client.findCellsOnChain({...})
Concepts
Indexer queries and cell collection
Evidence
From one fix: from one project, checked against its commit
First seen
2026-11-15
Last changed
2026-11-15
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)

More about CCC (TypeScript SDK)

All 33 in this topic

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

Cite this lesson
LusoCryptoLabs, "Use findCellsOnChain for shared live state", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/use-findcellsonchain-for-shared-live-state, CC BY 4.0, last changed 2026-11-15.

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.