Developer Fundamentals
-- II. Read Transactions
Understand the structure and data returned from VeChainThor transactions, including inputs, receipts, and execution results.
Working with Transactions on VeChainThor
Now, we turn to a key element of VeChainThor: transactions. Understanding how to work with them is essential for accessing real onchain data and building meaningful integrations.
In this lesson, you'll learn how to access and interpret transaction details on the VeChainThor blockchain. We’ll explore the structure of a transaction, identify the most important fields, and prepare to use this data effectively in your applications.
What is a transaction?
A transaction is a request for a change on the blockchain, which can either be a transfer of VET or the execution of a contract's function.
Each transaction may contain multiple instructions (multi-clause) to interact with various recipients on the blockchain.
The most relevant information about a transaction includes:
id – The unique identifier of the transaction.
chainTag – Identifies the chain to which the transaction belongs.
blockRef – The block on which the call was based.
expiration – The maximum number of blocks within which the transaction must be included in the blockchain (based on blockRef), or it will fail.
dependsOn – This transaction ID is required to be successful before being included in the blockchain.
origin – The sender of the transaction.
meta – Information about the block where this transaction was included, providing more details about time and block through blockID, blockNumber, and blockTimestamp.
reverted – Indicates whether the transaction failed.
clauses – The instructions to be executed, including a list of the recipients to be called, the data sent, and potential VET transfer values.
outputs – Events that have been emitted as a result of the executed instructions.
A transaction's complete details are comprised of two main components:
The basic version – includes all input data and details on how the transaction is stored.
The receipt – lists all changes emitted by the blockchain, including:
The reverted flag
The address of a newly deployed contract
VET transfers
Events initiated by contracts
Below is the full code snippet, including the required imports and connection to the VeChainThor mainnet.
You can copy & paste this into your project and run it.
Test It Yourself
The snippet below shows how you can make a request to the blockchain and receive transaction details and the transaction receipt:
Join our Telegram