CKB Pulse

All lessons · CKB node, RPC and indexer · Start here · Glossary

Indexer free cell discovery by block scan plus get_live_cell on a local chainWorkingFrom one fix

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

Without an indexer on a small local chain, cells for a lock can be found by walking get_block_by_number from 0 to the tip, matching output locks, and confirming each hit with get_live_cell (with_data true). The commit also checks get_block_hash per height and at the end, then rechecks each match, so the result is treated as a snapshot that a reorg or spend can invalidate.

Why it matters: Without the get_live_cell check, outputs that were already spent are returned as funding cells. The test shows this: after the genesis transaction, the owner's original cell at index 3 must drop out and only the new change cell at index 1 remain, otherwise a later transaction would try to spend a dead input.

Pattern

Prefer
live=await rpc('get_live_cell',[outPoint,true]);if(live.status!=='live')continue;

Taken from the commit, shortened.

Concepts
Indexer queries and cell collection, Testing and devnet
Evidence
From one fix: from one project, checked against its commit
First seen
2026-11-05
Last changed
2026-11-05
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)

More about CKB node, RPC and indexer

All 45 in this topic

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

Cite this lesson
LusoCryptoLabs, "Indexer free cell discovery by block scan plus get_live_cell on a local chain", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/indexer-free-cell-discovery-by-block-scan-plus-get-live-cell, CC BY 4.0, last changed 2026-11-05.

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.