eth_subscribe - Base

eth_subscribe. Subscribe to real-time updates for events like new blocks or logs

eth_subscribe - base [Value: 10CU]
Creates a subscription to receive real-time updates for various events on the blockchain
Use cases

Use cases

  • Subscribe to new block headers for monitoring
  • Track blockchain head changes in real-time
  • Receive updates when new blocks are mined
Constraints

Constraints

  • newPendingTransaction subscription is not supported
  • Requires continuous WebSocket connection to the node
  • Node must support eth_subscribe method
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples

wscat -c wss://base.drpc.org

{"jsonrpc":"2.0","id": 2, "method": "eth_subscribe", "params": ["newHeads"]}'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1234567890abcdef1234567890abcdef"
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray of strings
array of strings
subscription_namestring
Specifies the event type for subscription. Supported types include:
array of strings
newHeadsstring
Triggers a notification for each new block header added, including chain reorganizations.
logsstring
Returns logs matching filter criteria in newly imported blocks.
dataobject
Is specifically used for logs subscriptions. Arguments like address, multiple addresses, and topics.

Response

200
The subscription ID, represented as a hexadecimal string.

Response params

object
idinteger
jsonrpcstring
resultstring