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.

Reproduzida

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

Parsing snake_case JSON-RPC transactions in CCCPráticoReproduzida

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

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

Convert Fiber RPC snake_case scripts to CCC camelCase ScriptLikePráticoReproduzida

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

Re-zero the witness lock before recomputing the sign message with getSignHashInfoPráticoReproduzida

CCC's Transaction.getSignHashInfo hashes whatever is currently in the witness, so after a signature is filled in it no longer gives the signed message. To verify a signature (for example with ccc.recoverMessageSecp256k1), clone the tx and reset witness 0's lock to the zero placeholder of the same length that was used at signing time.

#Witnesses and signatures #Testing and devnet · Fontes (1) · 2026-10-14

Pass a config object, not a URL string, to ccc.ClientPublicTestnetPráticoReproduzida

In @ckb-ccc/core, the ClientPublicTestnet constructor takes an options object, so a custom RPC endpoint must be given as { url: rpcUrl } rather than as a bare string argument. This commit corrects the bare string calls in a deploy script to the object form.

#Network and RPC reliability · Fontes (1) · 2026-10-13

Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactionsPráticoReproduzida

When a CCC transaction has inputs locked by several secp256k1 signers but the fee is paid by one, call tx.prepareSighashAllWitness(coSignerLock, 65, client) for each co-signer before tx.completeFeeBy(payer, feeRate). Otherwise the fee is estimated without their signature witnesses and may come out short. Each co-signer must own at least one input to have a script group to sign.

#Transaction building and fees #Witnesses and signatures · Fontes (1) · 2026-10-06

Deriving minimum cell capacity with ccc.CellOutput.from and output dataPráticoReproduzida

In CCC, calling ccc.CellOutput.from({lock, type}, outputData) without a capacity fills capacity with the cell's occupied size, so it serves as the minimum capacity check for change or receipt cells. This commit uses it to reject dust change before and after subtracting the fee (via transaction.estimateFee), and to top up a receipt cell whose received CKB is below its occupied capacity.

#Capacity and cell size #Transaction building and fees · Fontes (1) · 2026-10-01

Use JsonRpcTransformers.transactionFrom to serialize CCC transactions for CKB/Fiber RPCPráticoReproduzida

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

Hand-rolled Script hash: hash_type byte mapping and molecule offsets, checked against CCCPráticoReproduzida

If you serialise a CKB Script molecule yourself to compute its blake2b hash, use a 16 byte header (total size plus three u32 offsets 16, 48, 49) and map hash_type as data=0, type=1, data1=2, data2=4 (not 3). This commit cross checks the result against ccc.Script.from(...).hash() for all four hash types, and a single wrong offset or data2 mapped to 3 makes that test fail.

#Data encoding (molecule, hex, bigints) #Testing and devnet · Fontes (1) · 2026-09-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.