I'm making this call from JavaScript to the contract function.

contracts['CrowdFunder'].contract.contribute({value: web3.toWei(0.000000000000000005, 'ether')});

The function is called, but the error message says,

An error occurred during contract execution: 'Out of gas'

See http://testnet.etherscan.io/vmtrace?txhash=0x58c3e7d41db0dd3ba4c2b600b374b2576f9508d84e7351058232027af4cc3abb

How do I specify the amount of gas in JavaScript for the above?

1 Answer 1


Try changing

    value: web3.toWei(0.000000000000000005, 'ether')


    value: web3.toWei(0.000000000000000005, 'ether'), 
    gas: 100000 

Refer to the example under Contract Methods in JavaScript API - web3.eth.contract.

And modifying the call as suggested by eth's comment below:

    value: 5, 
    gas: 100000 
  • 2
    Also, OP since you only want to pass 5 wei, just use value: 5.
    – eth
    Commented Apr 17, 2016 at 3:55

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.