CKB Pulse
经验

CKB 学到了什么

从这里开始 · 术语表 · 自测 · 订阅

经验用英文撰写,请用英文搜索。

实践

找到 174 条经验。 全部经验

第 1 页,共 15 页

send_transaction error -1111 (PoolRejectedRBF) is a conflict, not "already in pool"实践由所有者核对

CKB's send_transaction returns -1107 when the same tx is already in the pool, but -1111 (PoolRejectedRBF) when a different pool tx spends one of its inputs and this tx cannot replace it. Treating -1111 like -1107 makes a client resend a tx whose input is gone and only notice the failure much later. Fiber now reports it as a conflict (failing a funding tx at once) while closing txs keep the old handling.

#Network and RPC reliability #Transaction building and fees · 来源(2) · 2026-11-18

Comparing packed epoch values实践再次出现

Decode epochs into (number, index, length) before comparing them. Compare the fractional parts by cross-multiplying (index_a*length_b vs index_b*length_a), because epoch length varies and raw packed integers don't order correctly.

#Since and time locks · 来源(2) · 2026-11-18

Resolving cell deps per cell after redeploying a data-hashed script实践来自一次修复

After a data/data1 type script is redeployed with a new code hash, old cells still run against the old code. Keep a list of retired deployments and query the indexer for every one. Pick each cell's cell dep by matching the codeHash and hashType of that cell's own type script, not a single 'current' manifest entry.

#Cell deps and script lookup #Type ID and upgrades #Indexer queries and cell collection · 来源(1) · 2026-11-17

CCC client cache can keep dropped transactions; check status without cache实践来自一次修复

A ccc client records the transactions it sends in its cache, so a claim or sweep the chain dropped or rejected stays there with its outputs usable and its inputs spent, which breaks later sends. Check such transactions with client.getTransactionNoCache and treat an undefined result or status "rejected" as dropped. Rebuild that client's cache from the chain before building new sends, and give automated sends their own ccc client so this rebuild does not touch the account's other pending transactions.

Related to the cache clearing and getTransactionNoCache lessons, but adds a distinct remedy: treat undefined or rejected as dropped, and use a separate client for automated sends to isolate its cache.

#Network and RPC reliability #Transaction building and fees · 来源(1) · 2026-11-17

24-bit epoch number overflow实践来自一次修复

An absolute epoch since carries only a 24-bit epoch number (max 0xFFFFFF). When a script requires an input since at or after an epoch computed from cell data (for example entry_end plus a wait), compute it with checked addition. Refuse any result above 0xFFFFFF when the cell is created, otherwise the guarded transition can never be satisfied.

#Since and time locks · 来源(2) · 2026-11-17

ckb-vm-js 0.2.0 (npm) checks header hash instead of rejecting the field实践由所有者核对

With ckb-vm-js 0.2.0 from npm, verifyScriptGroup accepts an RPC header in context.tip_header that carries its own hash only when that hash matches the recomputed one, and fails with "header hash does not match" otherwise (the earlier vendored build rejected any `hash` field as unknown). Dropping `hash` before passing RPC headers or transactions remains safe because the verifier recomputes it.

No existing lesson covers how ckb-vm-js treats a hash field on RPC headers.

#Testing and devnet #Data encoding (molecule, hex, bigints) · 来源(1) · 2026-11-17

Pass wasm bytes to ckb-vm-js createVerifier in Node实践由所有者核对

In Node, calling ckb-vm-js createVerifier() with no arguments fails with "fetch failed" because it cannot fetch its .wasm from a file URL. Read the bytes from the package's ckb-vm-js/wasm export (via import.meta.resolve and readFile) and pass them as createVerifier({ wasm }).

New Node loading detail for ckb-vm-js wasm.

#Testing and devnet · 来源(1) · 2026-11-17

Saving local state after the first step of a multi-step flow实践来自一次修复

In flows like Create followed by Arm, save local state right after the first transaction is sent. If you wait until the whole flow finishes, a failure in a later step leaves an on-chain object the user cannot find or cancel. Add the extra fields, such as the descriptor, once the later steps succeed.

#Transaction building and fees #Other · 来源(1) · 2026-11-16

Script group hash is the hash of the whole Script, not the code_hash实践来自一次修复

A script group is identified by BLAKE2b-256 with the 'ckb-default-hash' personalization over the Molecule-encoded Script (code_hash, hash_type byte data=0/type=1/data1=2/data2=4, args). Lock groups come only from inputs. Type groups come from inputs and outputs, and lock and type groups with the same hash stay distinct. Passing the code_hash as the group hash yields ScriptNotFound.

#Data encoding (molecule, hex, bigints) #Witnesses and signatures · 来源(1) · 2026-11-16

Separate builds for test-only contract constants实践来自一次修复

Put test variants that change protocol constants behind a Cargo feature, built as a separate binary with its own code hash and deployment file. Client deployment parsing and deploy scripts should reject that variant on mainnet. Off-chain code should read the constant from the deployment rather than hardcode the default.

#Testing and devnet #Cell deps and script lookup #Type ID and upgrades · 来源(1) · 2026-11-16

Decoding InvalidDepGroup OutPoints实践来自一次修复

InvalidDepGroup prints the OutPoint in molecule encoding: a 32-byte tx_hash followed by a 4-byte little-endian index. Reverse the index bytes, then match only dep_group cell_deps on both tx_hash and index.

#Cell deps and script lookup #Data encoding (molecule, hex, bigints) · 来源(1) · 2026-11-16

Identify script groups by type and hash实践来自一次修复

In CKB the same script hash can be both a lock script group and a type script group in one transaction, and each group has its own input and output indices. When selecting or reporting a script group, for example from a verifier's group list, match on group type together with script hash, never on the hash alone.

#Witnesses and signatures #Other · 来源(1) · 2026-11-16

第 1 页,共 15 页

文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。