getTransaction - Stellar

Example code for the getTransaction JSON-RPC method. Complete guide on how to use getTransaction JSON-RPC in GetBlock Web3 documentation.

This method returns details about a specific transaction by its hash on the Stellar network.

Parameters

Parameter
Type
Description

hash

string

Transaction hash to look up

Request examples

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getTransaction",
    "params": {
        "hash": "84b4d00835996d6dc7c56ac601aeb0560b0ee00fe4f9495417bd2e0efa474902"
    },
    "id": "getblock.io"
}'

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "status": "SUCCESS",
        "latestLedger": 2553978,
        "latestLedgerCloseTime": "1700159337",
        "oldestLedger": 2536698,
        "oldestLedgerCloseTime": "1700072957",
        "ledger": 2553920,
        "createdAt": "1700159048",
        "applicationOrder": 1,
        "feeBump": false,
        "envelopeXdr": "AAAAAgAAAAAg4dbAxs...",
        "resultXdr": "AAAAAAAAAGT...",
        "resultMetaXdr": "AAAAAwAAAA..."
    }
}

Response Parameters

Field
Type
Description

status

string

Transaction status (SUCCESS, FAILED, NOT_FOUND)

latestLedger

integer

Latest ledger sequence

ledger

integer

Ledger containing the transaction

createdAt

string

Unix timestamp of transaction

applicationOrder

integer

Order in which tx was applied in ledger

envelopeXdr

string

Transaction envelope (base64 XDR)

resultXdr

string

Transaction result (base64 XDR)

resultMetaXdr

string

Transaction metadata (base64 XDR)

Use Case

The getTransaction method is essential for:

  • Transaction confirmation checking

  • Payment verification

  • Transaction debugging

  • Receipt retrieval

  • Transaction history analysis

  • Error diagnosis

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN

-32602

Invalid params

Invalid transaction hash format

Last updated

Was this helpful?