GetLatestBlockHeader Access API Method
Parameters
IsSealed
boolean
REQUIRED
It specifies whether the block should be sealed or unsealed. If set to true, the method retrieves the latest sealed block header; if set to false, it retrieves the latest unsealed block header
Returns
block
object
An object which contains the information about the block with the following fields
id
string
The unique identifier of the block
parent_id
string
he identifier of the parent block
height
integer
The height of the blocks
timestamp
object
The details of the timestamp, containing the following properties:
seconds
integer
The number of seconds in the timestamp
nanos
integer
The number of nanoseconds in the timestamp
payload_hash
string
The hash of the block's payload
view
integer
The view number associated with the block
parent_voter_ids
string
A list of voter IDs associated with the parent block
parent_voter_sig_data
string
The signature data associated with the parent voter IDs
proposer_id
string
The ID of the block's proposer
proposer_sig_data
string
The signature data associated with the block's proposer
chain_id
string
The ID of the blockchain
parent_voter_indices
string
The indices of the parent block's voters
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}24fmt.Printf("Latest Block Header ID: %x \n", headerResp.Block.Id)2526}
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free