I'm trying to use ganache-cli on a fork of the Main Network.

I use the following command to start ganache.

ganache-cli --fork https://mainnet.infura.io/v3/MY_API_KEY -- unlock 0x6EBaF477F83E055589C1188bCC6DDCCD8C9B131a

Ganache will still give me the 10 account and non of them have this address.

This account is not mine but has a lot of ether in it. So how do I work on the fork with this account?

Truffle will also see me as the first ganache account. And contract deployment will be made under this address and not the one I unlocked.

How do I work from this account without the private key?

It' seam like truffle isn't seeing this unlocked account.

3 Answers 3


You need to specify the "from" sender account.

If you're trying to make a contract interaction (functional call), then you want something like

MyContract.someFunction(arg1, arg2, { from: "0x6EBaF477F83E055589C1188bCC6DDCCD8C9B131a" })

If you're trying to send ETH from the unlocked account, then you want something like

const someAccount = "0x6635f83421bf059cd8111f180f0727128685bae4"
web3.eth.sendTransaction({from: "0x6EBaF477F83E055589C1188bCC6DDCCD8C9B131a", to: someAccount, value: "1000000000000000000"})
  • 3
    How's web3 client going to sign this transaction without the private key? Does Ganache treat unlocked accounts differently and never check for the signature? Commented Aug 30, 2021 at 12:08

You can use the connect option of ethers too. But you'll have to derive the signer of the unlocked account by calling

signer = provider.getSigner(unlockedAccountAddress)

Then to make a transaction from that account, simply


From ganache-cli documentation:

Specify --unlock ... any number of times passing either an address or an account index to unlock specific accounts. When used in conjunction with --secure, --unlock will override the locked state of specified accounts.

So you obviously need to add --secure when you start ganache-cli.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.