I am writing a smart contract which receives Ether.

How can I transfer Ether from the contract to my personal purse

Can I send Ether from the contract like as I can do with regular wallet? I would tell the user to send 0.01 ETH to the contract , But I don't know withdraw ETH from smart tract. Can you help edit code I did test code in ropsten: https://ropsten.etherscan.io/address/0x47e8035a8dd94d9c4fd7075125c4693767720b7f

Sorry, I don't Know insert code to in the website:



2 Answers 2


You can not directly transfet ether from contract to EOA. Contracts are different from EOAs( Externally owned accounts) in the manner that EOAs are governed by private keys and contract is governed by its code.

SO if you are getting ethers in contract, you need a method to withdraw eth from the contract.

The code may look something like:

function payout () public onlyOwner returns(bool res) {
    return true;
  • When I want to withdraw ETH, what should I do? Commented May 30, 2018 at 11:17
  • Just call this function similar to how you call other functions. You can use remix or MEW for that. Commented May 30, 2018 at 11:43

You already have this function in your code. This should work:

    function withdraw() onlyOwner public {
    address myAddress = this;
    uint256 etherBalance = myAddress.balance;

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