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

GraphQL - HashKey Chain

Example code for the HashKey Chain GraphQL API (EIP-1767). Complete guide on how to query blocks, transactions, accounts, and logs with GraphQL in GetBlock Web3 documentation.

HashKey Chain exposes an EIP-1767 GraphQL API: a single /graphql endpoint that lets you request exactly the block, transaction, account, and log fields you need — with nesting — in one query, plus a mutation to broadcast transactions. It complements the JSON-RPC and WebSocket interfaces, and is useful when a single round-trip should return a precisely-shaped slice of chain data.

Endpoint

GraphQL is served over HTTP POST at the endpoint base URL with graphql appended.

export HSK_GQL=https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/

# POST a GraphQL query to the /graphql path
curl -X POST "${HSK_GQL}graphql" \
  -H "Content-Type: application/json" \
  -d '{"query":"{ block { number hash timestamp gasUsed } }"}'

Replace <ACCESS-TOKEN> with the access token from the GetBlock dashboard. HashKey Chain is served from the New York region; GraphQL shares the same base URL as JSON-RPC, with graphql appended.

Operations

Operation
Type
Description

block

query

Fetch a block by number or hash

blocks

query

Fetch a range of blocks (from / to)

transaction

query

Fetch a transaction by hash

account

query

Read an account's balance, nonce, code, and storage at a block

call

query

Execute a read-only contract call

estimateGas

query

Estimate gas for a call

logs

query

Query event logs by filter (addresses, topics, block range)

gasPrice

query

Current gas price

sendRawTransaction

mutation

Broadcast a signed raw transaction

Example Queries

Block with its transactions

Account balance and nonce

Logs by filter

Read-only contract call

Broadcast a transaction (mutation)

Response

A GraphQL response wraps the requested shape under a top-level data key:

Response Fields

Field
Type
Description

data

object

The result, shaped exactly like the query

errors

array

Present only on failure; each entry has a message and the query path

Use Cases

  • Precise fetching: Request only the block, transaction, or account fields you need, nested in one round-trip

  • Explorer backends: Pull a block with its transactions and logs in a single query

  • Batch reads: Fetch a range of blocks (blocks(from, to)) without many JSON-RPC calls

  • Broadcast: Submit a signed transaction with the sendRawTransaction mutation

Error Handling

Error
Message
Description

400 / Bad request

Syntax / validation error

The GraphQL query was malformed or referenced unknown fields (see errors)

200 with errors

Field resolution error

The query parsed but a field could not be resolved (e.g. block not found)

403 / RBAC: access denied

Access denied

The GetBlock access token is missing or incorrect

See Also

Last updated

Was this helpful?