getTransaction RPC Method

Returns transaction details for a confirmed transaction

Parameters #

string required

Transaction signature, as base-58 encoded string

object optional

Configuration object containing the following fields:

commitment string optional

  • processed is not supported.

maxSupportedTransactionVersion number optional

Set the max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and any versioned transaction will prompt the error.

encoding string optional

Default: json

Encoding for the returned Transaction

Values: jsonjsonParsedbase64base58

  • jsonParsed encoding attempts to use program-specific state parsers to return more human-readable and explicit data in the transaction.message.instructions list.
  • If jsonParsed is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (accounts, data, and programIdIndex fields).

Result #

  • <null> - if transaction is not found or not confirmed
  • <object> - if transaction is confirmed, an object with the following fields:
    • slot: <u64> - the slot this transaction was processed in
    • transaction: <object|[string,encoding]> - Transaction object, either in JSON format or encoded binary data, depending on encoding parameter
    • blockTime: <i64|null> - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available
    • meta: <object|null> - transaction status metadata object:
      • err: <object|null> - Error if transaction failed, null if transaction succeeded. TransactionError definitions
      • fee: <u64> - fee this transaction was charged, as u64 integer
      • preBalances: <array> - array of u64 account balances from before the transaction was processed
      • postBalances: <array> - array of u64 account balances after the transaction was processed
      • innerInstructions: <array|null> - List of inner instructions or null if inner instruction recording was not enabled during this transaction
      • preTokenBalances: <array|undefined> - List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
      • postTokenBalances: <array|undefined> - List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
      • logMessages: <array|null> - array of string log messages or null if log message recording was not enabled during this transaction
      • DEPRECATED: status: <object> - Transaction status
        • "Ok": <null> - Transaction was successful
        • "Err": <ERR> - Transaction failed with TransactionError
      • rewards: <array|null> - transaction-level rewards, populated if rewards are requested; an array of JSON objects containing:
        • pubkey: <string> - The public key, as base-58 encoded string, of the account that received the reward
        • lamports: <i64>- number of reward lamports credited or debited by the account, as a i64
        • postBalance: <u64> - account balance in lamports after the reward was applied
        • rewardType: <string> - type of reward: currently only "rent", other types may be added in the future
        • commission: <u8|undefined> - vote account commission when the reward was credited, only present for voting and staking rewards
      • loadedAddresses: <object|undefined> - Transaction addresses loaded from address lookup tables. Undefined if maxSupportedTransactionVersion is not set in request params, or if jsonParsed encoding is set in request params.
        • writable: <array[string]> - Ordered list of base-58 encoded addresses for writable loaded accounts
        • readonly: <array[string]> - Ordered list of base-58 encoded addresses for readonly loaded accounts
      • returnData: <object|undefined> - the most-recent return data generated by an instruction in the transaction, with the following fields:
        • programId: <string> - the program that generated the return data, as base-58 encoded Pubkey
        • data: <[string, encoding]> - the return data itself, as base-64 encoded binary data
      • computeUnitsConsumed: <u64|undefined> - number of compute units consumed by the transaction
    • version: <"legacy"|number|undefined> - Transaction version. Undefined if maxSupportedTransactionVersion is not set in request params.

Code sample #

curl https://api.devnet.solana.com -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTransaction",
    "params": [
      "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv",
      "json"
    ]
  }
'

Response #

{
  "jsonrpc": "2.0",
  "result": {
    "meta": {
      "err": null,
      "fee": 5000,
      "innerInstructions": [],
      "postBalances": [499998932500, 26858640, 1, 1, 1],
      "postTokenBalances": [],
      "preBalances": [499998937500, 26858640, 1, 1, 1],
      "preTokenBalances": [],
      "rewards": [],
      "status": {
        "Ok": null
      }
    },
    "slot": 430,
    "transaction": {
      "message": {
        "accountKeys": [
          "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe",
          "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc",
          "SysvarS1otHashes111111111111111111111111111",
          "SysvarC1ock11111111111111111111111111111111",
          "Vote111111111111111111111111111111111111111"
        ],
        "header": {
          "numReadonlySignedAccounts": 0,
          "numReadonlyUnsignedAccounts": 3,
          "numRequiredSignatures": 1
        },
        "instructions": [
          {
            "accounts": [1, 2, 3, 0],
            "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1",
            "programIdIndex": 4
          }
        ],
        "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B"
      },
      "signatures": [
        "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv"
      ]
    }
  },
  "blockTime": null,
  "id": 1
}