从这里开始 · 术语表 · 自测 · 订阅
经验用英文撰写,请用英文搜索。
toastmanAu/daowow ✕
来自 toastmanAu/daowow 的经验
github.com/toastmanAu/daowow
你维护这个项目吗? 确认第 1 到 30 条经验 · 确认第 31 到 51 条经验
找到 51 条经验。 全部经验
上一页第 4 页,共 5 页下一页
When a hand-built transaction spends a secp256k1_blake160_sighash_all cell, it needs a cell dep for that lock. That dep should be the genesis dep group (dep_type dep_group), not the bare code cell in genesis tx0, because the lock also loads the secp256k1_data table from a second cell. With only the code cell, ScriptNotFound goes away but the lock then fails inside execution.
#Cell deps and script lookup #Transaction building and fees · 来源(2) · 2026-09-25
When quoting the capacity for cells locked to a user's wallet, compute the occupied size from the connected lock script (8 capacity bytes + 32 code_hash + 1 hash_type + args length + type + data), not a hardcoded value. In this commit a JoyID lock with 22 byte args gives a 222 CKB claim cell and a secp256k1 lock with 20 byte args gives 220 CKB. The script's molecule serialization header does not count toward occupied capacity.
Distinct from the pre-sign checker lesson: this is about sizing by the connected lock's real args length.
#Capacity and cell size · 来源(1) · 2026-09-23
If you serialise a CKB Script molecule yourself to compute its blake2b hash, use a 16 byte header (total size plus three u32 offsets 16, 48, 49) and map hash_type as data=0, type=1, data1=2, data2=4 (not 3). This commit cross checks the result against ccc.Script.from(...).hash() for all four hash types, and a single wrong offset or data2 mapped to 3 makes that test fail.
#Data encoding (molecule, hex, bigints) #Testing and devnet · 来源(1) · 2026-09-23
When several clients race to spend the same shared cell, sign with signer.signTransaction and send with signer.client.sendTransaction as two steps instead of signer.sendTransaction. The dead-input rejection only appears at broadcast, so wrapping just the send in the retry catch lets you tell contention (re-read the live cell, rebuild, sign again) from a wallet refusal or a script verification failure, which must not be retried. Cap the attempts, because each retry costs another signature.
#Transaction building and fees #Network and RPC reliability · 来源(1) · 2026-09-23
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 · 来源(1) · 2026-09-23
`ckb-cli tx init --tx-file` creates a new empty transaction file and exits 0, so running it on a prepared transaction silently destroys that transaction. For a prebuilt transaction, write ckb-cli's tx-file wrapper ({transaction, multisig_configs, signatures}) yourself and go straight to `tx info` and `tx sign-inputs`.
#Transaction building and fees #Witnesses and signatures · 来源(1) · 2026-09-23
ckb-cli `tx sign-inputs --add-signatures` leaves witness 0's lock zero-filled and records the signature in the tx file's `signatures` map keyed by lock arg; `tx send` assembles the final witnesses from that map. A checker that inspects witness 0 for a signature before `tx send` will wrongly report the transaction as unsigned, so read `doc.signatures[lockArg]` instead.
#Witnesses and signatures #Transaction building and fees · 来源(1) · 2026-09-23
When JS code encodes or decodes CKB cell data or script args that an on chain Rust script parses, test it against vectors exported from the Rust crate's own encoder, not against the JS code's own expectations. Assert every decoded field and every encoded byte, because a length check cannot catch a shifted offset. Give each field a distinct non zero value so a one byte shift gives a visibly wrong result. Read u64 shannon fields as BigInt (DataView.getBigUint64) and reject data of the wrong length.
Joined with toastmanAu/daowow@e08898943c.
#Data encoding (molecule, hex, bigints) #Testing and devnet · 来源(2) · 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 页,共 5 页下一页
文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。