Skip to main content

GetExecutionResultForBlockID Access API Method

Retrieves execution result for given block. It is different from Transaction Results, and contain data about chunks/collection level execution results rather than particular transactions

Updated on
Oct 4, 2023

GetExecutionResultForBlockID Access API Method

Parameters

BlockId
string
REQUIRED
The ID of the block for which the execution result is retrieved

Returns

execution_result
object
An object representing the execution result, containing the following properties:
previous_result_id
string
The ID of the previous execution result
block_id
string
The ID of the block associated with the execution result
chunks
array
A list of chunks containing the execution result data. Each chunk has the following properties:
start_state
string
The starting state of the chunk
event_collection
string
The collection of events associated with the chunk
block_id
string
The ID of the block associated with the chunk
number_of_transactions
integer
The number of transactions in the chunk
end_state
string
The ending state of the chunk
execution_data_id
string
The ID of the execution data
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
blockid, err := hex.DecodeString("32e10a29b636e6c226183779ef4f8292975af0a6c3c6762c44c9da2c99a38953")
23
if err != null {
24
log.Fatalf("err: %v", err)
25
}
26
27
// get execution result for block ID
28
execResp, err := client.GetExecutionResultForBlockID(ctx, &access.GetExecutionResultForBlockIDRequest{BlockId: blockid})
29
if err != null {
30
log.Fatal("Get Execution Result for Block ID failed: ", err)
31
}
32
respJSON, err := json.Marshal(execResp)
33
if err != null {
34
log.Fatal("err: ", err)
35
}
36
fmt.Println("GetExecutionResultForBlockID response:", string(respJSON))
37
38
}
39
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free