Skip to Content
ReferenceCLIImpersonate Accounts

Impersonate Accounts

Add an address to your Stagenet’s impersonation allowlist from the command line. Once impersonated, your Stagenet will accept eth_sendTransaction requests where from is the impersonated address — no private key required.

This CLI wraps the impersonation SDK methods. See the SDK page for the full mechanics (and the eth_sendTransaction vs eth_sendRawTransaction caveat).

Usage

With a contract.dev.js at your project root (see Setup):

contract.dev impersonate <subcommand>

Start impersonating

contract.dev impersonate 0x28C6c06298d514Db089934071355E5743bf21d60
ArgumentDescription
<address>The address to impersonate
--fund <amount>Optional. Top up the impersonated address with native tokens (e.g. for gas). Accepts decimal, 0x-hex, or "1 ether" / "1000000 wei".

Sample output:

Impersonating 0x28c6c06298d514db089934071355e5743bf21d60

Funding in one shot:

contract.dev impersonate 0x28C6... --fund "1 ether"
Impersonating 0x28c6c06298d514db089934071355e5743bf21d60 funded with +1000000000000000000 wei (new balance: 1000000000000000000)

impersonate stop

Remove an address from the allowlist. After this, unsigned transactions from that address are rejected unless you impersonate it again.

contract.dev impersonate stop 0x28C6...

Sample output:

Stopped impersonating 0x28c6c06298d514db089934071355e5743bf21d60

impersonate list

Print every address currently on the allowlist (lowercased), one per line. Prints No impersonated accounts. if the allowlist is empty.

contract.dev impersonate list

Sample output:

0x28c6c06298d514db089934071355e5743bf21d60 0x47ac0fb4f2d84898e4d9e7b4dab3c24507a6d503

Notes

  • Impersonation only works for transactions sent through eth_sendTransaction. If your wallet signs locally with a private key, it will use eth_sendRawTransaction and impersonation will not apply. Use a JSON-RPC signer (e.g. provider.getSigner(address) in ethers, or createWalletClient({ account, transport: http(url) }) in viem).
  • Impersonated accounts still pay gas. The --fund flag is a shortcut for topping them up; you can also fund them later with balance add.
Last updated on