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!

dendog
  • 131
  • 1

2 Answers2

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

Badr Bellaj
  • 18,780
  • 4
  • 58
  • 75
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.

Thibaut Schaeffer
  • 351
  • 1
  • 2
  • 8