Appearance
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:8547json
{
"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.
Parameters
| Name | Type | Required | Meaning |
|---|---|---|---|
kind | string | yes | newHeads, logs, newPendingTransactions or syncing. |
options | object or boolean, see Filter | no | For 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
newHeadssends the header of each new block, aseth_getHeaderByNumberreturns it.logssends one notification for each log. On a reorg, it first sends the logs of the removed blocks again withremoved: true.newPendingTransactionssends the transactions that are ready for a block. Serve mode has no pool, so it sends nothing there.syncingsendsfalseonce.- A connection can have at most 128 subscriptions. All connections together can have at most 4 096
logssubscriptions (--rpc-max-log-subscriptions N, 0 for no such limit). - A
logsfilter 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 theremoved: truemessages. - The node sends the notifications of a block when the block becomes the head.
cinder --servechecks 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
| Code | Message | When |
|---|---|---|
| -32000 | too many subscriptions | The connection already has 128 subscriptions, or the node has 4 096 logs subscriptions. |
| -32602 | Invalid params | The kind is unknown. data names the valid kinds. |
| -32602 | Invalid params | The logs filter has more than 1 024 values. data tells the limit. |
| -32603 | Internal error | The request came over HTTP. |
Compared with reth
The live example above gives the same answer on Cinder and on reth 2.7.
Related methods
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}$"
}