getTransaction
Returns the complete transaction details for a confirmed transaction given its signature. This is the primary method for retrieving transaction information, supporting both legacy and versioned transactions. It returns the full transaction message, metadata (including pre/post balances, log messages, and inner instructions), slot, and block time. This method is essential for block explorers, transaction debugging, and building detailed transaction history views.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | string | Yes | Transaction signature (base-58 encoded) |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: confirmed or finalized (default finalized) |
encoding | string | Transaction encoding: json, jsonParsed, base58, or base64 (default json) |
maxSupportedTransactionVersion | number | Max transaction version to return. Set to 0 to support versioned transactions |
Response
Returns null if the transaction is not found. Otherwise returns an object:
| Field | Type | Description |
|---|---|---|
slot | u64 | The slot the transaction was processed in |
transaction | object | Transaction object (format depends on encoding) |
blockTime | `i64 | null` |
meta | `object | null` |
meta.fee | u64 | Transaction fee in lamports |
meta.err | `object | null` |
meta.logMessages | `array[string] | null` |
version | `"legacy" | number` |
Code Examples
cURL
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{
"encoding": "jsonParsed",
"commitment": "confirmed",
"maxSupportedTransactionVersion": 0
}
]
}'TypeScript
const response = await fetch("http://88.216.36.108:7999", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getTransaction",
params: [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{
encoding: "jsonParsed",
commitment: "confirmed",
maxSupportedTransactionVersion: 0
}
]
}),
});
const { result } = await response.json();
console.log("Fee:", result.meta.fee, "lamports, Status:", result.meta.err ? "Failed" : "Success");Python
import requests
response = requests.post("http://88.216.36.108:7999", json={
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{
"encoding": "jsonParsed",
"commitment": "confirmed",
"maxSupportedTransactionVersion": 0
}
]
})
result = response.json()["result"]
print(f"Fee: {result['meta']['fee']} lamports, Status: {'Failed' if result['meta']['err'] else 'Success'}")Rust
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("http://88.216.36.108:7999")
.json(&json!({
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{
"encoding": "jsonParsed",
"commitment": "confirmed",
"maxSupportedTransactionVersion": 0
}
]
}))
.send().await?
.text().await?;
println!("{}", res);
Ok(())
}Example Response
{
"jsonrpc": "2.0",
"result": {
"slot": 166974442,
"transaction": {
"message": {
"accountKeys": [],
"instructions": [],
"recentBlockhash": "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ"
},
"signatures": ["5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW"]
},
"meta": {
"fee": 5000,
"err": null,
"logMessages": ["Program 11111111111111111111111111111111 invoke [1]", "Program 11111111111111111111111111111111 success"]
},
"blockTime": 1681391935,
"version": "legacy"
},
"id": 1
}