CKB Pulse

Todas as lições · CCC (TypeScript SDK) · Começa aqui · Glossário

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

De uma correção · Verificação: em parte certa · Verificada em 2026-11-19

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).

Porque importa: Without this, the wallet could switch accounts during signing or return an altered transaction, and the app would accept a signature it never checked.

Padrão

Preferir
const signed=await signer.signOnlyTransaction(c.Transaction.fromBytes(req.transaction));

Tirado do commit, encurtado.

Conceitos
Witnesses and signatures, Transaction building and fees
Evidência
De uma correção: de um projeto, verificada contra o commit
Vista pela primeira vez
2026-11-09
Última mudança
2026-11-09
Última verificação
2026-11-19
Verificação contra o commit
em parte certa: um núcleo verdadeiro, com uma parte solta ou demasiado larga

Fontes (1)

Mais sobre CCC (TypeScript SDK)

Ver as 33 deste tema

Manténs um projeto de onde esta lição veio? Confirma ou corrige

Citar esta lição
LusoCryptoLabs, "Sign a prepared transaction without broadcasting via CCC signOnlyTransaction", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/sign-a-prepared-transaction-without-broadcasting-via-ccc-sig, CC BY 4.0, last changed 2026-11-09.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.