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?

eth
  • 85,679
  • 53
  • 285
  • 406
Prashant Prabhakar Singh
  • 8,026
  • 5
  • 40
  • 79

1 Answers1

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?

eth
  • 85,679
  • 53
  • 285
  • 406
  • 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? – Prashant Prabhakar Singh Aug 04 '16 at 07:00
  • Yes, your fallback function is what is rejecting the Ether: I also asked that question http://ethereum.stackexchange.com/questions/1477/how-does-a-fallback-function-rejecting-ether-work and see the comments to the answer too. Basically, the only difference a contract has is non-empty code http://ethereum.stackexchange.com/a/769/42, and code always executes when it receives a transaction/message. – eth Aug 04 '16 at 07: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). – Prashant Prabhakar Singh Aug 04 '16 at 08:51
  • 1
    You can send ether to the contract by using the buy function (instead of the fallback function). Example: http://ethereum.stackexchange.com/questions/3100/passing-ether-with-call-to-solidity-function I also commented on your other question. – eth Aug 04 '16 at 10:07