🤔 Got questions? Schedule an office hours session.

eth_subscribe - Ethereum Mainnet


Summary

Starts a subscription to a specific event. Can be used with WSS connections only.
It returns subscription ID. Use it with eth_unsubscribe to end the subscription.

Parameters

1. Subscription Name Enum

The event type you want to subscribe to. Possible values: newHeads, logs, newPendingTransactions, syncing
Example: logs

2. Subscription Filter JSON

When subscribing for logs use this parameter to filter for address and topics to filter notifications. This parameter has no meaning for other subscription types.

Example: { "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "topics": [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x00000000000000000000000028c6c06298d514db089934071355e5743bf21d60', '0x000000000000000000000000d7406ce6e1c406a1812cbea34a0a8b84b4d455d3',]}

Code Examples