Auto Impersonation
ethui automatically uses anvil_impersonateAccount whenever submitting transactions to an anvil-based chain.
This allows you to submit transactions without having to unlock your wallet, and enables fast mode to work on secure wallets as well.
If you want to explicitly pick which account is being impersonated, use the Impersonator wallet.
Why?
This is actually a security feature that happens to be very convenient for development.
Let's say you're spawning the following anvil node:
anvil --chain-id 1
This could open you up for replay attacks, where you end up signing a payload that can actually end up being used on the real mainnet chain to execute a real transaction, either maliciously or by mistake.
By auto-impersonating accounts, you now skip the signing step, but are still able to include transactions on the test chain. In the end:
- you never have to actually unlock your wallet
- no signature is ever produced from your private key
- fast mode can now be available as well, since the confirmation steps that would be needed for a signature is now optional