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)
- 2026-11-15 · psawyerberlin/ckb-revocable-timelock · more from this project
More about CCC (TypeScript SDK)
- CCC EVM signer exposes several lock addresses via getAddressObjs
- Use findCellsOnChain, not findCells, for block range queries in CCC
- Clear the CCC client cache after a sent transaction loses a double spend race
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.