CKB Pulse
经验

CKB 学到了什么

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

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

officialcmg/ckb-keyway

来自 officialcmg/ckb-keyway 的经验

github.com/officialcmg/ckb-keyway

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

找到 8 条经验。 全部经验

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

Classifying sendTransaction failures before dropping a pending CKB transaction实践来自一次修复

A failed or timed out ccc client.sendTransaction, or a getTransaction status of "rejected" or "unknown", does not prove the transaction can never commit: a node may have taken it, and "rejected" also covers pool removals such as expiry or a full pool. Store the signed bytes before sending. Drop the pending state only on final refusals (ErrorClientVerification, ErrorClientMaxFeeRateExceeded, TransactionFailedToVerify, PoolRejectedMalformedTransaction), or when an input is not live, the transaction that created that input is committed, and the node no longer holds your transaction as pending, proposed or committed. A not-live input alone is not proof, because CCC's getCellLive also returns not live for a cell the node has not seen. Otherwise resend the stored bytes, treating ErrorClientDuplicatedTransaction and PoolRejectedDuplicatedTransaction as success.

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

Sign each lock group with its own placeholder length and witness shape实践再次出现

When one key controls several lock groups in a CCC transaction, call transaction.prepareSighashAllWitness(script, len, client) for each group with the final witness lock length of that lock, then getSignHashInfo and sign that group's own digest. In KeyWay's case the length is 65 bytes for secp256k1 and 85 bytes for an Omnilock owner witness holding one 65-byte signature; write the bare signature for secp256k1 and wrap it in the OmniLockWitnessLock molecule for Omnilock. A custom lock with its own witness layout needs its own length the same way.

#Witnesses and signatures #Transaction building and fees · 来源(2) · 2026-10-23

Omnilock owner signing needs an 85 byte zeroed witness lock placeholder实践来自一次修复

For an Omnilock cell spent in owner (secp256k1) mode, the WitnessArgs.lock is an 85 byte OmniLockWitnessLock (a 20 byte molecule header 0x5500000010000000550000005500000041000000 plus the 65 byte signature), so the sighash digest must be computed with an 85 byte zeroed placeholder (e.g. CCC prepareSighashAllWitness(lock, 85, client)). A digest taken over the usual 65 byte secp256k1 placeholder does not verify, which the test confirms against a real testnet spend.

#Witnesses and signatures #Data encoding (molecule, hex, bigints) · 来源(2) · 2026-10-23

Convert Fiber RPC snake_case scripts to CCC camelCase ScriptLike实践已复现

Fiber RPC returns scripts as { code_hash, hash_type, args }, but CCC's ScriptLike expects { codeHash, hashType, args }. In this commit a Fiber shaped lock was passed to a CCC based sweep as if it were a ccc.ScriptLike and the sweep failed, so map the fields explicitly before handing the script to CCC.

#Data encoding (molecule, hex, bigints) #Channels and payments · 来源(1) · 2026-10-14

Building a remote CCC signer by extending SignerCkbPublicKey实践来自一次修复

To expose a remote secp256k1 key as a CCC signer, extend ccc.SignerCkbPublicKey(client, publicKey) and override signOnlyTransaction and signMessageRaw to call the backend. The address and lock come from the public key, and signMessageRaw must sign in the "Nervos Message:" format so signMessage and verifyMessage keep working. SignerCkbPublicKey also reports anyone-can-pay addresses of the key, whose cells a backend that only signs the secp256k1 lock cannot spend, so override getAddressObjs to return only the lock you can sign (ckb-keyway had to do this later).

#Witnesses and signatures · 来源(1) · 2026-10-12

Plain CKB transfer with a CCC signer基础来自一次修复

With CCC, a simple CKB transfer is built as ccc.Transaction.from({ outputs: [{ lock, capacity }] }), then transaction.completeInputsByCapacity(signer) and transaction.completeFeeBy(signer) are called before signer.sendTransaction(transaction). The recipient lock comes from ccc.Address.fromString(address, signer.client), and its .script is used as the output lock.

#Transaction building and fees #Witnesses and signatures · 来源(1) · 2026-10-12

Use JsonRpcTransformers.transactionFrom to serialize CCC transactions for CKB/Fiber RPC实践已复现

Serializing a ccc.Transaction with ccc.stringify keeps cached input fields (cellOutput, outputData) that a native RPC such as Fiber submitSignedFundingTx does not expect. JsonRpcTransformers.transactionFrom from @ckb-ccc/core/advanced emits snake_case hex with inputs containing only previous_output and since, while keeping the tx hash and witnesses unchanged, as the commit's tests check.

#Data encoding (molecule, hex, bigints) #Transaction building and fees · 来源(1) · 2026-09-28

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