All lessons · CKB node, RPC and indexer · Start here · Glossary
Use indexer matched cell indexes to limit input parent fetchesWorkingFrom one fix
From one fix · Check: right · Checked 2026-11-19
With CCC client.findTransactionsPaged (scriptSearchMode 'prefix', groupByTransaction: true), each returned transaction has a cells list of {isInput, cellIndex} entries for the cells that matched the searched script. If your logic only needs the matched inputs, fetch parent transactions with getTransaction only for those indexes (plus siblings from a parent you already hold) and skip unrelated inputs such as wallet funding. OpenSwap's market scanner did this together with raising read concurrency to 16, and its first scan went from about 8 to 10 s to about 5.3 s; the gain from this change alone was not measured.
Why it matters: Without it, every input's parent transaction is fetched with getTransaction, including wallet funding cells the logic never uses, which multiplies RPC reads and slows the scan.
Pattern
for(const c of t.cells)if(c.isInput)f.inputs.add(Number(c.cellIndex));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/markets-harness.ts,frontend/test/markets.spec.ts,pool-sdk/test/market-scan.test.ts,pool-sdk/test/market.test.ts
- Concepts
- Indexer queries and cell collection, Network and RPC reliability
- 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
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-10-29 · toastmanAu/openswap · more from this project
More about CKB node, RPC and indexer
- get_live_cell may return "unknown" rather than "dead" for a spent output
- Wait for get_indexer_tip to reach the commit block before re-reading cells
- Check indexer lag with get_indexer_tip before signing
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Use indexer matched cell indexes to limit input parent fetches", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/use-indexer-matched-cell-indexes-to-limit-input-parent-fetch, CC BY 4.0, last changed 2026-10-29.