2

I am unable to perform any transaction in Browser Solidity as there is no ether in the account.

The contract is being created, but now ether is needed to test the functions.

I have tried using the "value" field under the airplane toggle, but executing any function with a non-zero value here throws the following error:

VM Exception: invalid JUMP

How should I add ether to my test accounts?

Thanks in advance!

3
  • I have managed to work around this by using testrpc and running a local node, but still would be good to hear a solution for JS VM option. – dendog Jan 16 '17 at 23:00
  • Do all functions which accept payment have a payable modifier? – Tjaden Hess Jan 17 '17 at 2:31
  • Yes they do @TjadenHess – dendog Jan 18 '17 at 11:17
2

You have to Define in your code the payable fallback function:

function() payable {}

Otherwise your contract won't accept any ethers. However, if you test your contract on the Javascript VM you don't need any ethers in your Balance.

in the case when you use the Web3 Provider option in a private network you need to mine some Ethers in your geth client using miner.start() miner.stop() How to use miner.start(2) from javascript

1

The accounts in the JS VM are already provisioned with ether. You can check a balance by calling the following using one of the addresses:

function getBalance() constant returns(uint balance) { balance = msg.sender.balance; }

As mentioned in other answers, you should check that functions called with non-zero value are declared as payable.

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.