Skip to content

eth_subscribe ​

served · same as reth

Starts a subscription over a WebSocket. The node then sends a message for each new head, log or pending transaction.

When to use ​

Use it to follow the chain in real time without polling. Open a WebSocket on the JSON-RPC port first.

Example ​

A subscription needs a WebSocket. The live example sends the request over HTTP, so the node refuses it. Over a WebSocket, the answer is the subscription ID, and notifications follow with the method eth_subscription.

bash
curl -s -X POST -H 'Content-Type: application/json' \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newHeads"]}' \
  http://127.0.0.1:8547
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_subscribe",
  "params": [
    "newHeads"
  ]
}

Response ​

Live mainnet, 2026-10-14. Checked against reth 2.7: equal.

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32603,
    "message": "Internal error"
  }
}

A subscription needs a WebSocket; over HTTP both nodes refuse it.

Full response

Parameters ​

NameTypeRequiredMeaning
kindstringyesnewHeads, logs, newPendingTransactions or syncing.
optionsobject or boolean, see FilternoFor logs: a filter with address and topics (no block range). For newPendingTransactions: true sends full transactions, not hashes.

Returns ​

The subscription ID (hex). Each notification is {"method": "eth_subscription", "params": {"subscription": ID, "result": ...}}.

Notes and limits ​

  • newHeads sends the header of each new block, as eth_getHeaderByNumber returns it.
  • logs sends one notification for each log. On a reorg, it first sends the logs of the removed blocks again with removed: true.
  • newPendingTransactions sends the transactions that are ready for a block. Serve mode has no pool, so it sends nothing there.
  • syncing sends false once.
  • A connection can have at most 128 subscriptions. All connections together can have at most 4 096 logs subscriptions (--rpc-max-log-subscriptions N, 0 for no such limit).
  • A logs filter has at most 1 024 addresses and topic values together. The node keeps one copy of the logs of the last 8 blocks for all subscriptions, for the removed: true messages.
  • The node sends the notifications of a block when the block becomes the head. cinder --serve checks the database for new blocks every 50 ms, because another process writes the database. After more than 64 new blocks, the node sends only the newest 64.
  • Each connection has a queue of at most 1 024 messages and 16 MiB. A client that reads slowly does not delay the other clients. When its queue is full, a new notification replaces the oldest notification in the queue. The connection stays open, as in reth.

Errors ​

CodeMessageWhen
-32000too many subscriptionsThe connection already has 128 subscriptions, or the node has 4 096 logs subscriptions.
-32602Invalid paramsThe kind is unknown. data names the valid kinds.
-32602Invalid paramsThe logs filter has more than 1 024 values. data tells the limit.
-32603Internal errorThe request came over HTTP.

Compared with reth ​

The live example above gives the same answer on Cinder and on reth 2.7.

eth_unsubscribe, eth_getLogs, eth_newFilter.

Schema (OpenRPC) ​

Parameter kind: string
json
{
  "type": "string",
  "enum": [
    "newHeads",
    "logs",
    "newPendingTransactions",
    "syncing"
  ]
}
Parameter params: boolean or object
json
{
  "oneOf": [
    {
      "type": "boolean"
    },
    {
      "type": "object",
      "properties": {
        "address": {
          "oneOf": [
            {
              "title": "hex encoded address",
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            {
              "type": "array",
              "items": {
                "title": "hex encoded address",
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              }
            }
          ]
        },
        "topics": {
          "type": "array"
        }
      }
    }
  ]
}
Result: SubscriptionId
json
{
  "title": "Subscription id",
  "type": "string",
  "pattern": "^0x[0-9a-f]{32}$"
}