I am writing a smart contract which receives Ether.

How can I transfer Ether from the contract to my personal purse (non programmatically using such a program as Ethereum Wallet)?

Can I send Ether from the contract like as I can do with regular wallet?

In the "possible duplicate" question it is not said how to withdraw from the contract non-programmatically. It is should be easy for a user to withdraw, without him writing a code.


Basically it all depends on your contract.

Let's have an example contract:

contract test {
    function payme() payable public {

    function getBal() public returns (uint) {
        return this.balance;

You can save Ether in this contract by calling the payme function. Also you can query how much Ether the contract has. But the Ether can't be transferred away, so it's stuck in the contract forever.

@Victory's answer has a good idea about how to enable withdrawals without any coding. But that of course requires the contract to support such functionality.


If you are not writing a web3 interface you only have one real option and that is the default function of your contract. You would tell the user to send 0 ETH (sending 1 wei might also make sense) to the contract which would then trigger the withdraw function.

contract MyContract {
   uint allTheEth;

   function withdraw()

      // user is sending nothing so they must want to withdraw
      if (msg.value == 0) {
      // sender is sending something so must want to depost
      } else {
         allTheEth += msg.value;
  • Per Lauri's answer above, you don't need to track your balance in allTheEth, right? You can just use address(this).balance ?
    – Rich
    Apr 2 '18 at 0:39
  • @Rich correct, the balance of the contract is just this.balance.
    – Victory
    Apr 2 '18 at 22:44

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.