I am working on private test-net and trying to send ether to contract but ether is not being transferred. I tried using both geth console and Mist.
eth.sendTransaction({from:eth.accounts[0], to: "0x2D13f7fbBA77EF39bd21d661bc77cd85ECA0C230", value: web3.toWei(15, "ether"), gas: 1000000})
On using debug.traceTransaction(txHash)
, I am getting invalid jump destination (PUSH1) 2
undefined
Why can't I send ether to contract?
1 Answer
The contract probably has a fallback function that generates an exception or uses more than 1000000 gas (which would itself cause an exception).
Related:
-
So is the fallback function prevents transfer of ether to a contract? If Yes, How? I mean how does it know whether the address of
to:
is of an account or of a contract? Commented Aug 4, 2016 at 7:00 -
Yes, your fallback function is what is rejecting the Ether: I also asked that question ethereum.stackexchange.com/questions/1477/… and see the comments to the answer too. Basically, the only difference a contract has is non-empty code ethereum.stackexchange.com/a/769/42, and code always executes when it receives a transaction/message.– eth ♦Commented Aug 4, 2016 at 7:51
-
So if I am implementing buy and sell functions, there exchange of coins and ether occurs between account and contract. So how are these functions able to transfer ether to and from contract? also if I can not send ether to contract, How I am supposed to use Autorefill functionality. I asked about working of buy and sell in this question (view comments). Commented Aug 4, 2016 at 8:51
-
1You can send ether to the contract by using the
buy
function (instead of the fallback function). Example: ethereum.stackexchange.com/questions/3100/… I also commented on your other question.– eth ♦Commented Aug 4, 2016 at 10:07
function( ) {throw;}