从这里开始 · 术语表 · 自测 · 订阅
经验用英文撰写,请用英文搜索。
toastmanAu/daowow ✕
来自 toastmanAu/daowow 的经验
github.com/toastmanAu/daowow
你维护这个项目吗? 确认第 1 到 30 条经验 · 确认第 31 到 51 条经验
找到 51 条经验。 全部经验
上一页第 2 页,共 5 页下一页
In phase one, output i must mirror deposit input i (same capacity, lock and DAO type), with its data set to the deposit block number as a u64 LE, and the deposit block hash must be in header_deps. Put any fee-paying input and output after all deposits. A custom lock that enforces a full 180-epoch term before phase one pushes payout to the next cycle boundary (about deposit + 360 epochs, roughly 60 days).
#Since and time locks #Transaction building and fees #Cell deps and script lookup · 来源(1) · 2026-11-13
Set the phase-two input since to an absolute epoch counted from the DEPOSIT header, not the withdrawing block. Round the elapsed epochs up to whole 180-epoch cycles, compare epoch fractions by cross-multiplication, and keep the deposit's epoch index and length. The withdrawable amount is occupied + (capacity − occupied) × AR_withdraw / AR_deposit, where AR is a little-endian u64 read from bytes 8..16 of each header's dao field. WitnessArgs.input_type must hold the deposit header's index in header_deps as an 8-byte little-endian u64.
#Since and time locks #Witnesses and signatures #Capacity and cell size · 来源(1) · 2026-11-13
A CKB script that refuses a transaction returns only an error code that names no rule, so port the contract's witness decoders to JS with the same refusals (bad version, truncation, trailing bytes, count or size limits). Check that they round-trip bytes produced by the Rust code. Before signing, run a checker that re-derives the contract's rules from the finished transaction, and pin each rule with a mutation test that breaks one field of a valid transaction and expects that rule's named reason.
#Testing and devnet #Data encoding (molecule, hex, bigints) #Since and time locks · 来源(1) · 2026-11-13
To support every CCC wallet without the @ckb-ccc/connector UI, call `new ccc.SignersController().refresh(client, callback, {name, icon})`. Keep the callback registered and update the picker, because it fires again as EIP-6963 wallets announce themselves. Treat signers that are `instanceof ccc.SignerDummy` as download links, not connectable wallets.
Medium confidence.
#Witnesses and signatures #Login and authorization · 来源(1) · 2026-11-12
After get_header_by_number or get_epoch_by_number, treat a null result as unavailable and check that the returned number equals the one you asked for. To get an epoch's start time, read the header at the EpochView's start_number. Then check that this header's epoch field has the epoch number in its low 24 bits and 0 in bits 24 to 39 (the block's index within the epoch), so the block really is the first block of that epoch.
#Network and RPC reliability #Since and time locks #Data encoding (molecule, hex, bigints) · 来源(2) · 2026-11-12
A pre-sign checker that reuses the builder's assumptions will miss the builder's bugs, so make it compare every field the script compares, outputs_data included. When you add data to an output, count those bytes in its occupied capacity (8 + data + lock + type). Replay refused transactions in ckb-debugger against the deployed binaries to confirm the fix.
#Capacity and cell size #Transaction building and fees #Testing and devnet · 来源(1) · 2026-11-11
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 · 来源(1) · 2026-11-10
A CKB header epoch field packs the epoch number in the low 24 bits, the index in the next 16 bits (shift 24) and the epoch length in the next 16 bits (shift 40). When estimating time to a target epoch from the tip, subtract the fraction already spent (index * epoch duration / length) and guard against length 0 to avoid division by zero.
#Since and time locks #Data encoding (molecule, hex, bigints) · 来源(3) · 2026-11-10
The dao_type_hash field returned by the get_consensus RPC is the native Nervos DAO code hash (used with hash_type type, args 0x). A contract that checks deposits with load_cell_type_hash needs the hash of the whole script, ccc Script{codeHash: dao_type_hash, hashType: "type", args: "0x"}.hash() (0xcc77c4de... on testnet); committing the raw dao_type_hash makes every deposit fail the check.
#Cell deps and script lookup #Data encoding (molecule, hex, bigints) · 来源(2) · 2026-11-10
The DAO accumulated rate AR is the second little-endian u64 (bytes 8..16) of a header's `dao` field, for example from `get_header_by_number`. Interest accrues only on free = capacity minus occupied capacity, so compensation = free * AR_end / AR_deposit minus free, and the maximum withdraw is occupied + free * AR_end / AR_deposit. AR_deposit is the AR of the deposit block; AR_end is the AR of the block holding the withdrawing cell (phase 1) once withdrawal was requested, and only for a not yet withdrawn deposit is the tip AR used, as an estimate that is still growing.
#Capacity and cell size #Data encoding (molecule, hex, bigints) · 来源(2) · 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 · 来源(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 · 来源(2) · 2026-11-10
上一页第 2 页,共 5 页下一页
文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。