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

abci_query - Cosmos

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

Runs an ABCI Query against the application — the underlying primitive that powers the Cosmos REST / LCD API and Cosmos SDK gRPC queries. Used to read module state directly. The path is the gRPC-style query path (e.g. /cosmos.bank.v1beta1.Query/Balance).

Parameters

Parameter
Type
Required
Description

path

string

Yes

Query path (e.g. /cosmos.bank.v1beta1.Query/Balance)

data

string

Yes

Hex-encoded query request bytes (typically a Protobuf message)

height

integer

No

Block height for the query (default: latest)

prove

boolean

No

Include Merkle proof of the result (default: false)

Request Example

# JSON-RPC over HTTP POST (canonical)
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "abci_query",
    "params": {
        "path": "/cosmos.bank.v1beta1.Query/Balance",
        "data": "0a2d636f736d6f73317436726c676638306a6438",
        "prove": false
    },
    "id": "getblock.io"
}'

# URI over HTTP GET (alternate, for simple methods)
curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/abci_query?path="/cosmos.bank.v1beta1.Query/Balance"&data="0a2d636f736d6f73317436726c676638306a6438"&prove=false'

Response Example

Response Parameters

Field
Type
Description

result.response.code

integer

0 on success, non-zero on failure

result.response.value

string

Base64-encoded Protobuf response from the queried module

result.response.height

string

Block height at which the query was executed

result.response.proof_ops

object | null

Merkle proof operations if prove=true

Use Cases

  • Power user / framework access to module state without the REST gateway

  • Light clients that need state with verifiable Merkle proofs

  • Tooling that bypasses the REST API for performance reasons

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

non-zero response.code

Query failed

Invalid path, malformed query data, or module error

SDK Integration

Last updated

Was this helpful?