GetBlockByID Access API Method
Parameters
Id
bytes
REQUIRED
The unique identifier of the block
Returns
block
object
The block object with the following fields
id
string
The unique identifier of the block
parent_id
string
The ID of the parent block
height
integer
The height of the block
timestamp
object
An object containing the details of the timestamp associated with the block
seconds
integer
An integer representing the number of seconds since a specific reference point
nanos
integer
An integer representing the additional nanoseconds that complement the seconds value
collection_guarantees
array
An array of collection guarantees associated with the block
collection_id
string
The identifier of a collection guarantee
signatures
array
The list of signatures associated with the collection guarantee
reference_block_id
string
The ID of the reference block
signer_indices
string
The list of indices of signers
signatures
string
The list of signatures associated with the block
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 != null {17log.Fatalf("err: %v", err)18}19// Get Latest (sealed) blockHeader20headerResp, err := client.GetLatestBlockHeader(ctx, &access.GetLatestBlockHeaderRequest{IsSealed: true})21if err != null {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 != null {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