从这里开始 · 术语表 · 自测 · 订阅
经验用英文撰写,请用英文搜索。
#Transaction building and fees ✕
找到 52 条经验。 全部经验
上一页第 2 页,共 5 页下一页
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
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
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
ccc.Transaction.from reads only camelCase keys, so a snake_case JSON-RPC transaction (such as the ones ckb-cli writes, with cell_deps, outputs_data and similar) has to be converted with cccA.JsonRpcTransformers.transactionTo from @ckb-ccc/core/advanced. Passing that JSON directly to Transaction.from does not read those fields.
#Data encoding (molecule, hex, bigints) #Transaction building and fees · 来源(1) · 2026-11-08
A `ckb-cli deploy` info file is JSON with snake_case JSON-RPC transactions `cell_tx` and `dep_group_tx` (either may be null), `used_input_txs` (previous transactions by hash, so inputs resolve offline), signature maps `cell_tx_signatures` and `dep_group_tx_signatures` (lock args to a list of 65-byte signatures), and `deployment.multisig_config` with `sighash_addresses`, `require_first_n`, `threshold` and `lock_code_hash`. Each member address is a full-format sighash address whose args are the member's key hash; the list can be empty when the default config is used, so check for that before building the multisig script.
#Transaction building and fees #Witnesses and signatures · 来源(1) · 2026-11-08
When computing the signing message for a secp256k1_blake160_multisig_all input, set the first witness's WitnessArgs.lock to the multisig script bytes followed by threshold × 65 zero bytes (a single key sighash lock uses just 65 zero bytes), and keep the inputType and outputType fields, before calling CCC's tx.getSignHashInfo(script, client). The same placeholder length must be used here as in the signed witness, otherwise the message differs from what the lock script hashes on chain.
#Witnesses and signatures #Transaction building and fees · 来源(2) · 2026-11-08
In this deploy builder, several funding inputs all share the owner's lock. The signing witness (WitnessArgs) goes at index 0, and every other input gets an empty "0x" witness, so the witnesses list stays as long as the inputs list. That matches the secp256k1 sighash script group layout, where the first witness of the group carries the signature and covers the rest.
#Witnesses and signatures #Transaction building and fees · 来源(1) · 2026-11-05
When a lock script commits to output 0's exact bytes (capacity included), the capacity must be decided before proving and must equal what the transaction ships. In CCC, tx.completeFeeBy(signer) pays the fee by pulling in the signer's cells and adding a change output, so output 0 keeps its capacity and the fee is then paid from extra inputs, which breaks the binding if the proof assumed inputCapacity minus fee. Instead compute the fee from tx.toBytes().length with the witness already at its final length, build output 0 at inputCapacity minus that fee, and check before sending that the fee recomputed on the real transaction equals the planned one.
#Transaction building and fees #Witnesses and signatures #Capacity and cell size · 来源(1) · 2026-11-04
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
The CKB node RPC test_tx_pool_accept takes the same params as send_transaction (the snake_case tx JSON without its hash, plus an outputs validator such as "passthrough"). It returns the cycles and fee the pool would accept without broadcasting, so a tool can check a pasted transaction before sending it for real.
#Transaction building and fees #Network and RPC reliability · 来源(1) · 2026-10-30
When one account sends several transfers in a row (here via `offckb transfer`), a new transfer started before the previous one is committed can pick the same input cell, and the node rejects it with PoolRejectedRBF. This faucet queues claims and polls get_transaction until tx_status is committed, rejected or unknown before building the next transfer.
#Transaction building and fees #Network and RPC reliability · 来源(1) · 2026-10-30
With CCC and @ckb-ccc/joy-id, prepareTransaction fills the JoyID witness lock with a 1,000 byte placeholder before the fee is computed as ceil((serialized size + 4) x rate / 1000). The real signature is usually shorter (347 bytes in one testnet order), so the committed transaction is smaller and its measured rate is higher than the rate it was built at (7,278 against 5,000 shannons/KB). To recover the build rate, clone the transaction, set the JoyID witness lock back to 1,000 zero bytes, and compute the rate on that size, confirming with tx.estimateFee(rate) equal to the paid fee.
#Transaction building and fees #Witnesses and signatures · 来源(1) · 2026-10-30
上一页第 2 页,共 5 页下一页
文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。