Skip to main content

getBlock

Efficiently access the contents of a block using either its block number or block hash as query parameters.

How to use getBlock method ?

Below, you'll find an in-depth guide that provides a comprehensive explanation of how to utilize the getBlock method effectively using Blast Builder API.

Parameters

Field

Type

Description

blockNumberOrHash *

string

This parameter is essential and must be provided. Depending on the value you specify, whether it's the block height or block hash, it will initiate the retrieval of the block contents.

Result

Field

Type

Description
blockHashstringThis represents the hash of the specified block
blockNumbernumberThis represents the height of the specified block
blockTimestampstringThe timestamp of the block
parentBlockHashstringThe hash that identifies the previous block in the chain
sequencerAddressstringThe sequencer address that constructed the block
stateRootstringThe state commitment after this block
statusstringThe status of the block
totalActualFeestringThe gas fee the transaction paid
transactionCountstringThe number of transactions in the specified block
eventCountnumberThe number of events
messageCountstringThe number of messages

Example Request and Result for getBlock

In this section, we provide an illustrative example of a request made to retrieve block contents using the getBlock Builder API method. Additionally, we present the resulting response containing information about the specified block. This example demonstrates how to interact with the API to obtain details about a specific block, including its hash, block number, timestamp, and various other attributes. Developers can use this as a reference for crafting their own requests and parsing the returned data when working with the getBlock Builder API method.

info

The example in this section uses a non-existing project id.

Make sure you replace it with your Starknet endpoint when issuing the Builder API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Curl Request example

curl -X GET https://starknet-mainnet.blastapi.io/<project-id>/builder/getBlock?blockNumberOrHash=501652 -H 'Content-Type: application/json'