Detect incoming ERC-20 transfers without eth_getLogs polling

Add the receiving address as an Address Watch on ethereum, switch on a webhook (or a WebSocket) for payment events on that network, and handle events with type: "payment", direction: "in" and a token object. Credit the deposit on event: "confirmed". You keep no block cursor and run no log loop. Address Watch needs a paid plan: the Free plan has no Address Watch slots.

What polling costs you

The usual alternative is a loop around eth_getLogs: filter Transfer logs by the token contract and your address, remember the last scanned block, choose block ranges your provider accepts, and repeat. For a handful of addresses on one chain that can be fine. As it grows you own the cursor, the range limits, the retry logic, the reorganisation handling and the confirmation counting, and every poll spends RPC calls even when nothing arrived. The watch moves that work to the provider and pushes you an event.

Step 1: watch the address

// api() signs the request, see the USDT TRC-20 article
const watch = await api('POST', '/v1/address-watches', {
  network_slug: 'ethereum', // mainnet is the bare slug; a testnet is 'ethereum-sepolia'
  address: '0x...your deposit address',
})
console.log(watch.address.watch_id, watch.address.status) // 'active'

A 0x address is lowercased. Watching an address that is already watched returns the existing watch and takes no extra slot. Each active watch takes one slot of your plan, and adds and deletes are rate-limited (429 watch.quota). With one deposit address per customer, the slot count of the plan sets how many customers you can watch at once.

Step 2: choose how events reach you

Webhook. Incoming transfers are the payment kind, outgoing ones are payout. Sending events replaces all three lists, so send what you want:

await api('PUT', '/v1/webhooks', {
  url: 'https://example.com/rpcnode/webhook',
  enabled: true,
  events: { payment: ['ethereum'], payout: false, block: false },
})

Read webhook.secret from GET /v1/webhooks and verify every signature.

WebSocket. The same events can arrive over a Pusher-compatible socket on the private-address-events channel. Enable it with PUT /v1/realtime/subscription and {"enabled": true, "events": {"payment": ["ethereum"]}}. Your server authorises the channel by signing "{socket_id}:{channel_name}" with the API key secret; the WebSockets reference has the server and browser code. Nothing is replayed while the socket is closed, and if both transports are on an event is delivered, and billed, twice.

Step 3: handle the event

An ERC-20 deposit arrives as a payment event whose token holds contract (plus symbol and decimals when the token is in the network catalogue). Check the contract against your own allow-list, because anyone can deploy a token with a familiar symbol:

const ACCEPTED = new Set(['0x...your accepted token contract, lowercase'])

function handleAddressEvent(event) {
  if (event.type !== 'payment' || event.direction !== 'in') return
  if (!event.token) return // a native ETH transfer
  if (!ACCEPTED.has(event.token.contract.toLowerCase())) return // unknown or look-alike token
  // event.event: detected -> confirmations -> confirmed | failed
  if (event.event === 'confirmed' && event.status === 'success') {
    creditDeposit({
      deliveryId: event.delivery_id,
      address: event.to_address,
      txHash: event.tx_hash,
      raw: BigInt(event.amount_raw), // the exact amount in the token's smallest unit
    })
  }
}

Use amount_raw for money. amount is a human-readable string that is absent when the token is not in the catalogue. The detected event arrives first with confirmed: false; confirmations events follow for each block, and confirmed comes when the transaction reaches required_confirmations, a number set per account and network, see confirmations by network. Deduplicate by delivery_id in the same transaction as the credit.

What an event costs

An Address Watch event is billed once, with the first event of a transaction (detected), at the network's address-watch price. Confirmations, the final state and test deliveries are free. The price depends on how heavy the network is to scan, and GET /v1/networks/ethereum/credits returns it for each environment (address_watch_credits; the documentation example shows 450 for Ethereum mainnet). In the pricing tiers in the RpcNode repository, other mainnets sit between 200 and 600 credits per event at the time of writing, so read the live number. Events share the credit pool with your RPC calls.

Limits and caveats

  • Plan. Free has no Address Watch. Paid plans have a slot count and add and delete budgets.
  • Order and repeats. Events can repeat and arrive out of order. Use delivery_id, block_height and confirmations.
  • One event per transaction and direction. The scanner records one event per watch, transaction, type and direction. Test a transaction that sends two transfers to the same address before you assume one event per transfer.
  • No AML here. The risk field of address events is an empty array. AML screening is part of Payments, see AML checks.
  • Recent log only. GET /v1/address-watches/events keeps about a day. Use it to reconcile after downtime, not as an archive.
  • No latency promise. Events follow the scanner, not the mempool, on Ethereum.

For invoices with a fixed amount, an expiry and AML, create a payment instead: accept USDT TRC-20 payments shows the flow. See also the Payments product, pricing, Enterprise and the Address Watch reference.