CKB Pulse
Lessons

What CKB learned

Start here · Glossary · Test yourself · Feed

poshboytl/omavote

Lessons from poshboytl/omavote

github.com/poshboytl/omavote

Do you maintain this project? Confirm its lessons in one issue

7 lessons found. All lessons

Filtering get_cells for plain, typeless, empty funding cellsWorkingSeen again

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 · Sources (2) · 2026-11-05

Recognizing a Nervos DAO deposit cell (not a withdrawing one)WorkingSeen again

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) · Sources (2) · 2026-10-20

Reconstructing the live cell set at a past height from the CKB indexerAdvancedFrom one fix

The indexer's get_cells lists only cells live at its current tip. To get Nervos DAO deposits live at height H, read the indexer tip, list get_cells and keep those with block_number <= H, then read the indexer tip again as T. Then query get_transactions on the DAO type script with filter block_range [H+1, T+1) (the end is exclusive), keep io_type input, follow each input's previous_output to the creating tx and its header, and add back cells created at or below H. In both passes keep only real deposits (DAO type and 8 zero bytes of data), since withdrawing cells share the type script, and retry if either tip hash is no longer canonical per get_block_hash.

#Indexer queries and cell collection #Network and RPC reliability · Sources (1) · 2026-10-08

Verify a self indexed tip against the node's canonical block hash before serving itWorkingFrom one fix

A locally maintained index of CKB blocks can lag the node or still hold an orphaned block after a reorg, so before serving its tip as an anchor, fetch the node's tip number, wait briefly for the index to reach it, then ask the node for the canonical block hash at the indexed height and refuse (503 with NOT_SYNCED or REORGANIZING) unless it equals the indexed hash. The check narrows the window but is not atomic, so a client that signs over the anchor should also compare it with an independent source.

#Network and RPC reliability #Indexer queries and cell collection · Sources (1) · 2026-10-08

Wait for the indexer to reach the block before truncating the devnet chain in reorg testsWorkingFrom one fix

In a devnet reorg test, the inclusion status a client reads from the node does not mean your own indexing service has processed that block. Before truncating the chain below block n, poll that service's indexed block number until it reaches n. Otherwise it never sees the block, never records a rollback, and the test times out on slow CI runners.

#Testing and devnet #Indexer queries and cell collection · Sources (1) · 2026-10-08

EVM owners may hold Omnilock lock args with auth flag 0x12, not only 0x01WorkingFrom one fix

When mapping an Ethereum address to the CKB lock scripts it controls, match Omnilock args 0x12 || addr20 || 0x00 (Ethereum displaying, used by CCC's EVM signer for new addresses) as well as 0x01 || addr20 || 0x00 and PW Lock args = addr20. Otherwise deposits held by CCC created EVM addresses are not recognised. The commit notes this is still pending confirmation in a wallet proof of concept.

#Witnesses and signatures #Login and authorization · Sources (1) · 2026-10-08

Verifying Neuron style signed messages against a secp256k1_blake160 lockWorkingFrom one fix

To verify a Neuron "Sign Message" signature, hash with CKB Blake2b over UTF-8("Nervos Message:" followed by the text), recover the compressed public key from the 65 byte r||s||v signature (v is 0 or 1, not 27/28), and accept the owner only if the lock has the exact code_hash and hash_type of the secp256k1_blake160 template and its args equal blake160 of the recovered key (comparing args alone is not enough). Neuron signs low-s; if you choose to also accept high-s, normalise s to n minus s and flip v before recovery, because some verify helpers (CCC's) reject high-s.

#Witnesses and signatures #Data encoding (molecule, hex, bigints) · Sources (2) · 2026-10-08

Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. JSON · Want a lesson changed or removed? Open an issue.