CKB Pulse
Lessons

What CKB learned

Start here · Glossary · Test yourself · Feed

“Other”

55 lessons found. All lessons

Page 5 of 5

Light client set_scripts "all" replaces the whole registered script setWorkingFrom one fix

The CKB light client's set_scripts with the all command replaces every registered script, so a call carrying only one wallet's lock script unregisters all other wallets. When several scripts must stay tracked, either pass the full set with each script's own start block, or use the partial command to update only the changed script. If registrations can race, serialise them so a stale full set cannot overwrite a newer one.

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

Porting the sighash_all signing message into a Rust lock scriptWorkingFrom one fix

To reproduce secp256k1_blake160_sighash_all's message in a ckb-std lock, hash with ckb blake2b: tx hash, then the first GroupInput witness parsed as WitnessArgs with its lock field zero filled (same length) and u64 LE length prefixed, then the other GroupInput witnesses, then every Source::Input witness at index >= the total input count (each length prefixed). The commit counts inputs by probing load_input_since until IndexOutOfBound.

#Witnesses and signatures · Sources (1) · 2026-09-29

ckb-cli needs --skip-check to sign and send transactions with custom locksWorkingFrom one fix

ckb-cli refuses transactions whose inputs or outputs use a lock it cannot classify (for example a custom type script based lock with 1 byte of args). `tx sign-inputs` then signs nothing, reporting `invalid lock script ... args.length` and leaving the signatures map and witness empty, and `tx send` refuses the file. Pass `--skip-check` to both sign-inputs and send; otherwise send fails with -2 ERROR_ENCODING because the secp lock reads an empty witness. Since this disables ckb-cli's own checks, run your own verifier on the signed file between sign-inputs and send.

Joined with toastmanAu/daowow@6f4cb48641.

#Witnesses and signatures #Transaction building and fees · Sources (2) · 2026-09-26

Place a script's raw witness at the index of the input it validatesWorkingFrom one fix

When a type script reads its proof with load_witness(index, Source::Input) for its own input, the builder must put that raw witness at exactly that input's index. This commit puts the ledger cell at input 0 so its proof is witness 0, and pads the remaining witnesses with "0x" so witnesses.length equals inputs.length and a later funding/signing step appends rather than displaces it.

#Witnesses and signatures #Transaction building and fees · Sources (1) · 2026-09-25

Check that a derived successor type args match the spent cell's type argsWorkingFrom one fix

When a successor cell's type args are derived from other data (such as a config commitment) instead of copied from the spent input, compare them with the input cell's own type args before building. A mismatch (for example a config cell paired with a shard from another round) puts the input's type script group in the transaction with no output, so the type script runs as a burn and typically fails with an opaque error code. Read output.type.args during cell discovery and throw a clear client error on mismatch.

#Transaction building and fees #Cell deps and script lookup · Sources (1) · 2026-09-23

Filter prefix get_cells results by data length before decodingWorkingFrom one fix

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) · Sources (1) · 2026-09-18

Indexer RPC module must be listed in ckb.toml rpc modules for get_cells on devnetWorkingFrom one fix

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 · Sources (1) · 2026-09-18

Page 5 of 5

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.