WebSocket RPC

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 :protocol and :network with your desired blockchain protocol and network.
  • Replace :service with the appropriate service name, as defined in the protocol's configuration.

3. Authentication

Authentication is required by setting the bearer token in the authorization header:

--headers 'Authorization: Bearer YOUR_API_KEY'

4. Quick Start

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=ws

Send 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.