For the complete documentation index, see llms.txt. This page is also available as Markdown.

blockchain - Cosmos

Example code for the blockchain JSON-RPC method. Complete guide on how to use blockchain JSON-RPC in GetBlock Web3 documentation.

Returns block metadata for a range of blocks, between minHeight and maxHeight inclusive. The response is capped at 20 blocks per call — paginate by adjusting maxHeight to get older ranges.

Parameters

Parameter
Type
Required
Description

minHeight

integer

Yes

Minimum block height (decimal)

maxHeight

integer

Yes

Maximum block height (decimal)

Request Example

# JSON-RPC over HTTP POST (canonical)
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/blockchain' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "blockchain",
    "params": {
        "minHeight": 23456785,
        "maxHeight": 23456789
    },
    "id": "getblock.io"
}'

# URI over HTTP GET (alternate, for simple methods)
curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/blockchain?minHeight=23456785&maxHeight=23456789'

Response Example

Response Parameters

Field
Type
Description

result.last_height

string

Current chain tip height

result.block_metas

array

Array of block metadata entries, newest first

result.block_metas[].block_id.hash

string

Block hash

result.block_metas[].block_size

string

Block size in bytes (decimal string)

result.block_metas[].header.height

string

Block height

result.block_metas[].header.time

string

ISO 8601 block timestamp

result.block_metas[].num_txs

string

Transaction count in the block (decimal string)

Use Cases

  • Block-range scanning in indexers and analytics pipelines

  • Building block list views in explorers

  • Efficient bulk metadata retrieval before drilling into specific blocks

Error Handling

Status Code
Error Message
Cause

404

Not found

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?