Skip to main content

starknet_blockHashAndNumber

Returns the block hash and number of the most recent accepted block.

Parameters

None.

Returns

An object containing:

  • block_hash: The latest block hash.
  • block_number: The latest block number.

Example

Replace <YOUR-API-KEY> with an API key from your MetaMask Developer dashboard.

Request

curl https://starknet-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"starknet_blockHashAndNumber","params":[],"id":0}'

Response

{
"jsonrpc": "2.0",
"result": {
"block_hash": "0x1ba5d3910676f8383a1c472f1092a77cbe438b108face7873e0407ceee8da1e",
"block_number": 4504
},
"id": 0
}