CKB Pulse
Lições

O que a CKB aprendeu

Começa aqui · Glossário · Testa-te · Feed

As lições estão escritas em inglês, por isso pesquise em inglês.

Ticoworld/QuotaCell

Lições de Ticoworld/QuotaCell

github.com/Ticoworld/QuotaCell

Manténs este projeto? Confirma as lições dele num só issue

10 lições encontradas. Todas as lições

Sign a prepared transaction without broadcasting via CCC signOnlyTransactionPráticoDe uma correção

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 · Fontes (1) · 2026-11-09

Check original tx unknown and input live on independent nodes before same input cancellationPráticoDe uma correção

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 · Fontes (1) · 2026-11-09

Verify a deployed code cell is canonical and live before recording it as a cell depPráticoDe uma correção

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 · Fontes (1) · 2026-11-09

Verifying an indexer funding cell against an advancing tip instead of a frozen snapshotPráticoDe uma correção

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 · Fontes (1) · 2026-11-09

Locate the signing witness slot instead of hardcoding its indexPráticoDe uma correção

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 · Fontes (1) · 2026-11-05

Confirm a committed transaction is on the canonical chain via get_header and get_block_hashPráticoDe uma correção

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 · Fontes (1) · 2026-11-05

Indexer free cell discovery by block scan plus get_live_cell on a local chainPráticoDe uma correção

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 · Fontes (2) · 2026-11-05

Reconcile a lost send_transaction response by pinned hash, not by rebuildingPráticoDe uma correção

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 · Fontes (1) · 2026-11-02

get_live_cell may return "unknown" rather than "dead" for a spent outputPráticoVista outra vez

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 · Fontes (3) · 2026-10-30

CCC custom client scripts must include AnyoneCanPay for SignerCkbPrivateKeyPráticoReproduzida

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 · Fontes (1) · 2026-10-23

Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. JSON · Queres que uma lição seja mudada ou retirada? Abre um issue.