Here is my contract function:

function DoTransfer() payable {
    address objAddress = 0x29662dA5D870FFb39201A8320214421eE9fE9D25;
    objAddress.transfer(.05 ether);

Here is the Javascript that calls that function:

var abi = [{"constant":false,"inputs":[],"name":"getCreator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getLastDepositer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getLastTransferror","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"DoDeposit","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"DoTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
var MyContract = web3.eth.contract(abi);
var myContractInstance = MyContract.at('0x4E4B55f3e97D1296260012a633285972A4A57f35');

myContractInstance.DoTransfer.sendTransaction({from:"0x3d86B4D6f28554428E5AF38490DD1977691A3082"},function(error, result){
    if(!error) {
        console.log("#" + result + "#")
    } else {

It returns a transaction ID, no error is shown, but the .05 ether is not transferred.

  • It works on remix for me...I think you may have an issue with the javascript or the connection. What's the transaction hash so we can look it up?
    – thefett
    Sep 6, 2017 at 1:18
  • Here is the tx that failed: ropsten.etherscan.io/tx/…. Please see this post (ethereum.stackexchange.com/questions/25908/…) and explain why the code works when transferring to an account but not to a contract.
    – Tester
    Sep 6, 2017 at 2:12
  • You should use toWei() function to convert ether into wei. Oct 6, 2017 at 3:45

3 Answers 3


The problem is destination 0x29662dA5D870FFb39201A8320214421eE9fE9D25 is a contract and the transfer is executing the fallback function.

In the vm trace there's an exception in the receiving contract

[93]    90  JUMPDEST    2171    1   2
[94]    91  PUSH1   2170    3   2
[95]    93  DUP1    2167    3   2
[96]    94  REVERT  2164    3   2
 An error occurred during contract execution: exception

Which propagates to the sender and causes it to fail.


This anser is not correct, see Ismaels comment below!

The bug seems in the javascript code. You are calling sendtransaction() on the function body. Just omit the .sendTransaction part like this:

},function(error, result){
    if(!error) {
        console.log("#" + result + "#")
    } else {
  • That is not the error, web3 v0.20 methods accepts the modifiers .call() and .sendTransaction() that will override the automatic method discovery.
    – Ismael
    Nov 6, 2017 at 16:34
  • @Ismael Right, thanks for pointing that out! I was not aware that this is valid code. Nov 7, 2017 at 8:43

because you say there is no exception, so the target contract address should already have fallback function to accept the ether,

so now your issue is that you got transaction id but the 0.5ether not transferred, I guess high probability is that you transferred 0.5 wei, not 0.5 ether, it doesn't reflect as the amount is too low, make sure you transfer the correct amount, please be aware that per document, the unit of transfer is wei, not ether

<address payable>.transfer(uint256 amount): send given amount of Wei to Address,

if all the above is not the case, then there is another possibility: the fallback function in your target address has some code logic inside, which will return received ether to the sender, just a guess, I even don't know whether this can work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.