从这里开始 · 术语表 · 自测 · 订阅
经验用英文撰写,请用英文搜索。
#Indexer queries and cell collection ✕
找到 43 条经验。 全部经验
上一页第 4 页,共 4 页
In CCC, client.findCells merges the client's local cache of cells it has sent, and its search key takes no blockRange filter. To list live cells created in a block range, call client.findCellsOnChain with filter.blockRange set to [from, to), where the end is exclusive. This queries the indexer directly.
#Indexer queries and cell collection · 来源(1) · 2026-09-25
A CKB light client that only watches scripts cannot look a cell up by outpoint, so a service that hands one a cell should also give the block number and hash of the transaction that created it. The client can then fetch that transaction by hash and watch for the cell being spent from that block, instead of scanning from genesis.
#Indexer queries and cell collection #Network and RPC reliability · 来源(1) · 2026-09-24
To get a cell's confirmation count over raw CKB JSON-RPC, read tx_status.block_hash from get_transaction, look up its number with get_header, then compute tip − included + 1 using get_tip_header; treat a missing block_hash as 0 confirmations. This commit's helper also retries get_transaction without the "0x2" verbosity param if the node rejects it, and treats get_live_cell as live only when status === "live".
#Network and RPC reliability #Indexer queries and cell collection · 来源(1) · 2026-09-22
Before consuming a deployed code cell, search live cells for its data hash as lock and type script code hash (prefix mode, hash types data, data1 and data2), and compare its data hash (blake2b with personalization ckb-default-hash) against the binaries you currently build. Zero references does not mean superseded: a contract unchanged by a rebuild has no users yet and is still the live deployment. This search does not see type ID references or cell dep use, so treat a cell that anything may resolve by type ID or as a dep as still needed.
#Type ID and upgrades #Indexer queries and cell collection #Cell deps and script lookup · 来源(1) · 2026-09-20
A get_cells query with script_search_mode "prefix" and args "0x" returns every live cell whose script has that code hash and hash_type, whatever its args, so it can include cells of the same script with a different data layout (for example a script that owns both a state cell and a ledger cell). Check output_data length, or catch the decode error, and skip the cell before calling a strict decoder. Otherwise one unexpected cell throws and the whole result list is lost.
#Indexer queries and cell collection #Data encoding (molecule, hex, bigints) · 来源(1) · 2026-09-18
CKB serves get_cells, get_indexer_tip and the other indexer RPC methods only when "Indexer" is listed in the [rpc] modules array of ckb.toml. The ckb.toml generated in the nervos/ckb 0.209.0 devnet image used here leaves Indexer out, so add it before relying on cell collection against a devnet node. Then confirm with a real indexer call such as get_cells after the node starts.
#Indexer queries and cell collection #Testing and devnet · 来源(1) · 2026-09-18
An exhausted indexer get_cells scan returns {objects: [], last_cursor: "0x"} (captured from a real node). The authors report that calling get_cells again with after = "0x" then returns nothing, even once matching cells exist, and a hand-written mock that never returned the real "0x" hid this for days. When paging, stop on an empty page before reading last_cursor, and never send or persist a "0x" cursor. Build paging tests from captured node responses, not hand-written mocks.
#Indexer queries and cell collection #Testing and devnet · 来源(1) · 2026-09-18
上一页第 4 页,共 4 页
文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。