avm.getTx - AVAX
Example code for the avm.getTx JSON-RPC method. Complete guide on how to use avm.getTx JSON-RPC in GetBlock Web3 documentation.
Returns an X-Chain transaction by its ID. Useful for inspecting any past transfer or atomic transaction.
Parameters
txID
string
Yes
Transaction ID (CB58)
encoding
string
No
Response encoding — "hex" (default), "cb58", or "json"
Request Example
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/X' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "avm.getTx",
"params": {
"txID": "2oyUzwwCLpYn6MyKyNaJe2FcCgXqnmNENyiCNKocfsWcjvmard",
"encoding": "json"
},
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "avm.getTx",
"params": {
"txID": "2oyUzwwCLpYn6MyKyNaJe2FcCgXqnmNENyiCNKocfsWcjvmard",
"encoding": "json"
},
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/X',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data, null, 2)))
.catch(error => console.log(error));Response Example
Response Parameters
result.tx
object | string
Transaction body — object when encoding=json, hex/cb58 string otherwise
result.encoding
string
Encoding used
Use Cases
Inspecting historical X-Chain transactions
Building X-Chain explorers
Audit trails and forensics on native asset transfers
Error Handling
404
Not found
Missing or invalid <ACCESS-TOKEN>
-32602
Invalid params
Request parameters are missing or malformed
429
Too Many Requests
Rate limit exceeded for your plan
SDK Integration
Last updated
Was this helpful?