Skip to main content

GetTransactionResult Access API Method

Gets the execution result of a transaction.

Updated on
Oct 4, 2023

GetTransactionResult Access API Method

Parameters

Id
bytes
REQUIRED
The id of the transaction

Returns

status
integer
The status of the transaction execution
events
array
An array of events emitted during the transaction execution, which contains the following fields
type
string
The type of the event
transaction_id
string
The identifier of the transaction associated with the event
payload
string
The payload of the event
block_id
string
The id of the block containing the transaction
transaction_id
string
The id of the transaction
collection_id
string
The id of the collection associated with the transaction
block_height
integer
The height of the block containing the transaction
Request
1
package main
2
3
import (
4
"context"
5
"encoding/hex"
6
"encoding/json"
7
"fmt"
8
"log"
9
10
"github.com/onflow/flow/protobuf/go/flow/access"
11
)
12
13
func main() {
14
15
// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.
16
client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")
17
ctx := context.Background()
18
if err != null {
19
log.Fatalf("err: %v", err)
20
}
21
22
// Get Transaction by ID
23
transactionId, err := hex.DecodeString("45c36ca2e7ac95eaeb1f66b12ff55d51ae976abc026a8e81ed081ad54e0e66c7")
24
if err != null {
25
log.Fatalf("err: %v", err)
26
}
27
resultResp, err := client.GetTransactionResult(ctx, &access.GetTransactionRequest{Id: transactionId})
28
respJSON, err := json.Marshal(resultResp)
29
if err != null {
30
log.Fatalf("err: %v", err)
31
}
32
fmt.Println("Get Transaction Result response:", string(respJSON))
33
}
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free