CKB Pulse
经验

CKB 学到了什么

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

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

Ticoworld/QuotaCell

来自 Ticoworld/QuotaCell 的经验

github.com/Ticoworld/QuotaCell

你维护这个项目吗? 在一个 issue 中确认它的经验

找到 10 条经验。 全部经验

Sign a prepared transaction without broadcasting via CCC signOnlyTransaction实践来自一次修复

signer.signOnlyTransaction(tx) asks the CCC signer to sign a transaction you already completed (inputs, fee, cell deps, zero placeholder witness) without preparing or sending it. Treat the wallet as untrusted: pass it a copy, recheck the connected account after it returns, and verify the signed result against the sign hash you got from tx.getSignHashInfo(lock, client) on the prepared transaction (same tx hash, other witnesses untouched, signature recovers to the expected public key).

#Witnesses and signatures #Transaction building and fees · 来源(1) · 2026-11-09

Check original tx unknown and input live on independent nodes before same input cancellation实践来自一次修复

Before signing a same-input cancellation for a deployment whose broadcast outcome is unknown, check on two separate RPC endpoints that get_transaction for the original hash returns status 'unknown' and that get_live_cell for the shared input returns 'live', and fail closed if either endpoint errors or times out. Repeat the check before sending. 'unknown' only means the nodes have not seen the tx yet, so the cancellation is a race: if the original is relayed and committed first, the cancellation fails.

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

Verify a deployed code cell is canonical and live before recording it as a cell dep实践来自一次修复

Before writing a deployment manifest for a code cell, this commit checks get_transaction is committed, that get_block_hash at the header number equals the block hash (not reorganized), and that get_live_cell still reports status live with the expected data hash. It then repeats the canonical and live checks after all reads (on two independent RPCs), so a stale, spent or reorganized cell never yields a manifest.

#Cell deps and script lookup #Network and RPC reliability · 来源(1) · 2026-11-09

Verifying an indexer funding cell against an advancing tip instead of a frozen snapshot实践来自一次修复

A frozen-tip check ("the indexer tip must not change during the scan") fails often on a live chain, so do not demand it. Select a single funding cell from get_cells, verify it directly against the node (get_live_cell, get_transaction, get_header, output and data equal to the indexed ones), then re-check at the end that get_block_hash at the starting indexer tip still equals the anchor hash, that the cell's block is canonical, and that the cell is still live. New blocks arriving in between are fine, but still fail closed if the indexer lags the node at the start or the anchor hash changed. This gives one verified input, not a snapshot of the whole wallet.

#Indexer queries and cell collection #Network and RPC reliability · 来源(1) · 2026-11-09

Locate the signing witness slot instead of hardcoding its index实践来自一次修复

The signing witness of a lock group sits at the index of the first input that uses that lock, so it differs between transaction shapes (in QuotaCell, 1 for payments and most owner actions, 0 for a deposit). In CCC, take the position from tx.getSignHashInfo(lock, client).position and assert it matches the position you set, instead of hardcoding 1. A wallet or test mock that has no lock available can look for the placeholder witness, but a bare "first non-empty witness" search is only safe when no other input carries a witness.

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

Confirm a committed transaction is on the canonical chain via get_header and get_block_hash实践来自一次修复

Before recording a transaction as committed, you can cross-check get_transaction's tx_status.block_hash. Call get_header on that hash and require get_block_hash(header.number) to return the same hash. If the header is missing or the hashes differ, keep the transaction marked uncertain and reconcile it later rather than building new transactions on its outputs.

#Network and RPC reliability · 来源(1) · 2026-11-05

Indexer free cell discovery by block scan plus get_live_cell on a local chain实践来自一次修复

Without an indexer on a small local chain, cells for a lock can be found by walking get_block_by_number from 0 to the tip, matching output locks, and confirming each hit with get_live_cell (with_data true). The commit also checks get_block_hash per height and at the end, then rechecks each match, so the result is treated as a snapshot that a reorg or spend can invalidate.

#Indexer queries and cell collection #Testing and devnet · 来源(2) · 2026-11-05

Reconcile a lost send_transaction response by pinned hash, not by rebuilding实践来自一次修复

When a send_transaction response is lost (the node may already have accepted the transaction), this commit pins the signed transaction hash and its input outpoints, and recovers by querying get_transaction for that exact hash and get_live_cell for each input instead of building a new payment. Only a 'committed' status ends the intent; rejected, unknown or spent inputs stay 'uncertain' for operator review, because a fresh rebuild from refreshed cells was shown to let a second payment to the same recipient commit.

#Network and RPC reliability #Transaction building and fees #Indexer queries and cell collection · 来源(1) · 2026-11-02

get_live_cell may return "unknown" rather than "dead" for a spent output实践再次出现

On CKB node 0.210.0 devnet, get_live_cell for an output already consumed by a committed transaction returned status "unknown" instead of "dead", so a check requiring "dead" fails. Accept "dead" or "unknown" and prove consumption by calling get_transaction on the creating and consuming transactions, confirming both are committed and that the consumer's inputs reference the out point exactly once.

#Indexer queries and cell collection #Network and RPC reliability · 来源(3) · 2026-10-30

CCC custom client scripts must include AnyoneCanPay for SignerCkbPrivateKey实践已复现

On a devnet, if you construct a CCC client with a custom `scripts` map that overrides only `KnownScript.Secp256k1Blake160`, `SignerCkbPrivateKey` can still fail. This commit's comment says the signer also loads AnyoneCanPay metadata while classifying related locks, so it adds a `KnownScript.AnyoneCanPay` entry to the map even though no ACP input or cell dep is used.

#Cell deps and script lookup #Testing and devnet · 来源(1) · 2026-10-23

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