transaction_entry - XRPL
This method retrieves information on a single transaction from a specific ledger version. The tx Method is recommended instead, as it searches all ledgers.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| tx_hash | string | Yes | Transaction hash |
| ledger_hash | string | No | Ledger hash |
| ledger_index | string/number | No | Ledger index |
Request Example
cURL
bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "transaction_entry",
"params": [{
"tx_hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
"ledger_index": 63632029
}],
"id": "getblock.io"
}'JavaScript (Axios)
javascriptconst axios = require('axios');
const url = 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/';
const headers = {
'Content-Type': 'application/json'
};
const payload = {
jsonrpc: '2.0',
method: 'transaction_entry',
params: [{
tx_hash: 'C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9',
ledger_index: 63632029
}],
id: 'getblock.io'
};
axios.post(url, payload, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));Python
pythonimport requests
url = "https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/"
headers = {
"Content-Type": "application/json"
}
payload = {
"jsonrpc": "2.0",
"method": "transaction_entry",
"params": [{
"tx_hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
"ledger_index": 63632029
}],
"id": "getblock.io"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())Rust
rustuse reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({
"jsonrpc": "2.0",
"method": "transaction_entry",
"params": [{
"tx_hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
"ledger_index": 63632029
}],
"id": "getblock.io"
});
let response = client
.post("https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/")
.header("Content-Type", "application/json")
.json(&payload)
.send()
.await?;
let result: serde_json::Value = response.json().await?;
println!("{:#?}", result);
Ok(())
}Response Example
json{
"result": {
"ledger_index": 63632029,
"metadata": {
"TransactionResult": "tesSUCCESS"
},
"status": "success",
"tx_json": {
"Account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
"TransactionType": "Payment"
}
}
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
| tx_json | object | Transaction data |
| metadata | object | Transaction result |
| ledger_index | integer | Ledger containing tx |
Use Cases
- Get transaction from specific ledger
- Historical analysis
- Ledger auditing
Error Handling
txnNotFound
Transaction not found
lgrNotFound
Ledger not found
SDK Integration
xrpl.js
javascriptconst xrpl = require('xrpl');
async function getTxEntry() {
const client = new xrpl.Client('wss://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>');
await client.connect();
const response = await client.request({
command: 'transaction_entry',
tx_hash: 'C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9',
ledger_index: 63632029
});
console.log(response.result);
await client.disconnect();
}
getTxEntry();xrpl-py
pythonfrom xrpl.clients import JsonRpcClient
from xrpl.models.requests import TransactionEntry
client = JsonRpcClient("https://xrp.getblock.io/mainnet/")
request = TransactionEntry(
tx_hash="C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
ledger_index=63632029
)
response = client.request(request)
print(response.result)