0

I wrote and deployed a basic smart contract on Remix Javascript VM Environment. It worked fine.

Then I installed and started TestRPC (now ganachi-cli). Then, upon changing the environment to Web3 Provider the Account box got emptied, so I had to create a new account by clicking on the plus sign next to Account. Then I tried to deploy the contract again and I got the following error:

Error: sender doesn't have enough funds to send tx. The upfront cost is: 278786 and the sender's account only has: 0

Screenshot of my Remix IDE

I've been looking in several blogs (like this one) for a workaround either by decreasing the cost of the creation of the contract to zero or increasing the sender's account balance, but I can't find any solution. I'm stuck, please help me.

  • I can connect without issues from remix to an instance of ganache running in my machine and have access to all accounts created by ganache. Make sure remix is connecting from http and not https (you cannot access localhost from remix.ethereum.org in https). If that fails check the browser console for possible error messages. – Ismael Apr 16 at 21:21
  • 1
    I solved it. The problem was that I had installed a deprecated version of TestRPC, so I just uninstalled it and installed ganache-cli. It's working smoothly now. Thanks. – andres_v Apr 18 at 23:07
1

The JS VM is convenient in many ways. It gives default accounts and those accounts magically have 100 ETH each which os ample for most tests, to name two.

No such work arounds and crutches exist on testnets or mainnet. You have to contend with both the need to have an account and the need to pay for your transaction. So, you have to create an account, which it sounds like you have done, and you have to get money, which it sounds like you have not done.

On testnets, fake money is acquired from a faucet, a friend or by mining. The last two, or an exchange work for mainnet. Faucets don't exist because no one is giving away actual money for nothing.

Hope it helps.

  • Thank you @Rob for your time. This contract is just an exercise mean to be deployed on a testnet, how would be the best approach to do it then? – andres_v Apr 14 at 16:41
  • You want to put it on testnet and you cant get around testnet protocol rules. You didn't say which testnet you plan to use. You need to find a faucet that corresponds to that network, to get some eth that corresponds, just like you would need real eth use the real network. E.g. ropsten faucet, rinkeby faucet, etc. – Rob Hitchens - B9lab Apr 14 at 18:16

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.