is_anvil
Documentation for eth_defi.provider.anvil.is_anvil function.
- is_anvil(web3)[source]
Are we connected to Anvil node.
You need to change some behavior depending if you are connected to a real node or Anvil simulation.
This can be either
Mainnet work (chain id copied from the forked blockchain)
Anvil test backend
See also
launch_anvil()
Warning
This method will crash with Base mainnet sequencer:
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mainnet-sequencer.base.org/
.- Parameters
web3 (web3.main.Web3) – Web3 connection instance to check
- Returns
True if we think we are connected to Anvil
- Return type