trufflesuite / ganache

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
2.62k stars 676 forks source link

How can I impersonate an address for testing purposes? #4078

Closed joelamouche closed 1 year ago

joelamouche commented 1 year ago

As advertised in the README.md, it should be possible to impersonate any account without private keys.

How do I do that?

Thanks in advance

davidmurdoch commented 1 year ago

You can use evm_addAccount, https://github.com/trufflesuite/ganache/blob/develop/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_addaccount or the command line option --wallet.unlockedAccounts=0x<address here> (see ganache --help)