SolidPeer

Chaingraph reference

Chaingraph is a GraphQL-based BCH indexer. Where BCHN gives you direct RPC and Fulcrum gives you address-history scans, Chaingraph gives you arbitrary SQL-shaped joins over the chain — blocks, transactions, inputs, outputs, address scans, with filtering and ordering.

It runs on Postgres + Hasura under the hood; the gateway exposes the Hasura GraphQL endpoint with per-call billing.

Endpoint

HTTP

https://solidpeer.io/chaingraph/<network>/<token>

POST a GraphQL request body:

{ "query": "<graphql-query-string>", "variables": { ... }, "operationName": "..." }

WebSocket

wss://solidpeer.io/chaingraph/<network>/<token>

Subprotocol: graphql-transport-ws (current standard) OR graphql-ws (legacy, still supported via translation). Both flavors of subscribe / next / complete / error frames are accepted.

What Chaingraph is for

  • Block / transaction joins — query blocks with their transactions inline, transactions with their inputs and outputs, inputs with their referenced outputs.
  • Address scans — filter on output locking_bytecode_pattern to find every output at a given address (cashaddr or legacy).
  • Historical analysis — query any height range with pagination, ordering, and limits.
  • Real-time subscriptions — subscribe to a query; receive a push whenever the underlying rows change.

See /docs/api/chaingraph/query-block for an example query and /docs/api/chaingraph/subscription for the subscription pattern.

Cost model

  • Queries / Mutations: 300 CC base on mainnet, 150 CC on testnets/regtest.
  • Subscription registration: 300 CC on mainnet (150 CC testnets/regtest).
  • Per push: 150 CC on mainnet (75 CC testnets/regtest).

Complexity-based scoring is computed on every request (visible in audit log entries) but doesn't reject by default — your account balance is the binding cap.

Schema

Chaingraph's GraphQL schema mirrors the indexed Postgres tables. Top-level query roots include:

  • block — chain blocks with header fields and a back-reference to transactions.
  • transaction — transactions with inputs, outputs, block references.
  • input, output — flattened transaction io rows; useful for address-centric queries via filters.
  • block_transaction — join table for block-tx membership.
  • node, node_block, node_transaction — multi-node visibility (when the operator runs Chaingraph in multi-node mode).
  • search_output, search_output_prefix — optimized search over output locking_bytecode_pattern.

Each top-level field supports the usual Hasura argument shape: where, order_by, limit, offset, distinct_on.

To explore the schema interactively, GraphQL introspection (__schema, __type) is disabled by default to keep the discovery surface tight. Operators can enable introspection per-deploy via env. The schema mirrors Chaingraph's open-source GraphQL definition; clone the upstream Chaingraph repo for full schema docs.

Notes

  • Mutations: Chaingraph exposes one mutation — send_transaction — which forwards to BCHN's broadcast endpoint. Same posture as BCHN's sendrawtransaction.
  • Subscriptions run over WebSocket only; sending a subscription document over HTTP returns an error.
  • Cascade ordering: nested field ordering is supported (block(order_by:{height:desc}) { transactions(order_by:{position:asc}) { hash } }).
  • Large queries: there's no hard preflight rejection on complexity by default. A query that pages through millions of rows will simply charge millions of CC. Set per-token CC budgets if you want guardrails.