LiçõesO que a CKB aprendeu
Começa aqui · Glossário · Testa-te · Feed
As lições estão escritas em inglês, por isso pesquise em inglês.
“Indexer queries and cell collection” ✕
43 lições encontradas. Todas as lições
AnteriorPágina 2 de 4Seguinte
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.
Medium confidence.
#Indexer queries and cell collection · Fontes (1) · 2026-11-15
The built-in CKB indexer can trail the chain tip, so cells it returns may be stale. Before signing, compare the block_number from get_indexer_tip with the height from get_tip_header, show a notice when the gap is large, and refuse to sign while it is. daowow flags the indexer as lagging when it is more than 8 blocks behind, and its entry, refund and claim guards refuse to proceed in that state.
#Indexer queries and cell collection #Network and RPC reliability #Transaction building and fees · Fontes (1) · 2026-11-10
When many logical groups (here rounds) share one type script code hash, query the indexer's get_cells once with script_type "type", args "0x" and script_search_mode "prefix" to get every cell under that code hash, then bucket the cells client side by data length and args. Querying per group repeats the same scan and grows with the group count against a public node. The indexer returns cells in type args order, not age order, so sort the results yourself.
#Indexer queries and cell collection #Network and RPC reliability · Fontes (1) · 2026-11-10
When a cell stores only the root of an append-only accumulator (an MMR) that commits to every entry ever added, spending an entry cell removes it from the indexer's live set while the root still counts it. Replaying live cells builds a different tree and membership proofs fail (the first refund works, the second fails). If each append transaction carries its entries in a witness and spends the previous head at input 0, recover the full set by walking get_transaction backwards through input 0 and parsing each witness with a strict exact-length check, so unrelated WitnessArgs or empty witnesses are not read as entries. Refuse to act unless the recovered count equals the frozen entry count, and fail if the node no longer serves an old transaction.
Joined with daowow@765895a407.
#Indexer queries and cell collection #Witnesses and signatures · Fontes (2) · 2026-11-10
A Nervos DAO cell in phase 1 of withdrawal still has the DAO type script (code hash 0x82d76d...3f2e, hash_type type, args 0x), so filtering by type alone counts it as a deposit. Only cells whose output data is exactly 0x0000000000000000 are deposits; a withdrawing cell's data holds its deposit block number. The commit's testnet test shows a type-only count giving 500 CKB where the true deposit total is 300 CKB.
#Indexer queries and cell collection #Data encoding (molecule, hex, bigints) · Fontes (2) · 2026-11-06
To collect plain funding cells of a lock with the indexer get_cells (or get_cells_capacity) RPC, search with script_type "lock" and add filter output_data_len_range ["0x0","0x1"] and script_len_range ["0x0","0x1"]. Ranges are half-open [start, end), so this keeps only cells with empty data, and since the search is by lock, script_len_range applies to the type script, so only cells with no type script come back. Sorting by capacity on the client only sees the page returned (limit), so page through the results if the lock may own more cells than the limit.
#Indexer queries and cell collection · Fontes (2) · 2026-11-05
When computing a wallet's spendable balance from indexer cells under a lock, count only cells with empty output data and no type script as available. A cell with data or any type script (UDT, DOB, profile or attachment cells, not just your own type) holds state, so its capacity stays in the total but is reported as reserved, because spending it would destroy that state. In cemp-mobile this is `const hasData = cell.data !== "0x" && cell.data !== ""; const isProtocol = hasData || type !== null;`.
#Indexer queries and cell collection #Capacity and cell size · Fontes (1) · 2026-10-31
On CKB node 0.210.0 devnet, get_live_cell for an output already consumed by a committed transaction returned status "unknown" instead of "dead", so a check requiring "dead" fails. Accept "dead" or "unknown" and prove consumption by calling get_transaction on the creating and consuming transactions, confirming both are committed and that the consumer's inputs reference the out point exactly once.
#Indexer queries and cell collection #Network and RPC reliability · Fontes (3) · 2026-10-30
A spore id or cluster id is the args of the spore (or spore_cluster) type script, so you can look one up by calling get_transactions with that type script, args set to the id, script_search_mode "exact" and a limit of 0x1. Because get_transactions returns history and not just live cells, this also finds spores that have since been melted.
Lookup by id via get_transactions, includes melted spores.
#Indexer queries and cell collection · Fontes (1) · 2026-10-30
A script deployed with a type id can be referenced by cells either as hashType data1 with the code's data hash or as hashType type with the deployment's type id hash (per network). An exact indexer search via client.findCells over only one form misses the other; here @ckbfs/api's useTypeID cells read as missing until the reader queried both forms and treated a combined count above one as an error.
#Indexer queries and cell collection #Type ID and upgrades · Fontes (1) · 2026-10-24
In CCC, client.getCell(outPoint) can also return a cell that has already been spent, so status checks built on it report claimed or reclaimed cells as still active. Use client.getCellLive(outPoint, true) and treat an undefined result as "not found or already spent".
#Indexer queries and cell collection · Fontes (1) · 2026-10-20
Treat a cell as a Nervos DAO deposit only if its type script exactly matches the DAO type script and its data is exactly 8 zero bytes. The DAO type script has code hash 0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e, hash_type type and empty args. A phase one withdrawing cell has the same type script but a nonzero block number in its 8 data bytes, so it fails this check, as do data of any other length and look alike type scripts.
joined with the ckb-service-runner card teaching the same check
#Indexer queries and cell collection #Data encoding (molecule, hex, bigints) · Fontes (2) · 2026-10-20
AnteriorPágina 2 de 4Seguinte
Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. JSON · Queres que uma lição seja mudada ou retirada? Abre um issue.