Developer Fundamentals
5. Sign, Send, Track
Execute 4-step signing and broadcast with result tracking.
Prerequisites
Sign & Broadcast
Seal the deal! 📜 4 steps:
Wallet:
const wallet = new ProviderInternalBaseWallet(privateKey, senderAddress);
const wallet = new ProviderInternalBaseWallet(privateKey, senderAddress);
const wallet = new ProviderInternalBaseWallet(privateKey, senderAddress);
Provider/Signer:
const provider = new VeChainProvider(thor, wallet); const signer = await provider.getSigner(senderAddress);
const provider = new VeChainProvider(thor, wallet); const signer = await provider.getSigner(senderAddress);
const provider = new VeChainProvider(thor, wallet); const signer = await provider.getSigner(senderAddress);
Sign:
const rawSignedTx = await signer.signTransaction(txBody, privateKey);
const rawSignedTx = await signer.signTransaction(txBody, privateKey);
const rawSignedTx = await signer.signTransaction(txBody, privateKey);
Decode/Send:
const signedTx = Transaction.decode(HexUInt.of(rawSignedTx.bytes), true); const result = await thor.transactions.sendTransaction(signedTx); const receipt = await thor.transactions.waitForTransaction(result.id);
const signedTx = Transaction.decode(HexUInt.of(rawSignedTx.bytes), true); const result = await thor.transactions.sendTransaction(signedTx); const receipt = await thor.transactions.waitForTransaction(result.id);
const signedTx = Transaction.decode(HexUInt.of(rawSignedTx.bytes), true); const result = await thor.transactions.sendTransaction(signedTx); const receipt = await thor.transactions.waitForTransaction(result.id);
Boom—on-chain!
Common Pitfalls
Skip decode? SDK send fails; Check receipt.reverted! ignore reverted = bugs.
Join our Telegram