eth_subscribe
Subscribes to events on the node.
Geth reference · All supported methods
Parameters
Parameters are positional, in the order below.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | Subscription kind | Yes | newHeads or logs. |
arg | Kind-specific argument | No | Optional address and topic filters for logs; omit for newHeads. |
Return value
A subscription ID. Subsequent eth_subscription notifications carry this ID and a header or log object in params.result.
Example
Send this message over the WebSocket connection for <gateway-url>/<service-url>:
json
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_subscribe",
"params": [
"newHeads"
]
}Illustrative response; values depend on the selected network and request:
json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x9ce59a13056e85ae"
}Direct behavior
Available over WebSocket for newHeads and logs. A subscription stays with one provider. A disconnect ends it; reconnect and subscribe again. Each notification is billable; see Pricing.