8

I've created contract with function to withdraw ether from it to owner wallet:

contract test {
   address owner;
   function test() {
      owner = msg.sender;
   }
   function sendEtherToOwner() {                       
      owner.send(this.balance);
   }
}

And ether withdrawing works with this function.

If I've already created another smart contract without such function, is any way to withdraw ether from it to owner wallet?

  • So, what you are saying is that if there is no kill or withdraw function specifically implemented, the ether is stuck in the wallet forever and there is no way of getting it out? – Vess Antonov Oct 5 '17 at 17:39
13

No. Unless you have a self destruct / suicide function, or a way to transfer ether, there's no way to get ether out of the contract. This is by design: if there were an automatic "escape hatch", nobody could trust a smart contract they didn't deploy to hold ether for them.

It's also worth noting that the idea of an "owner" isn't built into contracts - unless you encode such a distinction, the creator of a contract has no more ability to influence the contract than anyone else.

0

unless you got a kill function like this no.

function kill() {
        if (msg.sender == owner)
        suicide(owner);
    }

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.