2

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?

2
  • What is the fallback function of the contract?
    – eth
    Aug 4 '16 at 6:17
  • The fallback function is function( ) {throw;} Aug 4 '16 at 6:48
1

The contract probably has a fallback function that generates an exception or uses more than 1000000 gas (which would itself cause an exception).

Related:

What does a "bad JUMPDEST" error mean?

Why does a Solidity throw consume all gas?

4
  • 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? Aug 4 '16 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
    Aug 4 '16 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). Aug 4 '16 at 8:51
  • 1
    You 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
    Aug 4 '16 at 10:07

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.