The Anatomy of a Transaction
Ready to write some history? Every change on the blockchain requires a transaction.
Think of a transaction as an envelope. Inside this envelope, you wrap your instructions in the form of clauses. VeChain's unique model allows you to bundle multiple operations (clauses) into a single transaction—this is like sending three different letters in one envelope!.
This means first encoding your function call using a helper like buildTransactionBody:
CLAUSES AND GAS?
buildTransactionBody(clauses, gasResult.totalGas)
Wait a sec! We don't have any of the input! 😱
Clause
A clause represent the action you want to do, it has this structure
For VET transfers, the only kind of clauses not involving contract interactions, you will have something like this
Gas
You need energy (or gas). On VeChain, the gas token is VTHO. But we need to ask the network: "How much will this cost?".
Pitfalls: No gas est? Tx fails silently. Always estimate.
You’re getting it! Now we have the "Transaction Body" with those clauses and the gas limit.
Almost there! A transaction must be signed to prove you are the owner. This requires your Private Key or a signer instance. Greedy? Continue reading!
Join our Telegram