1

I am on a private net. I try sending ether to a contract address. It just doesn't work.

eth.sendTransaction({from: eth.coinbase, to: "0x39ce9b3b171da836afb02cbe2eff8d4e4fd6f174", 
     value: web3.toWei(3, "ether"), gas:90000000})

I did unlock my account. I also run a miner. Increased the gas to other higher values, etc. I really do not know what is wrong with it?

  • 2
    Did the contract defines a payable function? – Badr Bellaj Nov 21 '16 at 11:20
  • See this FAQ for reference solidity.readthedocs.io/en/develop/… – Tjaden Hess Nov 21 '16 at 16:24
  • I don't think that you can transfer ether to any contract address like this. You need to call a function from the contract to handle the sent ether or need to define fallback function. – Aniket Nov 22 '16 at 7:33
  • Thanks, I added payable keyword to the function and it worked. function paypremium() public payable { .....} – user813 Nov 22 '16 at 8:35
-1

Try to put the from with an actual address and see if it work.

eth.sendTransaction({from: "/* Contact Address*/", to: "0x39ce9b3b171da836afb02cbe2eff8d4e4fd6f174", 
 value: web3.toWei(3, "ether"), gas:90000000})

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.