What changes on Elysium
Elysium makes a block only when it has transactions to include, so the block rate follows traffic. When the chain is busy it makes 5 to 10 blocks per second, and it can make 90 or more in a single second. Three things follow:- One request per block costs 10 or more requests per second, and far more during a burst, before your application does anything with the data. Reading log ranges costs the same two requests whether 1 block or 1,000 blocks arrived since the last poll.
- Block timestamps are not unique. A timestamp has a resolution of one second, so many blocks share one. Order and deduplicate by block number and log index.
- Client defaults are set for slow chains. viem polls every 4 seconds by default, which is often 30 or more Elysium blocks.
eth_subscribe is not available (Edge RPC introduction). Polling is the way to follow the chain head.
Define the chain
viem has no built-in Elysium chain yet, so define one. Don’t use viem’selysiumTestnet export: it’s a different chain, with chain ID 1338. Set blockTime so that viem’s default polling interval and cache time follow the chain:
99801 and /evm/99801 in the URL. Replace <your_edge_api_key> with an Edge API key from the dashboard.
Read log ranges, not blocks
Keep a cursor at the last block you processed. On each poll, ask for the head, then fetch every matching log from the cursor to the head in oneeth_getLogs call:
eth_getLogs limits.
Order by block number, not timestamp
Many Elysium blocks can share one timestamp, so a timestamp can’t tell you which of two events happened first. Use these instead:- Ordering:
(blockNumber, logIndex)for logs and(blockNumber, transactionIndex)for transactions. - Cursors and checkpoints: the block number. A timestamp cursor either skips or repeats the blocks that share it.
- Time windows: filter on timestamp if you need to, but expect one second to hold many blocks.
Wait for receipts
waitForTransactionReceipt checks for the receipt once per pollingInterval. With the 250 ms setting above, it checks about every two or three blocks:
pollingInterval, viem uses half of blockTime but never less than 500 ms. If the chain has no blockTime, viem waits 4 seconds between checks.
Polling or an indexed store
Polling sees a block as soon as Edge serves it, plus at most one polling interval, which you control. A Turbo pipeline, a subgraph or Feeds first ingests, transforms and writes each block, so its data lands a little later. Poll when your app must react within a block or two, to a few contracts or its own transactions. Use an indexed store when it needs history, aggregates or many addresses. Polling works well to follow the head from an app. For history, or to load chain data into a database, use a Turbo pipeline with the curated Elysium datasets, such aselysium_mainnet.raw_logs. For examples, see Stream Elysium wallet activity and Track Elysium bridge flows.