getTransaction
Returns transaction details for a confirmed transaction

Parameters

  • <base-58 encoded string> - transaction signature
  • <object> - (optional) Config object:
    • encoding: <string> - (optional) encoding for tx data; Either "json", "jsonParsed", "base58" (slow), "base64". (default is "json")
    • commitment: <object> - (optional) Configures the commitment level of the blocks queried Accepts one of the following strings: ["finalized", "confirmed", "processed"] For more info, refer to this doc.
    • 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.

Results

Tx Success
Tx Failed
  • <object>
    • slot: <u64> - the slot this transaction was processed in
    • transaction: <object|[string,encoding]> - tx 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.
    • meta: <object | null> - transaction status metadata object:
      • err: <object | null> - reported error if transaction failed
      • fee: <u64> - fee this transaction was charged, as u64 integer
      • preBalances: <array of u64> - account balances from before the transaction was processed
      • postBalances: <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
      • rewards: <array of JSON objects> - present if rewards are requested:
        • pubkey: <base-58 encoded string> - The public key of the account that received the reward
        • lamports: <i64>- number of reward lamports credited or debited by the account
        • postBalance: <u64> - account balance in lamports after the reward was applied
        • rewardType: <string> - type of reward: "rent"
        • 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.
        • writable: <array[base-58 encoded string]> - Ordered list of addresses for writable loaded accounts
        • readonly: <array[base-58 encoded string]> - Ordered list of addresses for read only loaded accounts
    • version: <"legacy"|number|undefined> - Transaction version. Undefined if maxSupportedTransactionVersion is not set in request params.
  • <null> - if transaction is not found or not confirmed

Request

cURL
1
curl --location --request POST 'https://solana-mainnet.g.alchemy.com/v2/alch-demo/' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"method": "getTransaction",
5
"jsonrpc": "2.0",
6
"params": [
7
"FhGuWorGjyu1sAMvn53GWb96apbExf8HvX18MVwexMQxmo2sweuSfFpoApJbMT19ijDHRRUk6kDbvE1kgNfRkse",
8
{
9
"commitment": "confirmed"
10
}
11
],
12
"id": "a225dff3-7356-46c2-be70-d0bf77a60e12"
13
}'
Copied!

Response

1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"blockTime": 1655319302,
5
"meta": {
6
"err": null,
7
"fee": 5000,
8
"innerInstructions": [
9
{
10
"index": 1,
11
"instructions": [
12
{
13
"accounts": [
14
26,
15
13,
16
19,
17
15,
18
16,
19
0
20
],
21
"data": "63S77LdPnZrhcJ2wGjQ7xuV",
22
"programIdIndex": 21
23
},
24
{
25
"accounts": [
26
14,
27
16,
28
0
29
],
30
"data": "3QCBRJNuTemd",
31
"programIdIndex": 26
32
},
33
{
34
"accounts": [
35
2,
36
12,
37
19
38
],
39
"data": "3KiXXdFFB5Km",
40
"programIdIndex": 26
41
}
42
]
43
},
44
{
45
"index": 2,
46
"instructions": [
47
{
48
"accounts": [
49
10,
50
20,
51
0,
52
12,
53
18,
54
6,
55
1,
56
4,
57
26
58
],
59
"data": "dETZL4omNMDLJHiCgf9wKM",
60
"programIdIndex": 22
61
},
62
...................
63
64
3,
65
9,
66
5,
67
24,
68
14,
69
12,
70
0
71
],
72
"data": "3987sfmq8Uv3CmdUFAociw18iE9Ag7yfzTcb",
73
"programIdIndex": 25
74
},
75
{
76
"accounts": [
77
22,
78
10,
79
20,
80
12,
81
18,
82
6,
83
1,
84
4,
85
0,
86
26,
87
11
88
],
89
"data": "AmqpnQAj6p7kZBSvn95ZLamBu",
90
"programIdIndex": 25
91
}
92
],
93
"recentBlockhash": "8HUFHpe2knwEmMrvDnybybfwGULSQzNG2UpuReWWJyTd"
94
},
95
"signatures": [
96
"FhGuWorGjyu1sAMvn53GWb96apbExf8HvX18MVwexMQxmo2sweuSfFpoApJbMT19ijDHRRUk6kDbvE1kgNfRkse"
97
]
98
}
99
},
100
"id": "a225dff3-7356-46c2-be70-d0bf77a60e12"
101
}
Copied!