Anvil Support
Anvil is a local Ethereum node that you can use to test your contracts and applications locally. It is part of the Foundry toolchain.
Why is anvil different?
Anvil is a local, test-focused blockchain. It exposes functionality that can't possibly exist in a real blockchain, for the purposes of development and testing, such as:
- Override any state, balance, or code in any address;
- Freely mint ETH;
- Impersonate any account, allowing you to submit transactions without having a private key.
- Create snapshots, and revert back to them.
None of these functionalities are expected to be available in a production blockchain. As such, user-facing wallets are not prepared to handle these scenarios, and sometimes outright fail to function in these situations.
For example, Metamask tracks its own transaction nonce for each account, and will fail to sign valid transactions if anvil is reverted or entirely restarted (as the nonce given by Metamask will no longer match what the chain expects).
What does ethui do differently?
ethui detects whether a given chain is anvil-based, by checking the anvil_nodeInfo RPC endpoint.
If detected, a dedicated sync process is used, which continuously tracks the chain's head, and correctly identifies new blocks, reverts to a prior snapshot, or even full restarts.
Nonce management is calculated from scratch every time, instead of relying on a local cache that may get outdated.
As a result, ethui can quickly re-sync data from an anvil chain, such as transaction history, deployed contracts, all in real-time.