How to Send Transactions on VeChain
Every meaningful change on a blockchain, whether it’s sending VET, minting NFTs, or updating a smart contract’s state, happens through a transaction. On VeChain, this process is efficient, EVM-compatible, and now easier than ever thanks to the VeChain SDK.
In this article, we’ll walk through the step-by-step flow for building, signing, and submitting a transaction on VeChainThor.
Step 1: Encode Your Function Call
To write data, you’ll need to prepare one or more clauses, each representing an action on the blockchain. Use clauseBuilder to encode a function call:
You can also include a VET value transfer inside the same clause.
Step 2: Estimate Gas (VTHO)
Before broadcasting, estimate how much the transaction will cost in VTHO:
Step 3: Build the Transaction Object
Now, wrap the encoded clauses and gas into a transaction body:
You can also configure fee delegation, priority, or expiration here if needed. Stay tuned for more about fee delegation in an upcoming tutorial.
Step 4: Sign the Transaction
Signing involves 3 components:
The internal wallet
A VeChainProvider
A signer instance
Example:
Step 5: Submit & Track
Once signed, send it to the network:
And track the result with:
The txReceipt will confirm execution and include logs or errors if anything went wrong.
Join our Telegram