⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

chain_getBlock - JSON-RPC Method

Description

Returns the full block for a given block hash.

Typical Flow

  1. Fetch latest finalized head with chain_getFinalizedHead
  2. Use that hash as the parameter to chain_getBlock

Code Examples

# 1) Get finalized head
HEAD=$(curl -s https://api-bittensor-mainnet.n.dwellir.com/YOUR_API_KEY -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"chain_getFinalizedHead","params":[],"id":1}' | jq -r '.result')

# 2) Get the block
curl https://api-bittensor-mainnet.n.dwellir.com/YOUR_API_KEY -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"chain_getBlock","params":["'"$HEAD"'"],"id":2}'