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

block_search - Cosmos

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

Searches blocks matching a CometBFT event query against block-level events (BeginBlock / EndBlock events). Use this to find blocks where specific app-level events fired, e.g. validator slashings or governance proposals concluding.

Parameters

Parameter
Type
Required
Description

query

string

Yes

Event query string

page

integer

No

Page number (default: 1)

per_page

integer

No

Results per page (default: 30, max: 100)

order_by

string

No

Sort order: "asc" or "desc"

Request Example

# JSON-RPC over HTTP POST (canonical)
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/block_search' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "block_search",
    "params": {
        "query": "active_proposal.proposal_status='2'",
        "page": 1,
        "per_page": 30,
        "order_by": "desc"
    },
    "id": "getblock.io"
}'

# URI over HTTP GET (alternate, for simple methods)
curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/block_search?query="active_proposal.proposal_status='2'"&page=1&per_page=30&order_by="desc"'

Response Example

Response Parameters

Field
Type
Description

result.blocks

array

Matching blocks

result.blocks[].block_id.hash

string

Block hash

result.blocks[].block.header.height

string

Block height

result.total_count

string

Total matching blocks across all pages

Use Cases

  • Finding blocks where validators were slashed

  • Detecting blocks where governance proposals concluded

  • Tracking block-level events that aren't tied to a specific transaction

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?