For AI agents: visit https://docs.blockdaemon.com/llms.txt for an index of all pages formatted in Markdown and endpoints in OpenAPI. Append .md to any documentation page URL to get its markdown version.
Compute Unit (CU) values are subject to change as we assess and adjust our pricing to better reflect usage and associated costs.
Blockdaemon's RPC API supports WebSocket connections for real-time blockchain data on supported chains. This guide covers how to connect, which methods are available, and how Compute Units (CUs) are calculated.
- Subscribe / Unsubscribe request:1 CU per request
- Confirmation responses:1 CU
- Event messages (e.g., chain_newHead):CU varies by event type
🚧
Each subscription type has a specific event type tied to it. For example, you send state_subscribeStorage → you’ll receive messages of type state_storage.
💡 Billing Example – Subscribe to state_subscribeStorage and receive state_storage notifications
Description
Count
CU per Action
Total CU
🔼 Send state_subscribeStorage request
1
1 CU
1
🔽 Receive confirmation response
1
1 CU
1
🔽 Receive state_storage notifications
6
5 CU
30
🔼 Send state_unsubscribeStorage request
1
1 CU
1
🔽 Receive unsubscribe confirmation
1
1 CU
1
Total Compute Units
34 CU
How to Connect
To connect to the WebSocket endpoint, follow these steps:
Authorize your request using one of the following methods:
Once connected, you can send and receive messages using JSON-RPC:
// Subscribe to a WebSocket event (e.g., newHeads)
{"jsonrpc":"2.0","method":"eth_subscribe","params":["newHeads"],"id":1}
// Server responds with a subscription ID
{"jsonrpc":"2.0","id":1,"result":"0xb544f3328760ac404b9e3a4aec6f2ec0"}
// You’ll receive real-time updates as events happen
{"jsonrpc":"2.0","method":"eth_subscription","params":{
"subscription":"0xb544f3328760ac404b9e3a4aec6f2ec0",
"result":{ /* event data */ }
}}
// To unsubscribe from the event stream
{"jsonrpc":"2.0","method":"eth_unsubscribe","params":["0xb544f3328760ac404b9e3a4aec6f2ec0"],"id":2}
// Confirmation that you’ve successfully unsubscribed
{"jsonrpc":"2.0","id":2,"result":true}