Quickstart
Join the waitlist, make a key once your account is approved, and send a first call.
Get a key
- Join the waitlist and confirm your email address.
- Make a key in the dashboard once your account is approved.
- Copy the key when it is made. It is shown once.
A key is bh_ followed by 40 characters. An approved account on the Free plan holds 3 keys at once.
- Endpoint
- Chain ID
- 4663
- Units a month
- 30,000,000
- Units a second
- 300
- Keys
- 3
Send a call
Every call is JSON-RPC 2.0, sent as an HTTPS POST to the endpoint with your key as the last part of the path.
The samples in these docs keep the endpoint in $RPC and your key in $KEY.
This call asks for the newest block’s number. The answer is in hex: 0x6eece67 is block 116,313,703.
RPC=https://api.blockhash.xyz/v1
KEY="<your key>"
curl $RPC/$KEY \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'
{"jsonrpc":"2.0","id":1,"result":"0x6eece67"}import { createPublicClient, http } from 'viem'
import { robinhood } from 'viem/chains'
const RPC = 'https://api.blockhash.xyz/v1'
const client = createPublicClient({
chain: robinhood,
transport: http(`${RPC}/${process.env.KEY}`),
})
console.log(await client.getBlockNumber())
// 116313703nimport { JsonRpcProvider } from 'ethers'
const RPC = 'https://api.blockhash.xyz/v1'
const provider = new JsonRpcProvider(`${RPC}/${process.env.KEY}`)
console.log(await provider.getBlockNumber())
// 116313703Ask the index
The same endpoint and the same key answer the Data API’s four calls.
This one reads a token’s name, symbol and decimals. The token is USDG.
curl $RPC/$KEY \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"blockhash_getTokenMetadata","params":["0x5fc5360d0400a0fd4f2af552add042d716f1d168"]}'
{"jsonrpc":"2.0","id":1,"result":{"decimals":6,"logo":null,"name":"Global Dollar","symbol":"USDG"}}Read next
- RPC: the endpoint, batches, log reads, and each node call with a request and its answer.
- Data API: the four index calls, their parameters and paging.
- Errors: every status and JSON-RPC error, and what to do about each.
- Compute units: what each call costs.
- Limits and pricing: the Free plan, the speed, and the price.