GetBlockByID Access API Method
Parameters
Id
bytes
REQUIRED
Loading...
Returns
block
object
Loading...
id
string
Loading...
parent_id
string
Loading...
height
integer
Loading...
timestamp
object
Loading...
seconds
integer
Loading...
nanos
integer
Loading...
collection_guarantees
array
Loading...
collection_id
string
Loading...
signatures
array
Loading...
reference_block_id
string
Loading...
signer_indices
string
Loading...
signatures
string
Loading...
Request
1package main23import (4"context"5"fmt"6"log"78"github.com/onflow/flow/protobuf/go/flow/access"9)1011func main() {1213// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.14client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")15ctx := context.Background()16if err != nil {17log.Fatalf("err: %v", err)18}19// Get Latest (sealed) blockHeader20headerResp, err := client.GetLatestBlockHeader(ctx, &access.GetLatestBlockHeaderRequest{IsSealed: true})21if err != nil {22log.Fatal("get latest block header failed: ", err)23}2425// get block by ID26blockResp, err := client.GetBlockByID(ctx, &access.GetBlockByIDRequest{Id: headerResp.Block.Id})27if err != nil {28log.Fatal("get block by ID failed: ", err)29}30fmt.Printf("Get Block Header by ID: %x \n", blockResp.Block.Id)3132}
1package main23import (4"context"5"fmt"6"log"78"github.com/onflow/flow/protobuf/go/flow/access"9)1011func main() {1213// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.14client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")15ctx := context.Background()16if err != nil {17log.Fatalf("err: %v", err)18}19// Get Latest (sealed) blockHeader20headerResp, err := client.GetLatestBlockHeader(ctx, &access.GetLatestBlockHeaderRequest{IsSealed: true})21if err != nil {22log.Fatal("get latest block header failed: ", err)23}2425// get block by ID26blockResp, err := client.GetBlockByID(ctx, &access.GetBlockByIDRequest{Id: headerResp.Block.Id})27if err != nil {28log.Fatal("get block by ID failed: ", err)29}30fmt.Printf("Get Block Header by ID: %x \n", blockResp.Block.Id)3132}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free