Skip to content

Continuous eth_getLogs, eth_chainId, eth_blockNumber calls to RPC when using contract.on event listener #2659

Answered by ricmoo
khoanguyen-yang asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this is how a the Provider works for events. It polls for changes in block number, and when one is detected it checks for new logs. If you are using an endpoint which cannot change its chain ID, you can use the StaticJsonRpcProvider.

If you want to use WebSockets you need to use the WebSocketProvider.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@khoanguyen-yang
Comment options

Answer selected by khoanguyen-yang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants