getTransaction - Solana

This method returns a confirmed transaction by signature, including its instructions, account keys, logs, and balance changes. Versioned transactions require maxSupportedTransactionVersion: set it to 1 to read legacy, v0 and v1 transactions. With @solana/web3.js use version 1.99.0 or later, as earlier versions fail to parse a v1 response.

Parameters

ParameterTypeRequiredDescription
signaturestringYesBase58-encoded transaction signature
configobjectNoConfiguration object controlling encoding and version support

Config Object

FieldTypeRequiredDescription
encodingstringNoTransaction encoding: json, jsonParsed, base58, or base64
commitmentstringNoCommitment level: processed, confirmed, or finalized. Defaults to finalized
maxSupportedTransactionVersionnumberNoHighest transaction version the client can decode. Set to 1: a request capped at 0 fails with -32015 on a v1 transaction

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getTransaction",
    "params": ["5wHu1qwD4kLwYqPmy1uDCgpiJ1qGpVYU3n5aHT6bSWUE1JzcbQCPSDLDPGrFyqmLLzQjLNPTPtRZbNbUJQNMkaWq", {"encoding": "jsonParsed", "maxSupportedTransactionVersion": 1}],
    "id": "getblock.io"
}'

example.js

javascriptconst { Connection } = require('@solana/web3.js');

const connection = new Connection('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', 'confirmed');

const transaction = await connection.getParsedTransaction(
  '5wHu1qwD4kLwYqPmy1uDCgpiJ1qGpVYU3n5aHT6bSWUE1JzcbQCPSDLDPGrFyqmLLzQjLNPTPtRZbNbUJQNMkaWq',
  { maxSupportedTransactionVersion: 1 }
);

console.log(transaction?.meta?.fee);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'getTransaction',
        'params': ["5wHu1qwD4kLwYqPmy1uDCgpiJ1qGpVYU3n5aHT6bSWUE1JzcbQCPSDLDPGrFyqmLLzQjLNPTPtRZbNbUJQNMkaWq", {"encoding": "jsonParsed", "maxSupportedTransactionVersion": 1}],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "getTransaction",
            "params": ["5wHu1qwD4kLwYqPmy1uDCgpiJ1qGpVYU3n5aHT6bSWUE1JzcbQCPSDLDPGrFyqmLLzQjLNPTPtRZbNbUJQNMkaWq", {"encoding": "jsonParsed", "maxSupportedTransactionVersion": 1}],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "blockTime": 1774267845,
        "slot": 397234561,
        "meta": {
            "computeUnitsConsumed": 84213,
            "err": null,
            "fee": 5000,
            "innerInstructions": [],
            "logMessages": [
                "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 invoke [1]"
            ],
            "postBalances": [
                12043900,
                2039280
            ],
            "preBalances": [
                12048900,
                2039280
            ],
            "status": {
                "Ok": null
            }
        },
        "transaction": {
            "message": {
                "accountKeys": [],
                "recentBlockhash": "9zJqLXK9pMhQZ4tGqVvUcxrKpKQ3pMSJ1nZmVeXtBqTd"
            },
            "signatures": [
                "5wHu1qwD4kLwYqPmy1uDCgpiJ1qGpVYU3n5aHT6bSWUE1JzcbQCPSDLDPGrFyqmLLzQjLNPTPtRZbNbUJQNMkaWq"
            ]
        },
        "version": 0
    }
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultobjectnull

Result Object

FieldTypeDescription
slotnumberSlot containing the transaction
blockTimenumbernull
transactionobjectTransaction message and signatures in the requested encoding
metaobjectExecution metadata including fee, balances, logs, and compute units
versionnumberstring

Use Cases

  • Receipt Rendering: Display instruction-level detail for a completed transfer
  • Log Inspection: Read logMessages to debug a failing program invocation
  • Balance Deltas: Compare preBalances and postBalances to compute net movement
  • Compute Budgeting: Read computeUnitsConsumed to right-size a compute unit limit
  • Token Transfer Parsing: Use jsonParsed encoding to extract SPL Token transfer amounts

Error Handling

Error CodeMessageDescription
-32602Invalid paramsSignature is malformed or an unsupported encoding was requested
-32015Transaction version (1) is not supported by the requesting clientmaxSupportedTransactionVersion was omitted or is lower than the version of the transaction
-32011Transaction history is not available from this nodeThe node does not retain the ledger range containing the signature
-32603Internal errorNode failed to read the transaction from blockstore