Ethereum Websocket API

Rockside's websocket endpoint provides support for Pub/Sub API as well as JSON-RPC filter support. Ethereum JSON-RPC API is also supported over a websocket connection.

We provide access to the following networks;

Network

URL

Mainnet

https://api.rockside.io/ethereum/mainnet/jsonrpc/ws?apikey=YOUR_APIKEY

Ropsten

https://api.rockside.io/ethereum/ropsten/jsonrpc/ws?apikey=YOUR_APIKEY

Poa Network

https://api.rockside.io/ethereum/poanetwork/jsonrpc/ws?apikey=YOUR_APIKEY

Example

A simple way to test websocket is to use wscat, but you can use any tool that supports websocket.

To begin, create a new WebSockets connection.

wscat -c https://api.rockside.io/ethereum/ropsten/jsonrpc/ws -H 'apikey:YOUR_APIKEY'

Then, you can begin making JSON RPC calls. For example, type the following to get the current block number from the network:

{"jsonrpc":"2.0", "method": "eth_blockNumber", "id": 1, "params": [] }

Or, send the following to get detailed information on the most recently mined block:

{"jsonrpc":"2.0", "method": "eth_getBlockByNumber", "id": 1, "params": ["latest", false] }

You can also subscribe to some events.

// newHeads
{"jsonrpc":"2.0", "id": 1, "method": "eth_subscribe", "params": ["newHeads"]}
// newPendingTransactions
{"jsonrpc":"2.0", "id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}

Finally, you can unsubscribe with a call with eth_unsubscribe as method and the subscription id as first parameter.

{"jsonrpc":"2.0", "id": 1, "method": "eth_unsubscribe", "params": ["SUBSCRIPTION_ID"]}