Back to All

Why is my app calling eth_chainId so many times?

Hello,

I have a python script that uses web3.py and does various things like querying an address balance, trading crypto, getting price data etc.

I noticed on my Alchemy dashboard that every other RPC call is an eth_chainId call. In my script I am calling Web3.eth.chain_id only once and storing it for the duration of my runtime. So I'm wondering how or why I am making so many calls? Do I need to specify chain id when I first instantiate my web3 socket connection or else it will make this call over and over? Something else? Thanks.

ReadMe