Arbitrum One
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Arbitrum One
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
eth_subscribe opens a push-based subscription over a WebSocket connection to Arbitrum One (chain ID 42161), the Optimistic Rollup that settles to Ethereum and pays gas in ETH. Instead of repeatedly polling the node, you register once and the node streams notifications as events occur — new block headers, matching logs, pending transaction hashes, or sync-status changes. Because Arbitrum's sequencer produces sub-second soft confirmations, a newHeads stream from wss://arbitrum.therpc.io/YOUR_API_KEY (the WebSocket form of the same endpoint you use for HTTP at https://arbitrum.therpc.io/YOUR_API_KEY) gives you the freshest possible view of L2 state without the latency and request overhead of polling loops.
newHeads to drive real-time dashboards — block explorers, gas trackers, or TVL tickers — that react to each Arbitrum block the moment the sequencer publishes it, with no polling.logs events from a contract as they are included, for example Swap events from Camelot or Uniswap pools, or borrow/repay events from Aave, scoped by address and topics.newPendingTransactions to watch transactions enter the sequencer's mempool — useful for trade execution bots on GMX or for front-running-aware order flow analysis.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | subscriptionType | string | Sí | Subscription type: `newHeads` — new block headers; `logs` — matching event logs; `newPendingTransactions` — pending tx hashes; `syncing` — node sync status changes. |
| 2 | filter | object | No | Required only for `logs` subscriptions. Same filter shape as eth_newFilter: `address` and/or `topics`. |
| Tipo | Descripción |
|---|---|
| string | Hex subscription ID. Subsequent notifications arrive as `eth_subscription` messages with `params.subscription` matching this ID. |
Try it live in the Arbitrum One playground.
| Código | Mensaje | Causa |
|---|---|---|
-32602 | invalid argument | Unknown subscription type or malformed filter for a logs subscription. |
-32000 | notifications not supported | Method called over an HTTP connection instead of WebSocket. |
eth_subscribe over plain HTTP returns a "notifications not supported" error — point your client at the wss://arbitrum.therpc.io/YOUR_API_KEY form, not the HTTPS one.eth_getLogs over the missed block range so you do not silently skip Arbitrum events.logs notifications can arrive with removed: true during a reorganisation. While Arbitrum's sequencer rarely reorgs L2 ordering, your code must still handle removed events explicitly and unwind any state you derived from the superseded log.Parámetros
"newHeads" | "logs" | "newPendingTransactions" | "syncing"
Required only for `logs` subscriptions. Same filter shape as eth_newFilter: `address` and/or `topics`.