I modified the example crowd sale contract from the Ethereum site slightly. First I sent 0.5 ETH from a wallet, it then sent the new tokens and I ran the safeWithdrawal function as the Beneficiary. This then triggered the contract to send the 0.5 ETH to the Beneficiary. I then later sent 1 ETH to the contract and it sent the tokens. I then ran the safeWithdrawal function again as the Beneficiary on the contract but for some reason this time it did not send the 1 ETH. Does it have anything to do with the "if (beneficiary.send(amountRaised))" that it is wrapped in, what is that part even doing?

    function safeWithdrawal() {
    if (beneficiary == msg.sender) {
        if (beneficiary.send(amountRaised)) {
            FundTransfer(beneficiary, amountRaised, false);
        } else {
            //If we fail to send the funds to beneficiary, unlock funders balance
            fundingGoalReached = false;

I think I know the problem, amountRaised increases each time, where I have withdraw .5 ETH it never took this off the amountRaised. So now there is 1 ETH but it is trying to withdraw 1.5 ETH. I guess I'm never going to get that back then?

  • 2
    It's hard to say seeing only this part of contracts. Please post the full code or link to your repository. Jul 18, 2017 at 15:22
  • Are you resetting amountRaised? That not being reset can lead to the contract trying to send a larger amount than it has. Jul 18, 2017 at 16:42
  • @OmkarKhair yeh thats the problem, amountRaised is 1.5 ETH but there is only 1ETH in the contract. That 1 ETH is stuck in the contract now isn't it
    – Mike Young
    Jul 18, 2017 at 19:34
  • @MikeYoung you might be able to withdraw the ETH, can you please share the full contract code to evaluate? Jul 19, 2017 at 6:36

1 Answer 1


I had the same issue with my version... the answer is to deploy a force send contract that forward funds sent to it and then immediately self destructs.

I used this to rescue some eth from mine.

contract ForceSend { function ForceSend(address recipient) payable { selfdestruct(recipient); } }

You need to send enough to make amountRaised match the balance

  • Would that still work even though I didn't include a ForceSend function in the contract? As in is ForceSend built into solidity already?
    – Mike Young
    Jan 5, 2018 at 16:19
  • you are creating the forceSend function in the new contract. Try it. Worked for me.
    – Phil
    Jan 11, 2018 at 7:40
  • execute forceSend on the new contract and send 0.5 eth. Check it is received by the stuck contract. Then execute checkGoalReached and safeWithdrawal on the stuck contract. Job done.
    – Phil
    Jan 11, 2018 at 7:43
  • Check this tx for proof. I forwarded the difference to this address, it then forwards the funds and immediatley self destructs so the funds cant come back. The eth is then stuck in the jammed contract and hasnt raised amountRaised because it didnt call the payable function. etherscan.io/tx/…
    – Phil
    Jan 16, 2018 at 19:32
  • How would this new contract help? It's a new contract and it can't access Ether in another contract. Apr 14, 2018 at 14:45

Your Answer

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

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