getTransaction
All the specifications for getTransaction RPC Method on Solana
Returns transaction details for a confirmed transaction
Parameters required for this RPC call
The pubkey of account delegate to query, as base-58 encoded string.
A JSON object with one of the following fields:
mint: Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or
programId: Pubkey of the Token program that owns the accounts, as base-58 encoded string
configuration : This contains the following parameters, all are optional fields.
commitment: The commitment describes how finalized a block is at that point in time. Commitment levels processed, confirmed and finalized are supported, defaults to finalized.
dataSlice: Request a slice of the account's data.
length: <usize>- number of bytes to returnoffset: <usize>- byte offset from which to start reading
maxSupportedTransactionVersion: Currently, the only valid value for this parameter is
0. Setting it to0allows you to fetch all transactions, including both Versioned and legacy transactions.encoding: Encoding format for each returned transaction. The supported options are json, jsonParsed, base58 and base64. You can know more about Parsed responses more on Solana docs.
curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": [
"5Pj5fCupXLUePYn18JkY8SrRaWFiUctuDTRwvUy2ML9yvkENLb1QMYbcBGcBXRrSVDjp7RjUwk9a3rLC6gpvtYpZ",
{
"commitment": "confirmed",
"maxSupportedTransactionVersion": 0,
"encoding": "json"
}
]
}
'import { Connection, PublicKey, clusterApiUrl, type GetVersionedTransactionConfig, } from "@solana/web3.js";
const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");
let signature =
"5zSQuTcWsPy2cVAshBXWuJJXLwMD1GbgMpz3iq4xgwiV1s6mxYRbYb7qBiRGZd1xvDcYhQQRBKoNcnW8eKtcyZWg";
let config: GetVersionedTransactionConfig = {
commitment: "finalized",
maxSupportedTransactionVersion: 0,
};
let transaction = await connection.getTransaction(signature, config);
console.log(transaction);{
"jsonrpc": "2.0",
"result": {
"blockTime": 1746479684,
"meta": {
"computeUnitsConsumed": 150,
"err": null,
"fee": 5000,
"innerInstructions": [],
"loadedAddresses": {
"readonly": [],
"writable": []
},
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"postBalances": [
989995000,
10000000,
1
],
"postTokenBalances": [],
"preBalances": [
1000000000,
0,
1
],
"preTokenBalances": [],
"rewards": [],
"status": {
"Ok": null
}
},
"slot": 378917547,
"transaction": {
"message": {
"accountKeys": [
"7BvfixZx7Rwywf6EJFgRW6acEQ2FLSFJr4n3kLLVeEes",
"6KtbxYovphtE3eHjPjr2sWwDfgaDwtAn2FcojDyzZWT6",
"11111111111111111111111111111111"
],
"header": {
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 1,
"numRequiredSignatures": 1
},
"instructions": [
{
"accounts": [
0,
1
],
"data": "3Bxs4NN8M2Yn4TLb",
"programIdIndex": 2,
"stackHeight": null
}
],
"recentBlockhash": "23dwTHxFhSzqohXhdni5LwpuSRpgN36YvVMCAM2VXQSf"
},
"signatures": [
"5Pj5fCupXLUePYn18JkY8SrRaWFiUctuDTRwvUy2ML9yvkENLb1QMYbcBGcBXRrSVDjp7RjUwk9a3rLC6gpvtYpZ"
]
},
"version": "legacy"
},
"id": 1
}Last updated
Was this helpful?