/v1/blocks/by_version/{version} - Aptos
Example code for the /v1/blocks/by_version/{version} JSON-RPC method. Сomplete guide on how to use /v1/blocks/by_version/{version} json-rpc in GetBlock.io Web3 documentation.
This endpoint gets a transaction by its ledger version number from Aptos blockchain.
Supported Network
Mainnet
Parameter
Parameter
Data type
Description
Required
In
version
integer
The ledger version
Yes
Path
with_transactions
boolean
To contain transactions' details or not
no
Query
Request
Base URL
https://go.getblock.io/<ACCESS_TOKEN>Example(cURL)
curl --location 'https://go.getblock.io/<ACCESS_TOKEN>/v1/transactions/by_version/3556737308?with_transactions=false'Response Example
{
"block_height": "456015808",
"block_hash": "0xdbe2cbd48ec3b897fa5f6b1ff51bd8eef280e300e12b6ff153b3959a7440a268",
"block_timestamp": "1760341227055115",
"first_version": "3556737303",
"last_version": "3556737309",
"transactions": null
}
Response Parameter Definition
block_height
string
Height of the block in the blockchain.
block_hash
string
Unique hash identifying the block.
block_timestamp
string
Timestamp (in microseconds) when the block was created.
first_version
string
First transaction version included in this block.
last_version
string
Last transaction version included in this block.
transactions
objects
List of transactions contained in this block.
transactions.type
string
Type of the transaction (e.g., user_transaction, block_metadata_transaction).
transactions.hash
string
Unique hash identifying the transaction.
transactions.sender
string
Account address that initiated the transaction.
transactions.sequence_number
string
The sender’s sequence number for this transaction.
transactions.max_gas_amount
string
Maximum gas units the sender is willing to spend.
transactions.gas_unit_price
string
Gas price per unit.
transactions.expiration_timestamp_secs
string
Expiration timestamp (in seconds) after which the transaction becomes invalid.
transactions.payload
object
Payload object describing the action being executed.
transactions.payload.type
string
Type of payload (e.g., entry_function_payload).
transactions.payload.function
string
Function name being called (e.g., 0x1::coin::transfer).
transactions.payload.type_arguments
array
Type arguments for the function (e.g., token types).
transactions.payload.arguments
array
Arguments passed to the function (e.g., recipient address, amount).
transactions.signature
object
Signature object verifying the transaction.
transactions.signature.type
string
Type of cryptographic signature (e.g., ed25519_signature).
transactions.signature.public_key
string
Public key of the sender.
transactions.signature.signature
string
Cryptographic signature validating the transaction.
Use cases
This method is used for:
Retrieve details of a specific transaction by its version.
Debug failed transactions by checking vm_status.
Build explorers that let users search transactions by version.
Track system-level transactions like block epilogues.
Code Example
Node(Axios)
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://go.getblock.io/<ACCESS_TOKEN>/v1/transactions/by_version/3363904007',
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});Python(Request)
import requests
url = 'https://go.getblock.io/<ACCESS_TOKEN>/v1/transactions/by_version/3363904007'
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)Error handling
Status Code
Error Message
Cause
403
forbidden
Missing or invalid <ACCESS_TOKEN>.
410
Ledger version has been pruned
Incorrect version number or being pruned
500
Internal server error
Node or network issue; retry later.
Integration with Web3
By integrating /v1/transactions/by_version/{version}, developers can:
Trace exact transactions for auditing or compliance.
Debug dApps by fetching execution results and state changes.
Enable explorers to link transactions with block details. Monitor validators/system txns like block prologues and epilogues.
Last updated