block_search - Stable

Searches blocks by an event-attribute query (over finalize-block events), with pagination and ordering.

Method

block_search

Parameters

ParameterTypeDescription
querystringEvent query
pagestringPage number
per_pagestringResults per page
order_bystring"asc" or "desc"

Example

bashexport STABLE_TM=https://shared.ap-southeast-1.getblock.io/<ACCESS-TOKEN>/

# JSON-RPC over HTTP (POST)
curl -X POST "${STABLE_TM}" -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": "getblock.io", "method": "block_search", "params": {"query": "block.height>31000000", "page": "1", "per_page": "30", "order_by": "desc"}}'

# URI over HTTP (GET)
curl "${STABLE_TM}block_search?query=block.height>31000000&page=1&per_page=30&order_by=desc"

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "blocks": [
            {
                "block_id": {
                    "hash": "A1B2..."
                },
                "block": {
                    "header": {
                        "height": "31378844"
                    }
                }
            }
        ],
        "total_count": "1"
    }
}

Response Fields

FieldTypeDescription
blocksarrayMatching blocks
total_countstringTotal number of matches

Use Cases

  • Event blocks: Find blocks emitting a given event

Error Handling

ErrorMessageDescription
-32600 / Invalid requestInvalid requestThe JSON-RPC envelope was malformed
-32602 / Invalid paramsInvalid paramsA parameter was missing or of the wrong type
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect