Reading the Ledger
Every dApp eventually needs to know what happened on-chain. Whether it’s tracking a payment or confirming a smart contract call, reading transactions is key!
In VeChainThor, a transaction is a request to change the state of the blockchain. Think of it as sending a set of instructions to the network.
But here is the cool part: VeChain allows multi-clause structures.
Imagine sending one envelope that contains three different letters to three different people. That is a multi-clause transaction! It lets you perform multiple operations (like transferring VET to different people) in one go.
When you look at the data, you’ll see two main parts:
The Transaction Object: This shows the intent (what was sent).
The Transaction Receipt: This shows the result (what actually happened).
Nice! To see this in action, we use the ThorClient. In JavaScript, this means connecting to a node (like the Testnet) and asking for a specific ID.
Almost there! The receipt will tell you if the transaction was reverted (failed) or if it successfully emitted outputs like logs and events.
Technical Note: Transactions are state-change requests; Receipts are the results of those requests. VeChainThor’s multi-clause feature allows for efficient bundling of operations.
Don't forget to check thegetTransactionReceipt! A transaction might be "confirmed" in a block but still be reverted (failed) internally.
Join our Telegram