Query Ethereum node data using GraphQL with flexible field selection and batched queries.
Geth exposes an optional GraphQL endpoint that allows you to query blockchain
data with flexible field selection. A single GraphQL request can retrieve data
from multiple resources that would otherwise require several JSON-RPC calls.
GraphQL is served over the HTTP transport, so --http must be enabled alongside
--graphql:
geth --http --graphql
The GraphQL handler is registered on the same HTTP server as the JSON-RPC API
but at a different path:
Path
Description
/graphql
GraphQL endpoint (POST for queries)
/graphql/ui
GraphiQL interactive browser playground
With default settings the endpoints are:
http://localhost:8545/graphql
http://localhost:8545/graphql/ui
The --graphql flag does not accept an --graphql.api namespace list.
The GraphQL interface always exposes its own fixed schema regardless of
which --http.api namespaces are enabled.
GraphQL is read-only with the exception of sendRawTransaction. It does not
expose administrative, debug, mining, or subscription APIs. For those
operations, use the JSON-RPC API or the
JavaScript console.
Other limitations to be aware of:
Query nesting depth is capped at 20 levels to prevent resource exhaustion.
Subscriptions are not supported; use eth_subscribe over WebSocket for
real-time event streaming.
Account state queries are scoped to a specific block; there is no way to
query historical state outside the node’s retained state history.