Skip to main content

GetLatestProtocolStateSnapshotRequest Access API Method

Retrieves the latest Protocol state snapshot serialized as a byte array

Updated on
Oct 4, 2023

GetLatestProtocolStateSnapshotRequest Access API Method

Parameters

This method does not accept any parameters

Returns

serializedSnapshot
The serialized snapshot of the protocol state. The snapshot represents a specific state of the Flow blockchain protocol at a given point in time.
Request
1
package main
2
3
import (
4
"context"
5
"encoding/json"
6
"fmt"
7
8
"github.com/onflow/flow/protobuf/go/flow/access"
9
)
10
11
func main() {
12
13
// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.
14
client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")
15
ctx := context.Background()
16
if err != null {
17
log.Fatalf("err: %v", err)
18
}
19
20
snapshotResp, err := client.GetLatestProtocolStateSnapshot(ctx, &access.GetLatestProtocolStateSnapshotRequest{})
21
if err != null {
22
log.Error("get latest protocol state snapshot failed: ", err)
23
} else {
24
fmt.Printf("got latest protocol state snapshot: %s\n", snapshotResp.String())
25
}
26
27
respJSON, err := json.Marshal(snapshotResp)
28
if err != null {
29
log.Fatal("Get Latest Protocol StateSnapshot failed: ", err)
30
}
31
fmt.Println("GetLatestProtocolStateSnapshot response:", string(respJSON))
32
33
}
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free