I want to unlock an address and fund it with ETH in ganache that I don't have its private key. So I run this:

./node_modules/.bin/ganache-cli --hardfork istanbul --port 8545 --gasLimit 8000000 --fork https://mainnet.infura.io/v3/xxxxx -e 1000000 -u 0x42665308F611b022df2fD48757A457BEC12BA668

However, I get: Error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 7000000 and the sender's account only has: 0 when I want to send tx with the address. Please help.

  • Right. You obviously cannot unlock your account on a public node like Infura. You don't want to do that either! – goodvibration May 6 at 9:27
  • I'm using ganache, so my purpose is just to grant access to a certain address that I don't actually have its a private key to simulate some mainnet tx in ganache. – Anderson May 6 at 9:40
  • BTW, the error that you're getting implies that the problem is not because you're unable to unlock some account, but because you have 0 ether on it. – goodvibration May 6 at 9:48
  • Oh! I think I get it. I think -e 1000000 will also fund the unlock address but actually it will not. – Anderson May 6 at 10:04

The address is actually unlocked but doesn't have enough ETH. So I need to send a tx to fund the address. I think -e 1000000 will also fund the unlock address but actually it will not and that' my mistake.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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