Stream live feed of blockchain data using Blockdaemon's WebSocket endpoint.
The Blockdeamon RPC API provides a WebSocket endpoint for the real-time streaming of blockchain data. Below is a quick guide to utilize this service:
1. Supported Protocols
Your WebSocket RPC API should support the following protocols:
2. URI Format
Use the following format to connect to your chosen protocol via WebSocket:
wss://svc.blockdaemon.com/:protocol/:network/native?service_name=:service- Replace
:protocoland:networkwith your desired blockchain protocol and network. - Replace
:servicewith the appropriate service name, as defined in the protocol's configuration.
3. Authentication
To authenticate API requests, include your API key in the authorization header using one of the following methods:
Bearer Token
--headers 'Authorization: Bearer YOUR_API_KEY'or
API Key Header
--header 'X-API-Key: YOUR_API_KEY'4. Example
Create a WebSocket connection using your preferred tool. For example:
--headers 'Authorization: Bearer YOUR_API_KEY'
wss://svc.blockdaemon.com/ethereum/mainnet/native?service_name=wsSend a request to subscribe to a channel using the appropriate method. For Ethereum, an example request using eth_subscribe to create a new subscription for desired events.
{
"jsonrpc":"2.0",
"id": 2,
"method": "eth_subscribe",
"params": ["METHOD_PARAMS"]
}After subscribing to a channel, the server will push notifications containing blockchain data.
👋 Need Help?
Contact us through email or our support page for any issues, bugs, or assistance you may need.
