How do I convert my The DAO tokens into ethers using the withdrawal contract after the hard fork?

in #cryptocurrency8 years ago (edited)

https://ethereum.stackexchange.com/questions/7204/how-do-i-convert-my-the-dao-tokens-into-ethers-using-the-withdrawal-contract-aft/7205

How do I convert my The DAO tokens into ethers using the withdrawal contract after the hard fork?

up vote
11
down vote
favorite
2
The DAO contract was attacked on 17th June 2016 where the attacker drained about USD 50 million worth of ethers using a recursive call vulnerability in The DAO contract code.

The attacker drained the stolen ethers into a few child DAOs and the Robin Hood Group drained the remaining funds into other child DAOs.

A hard fork is scheduled for block #1,920,000 (in around 24 hours time, ~ 23:26 20/07/2016 Australian Eastern Standard Time) to transfer the ethers from The DAO contract and it's child DAOs into a Withdrawal contract.

Once the hard fork has passed, how do I convert my The DAO tokens into ethers?

Update 23:31:30 20/07/2016 AEST

The Withdraw contract at 0xbf4ed7b27f1d666546e30d74d50d173d20bca754 has a balance of 11,597,664.781027947 Ether ($145,318,739.71).

A successful hard fork. Happy Hard Fork Everyone! Good work Devs and other involved.

the-dao
shareimprove this question
edited 1 hour ago
asked yesterday

BokkyPooBah
11k2544

Can you link to the "separate process for purchasers who paid more than 1 ETH per 100 DAOs to get refunded the extra amount paid" – mazzydan 2 hours ago

Will do when we get an update. Moderator, could you please convert the above answer into a comment. Thanks. – BokkyPooBah 2 hours ago
add a comment
2 Answers
active oldest votes
up vote
14
down vote
Notes

This Withdrawal contract only allows the conversion of The DAO tokens (DAO) into ethers (ETH) at the rate of 100 DAOs = 1 ETH.
The way the Withdrawal contract has been coded means that you HAVE to approve the transfer of ALL DAOs in your account, as the Withdrawal contract will only transfer ALL of your DAOs in the one go. If you do not approve all of your DAOs to be transferred, the withdraw() function will throw an error, consuming all the gas specified with the transaction.
Anyone who bought DAOs in the last two weeks of The DAO crowdfunding phase paid more than 1 ETH per 100 DAOs. The amount in excess of 1 ETH per 100 DAOs was stored in The DAO's extraBalance account. The balance of the extraBalance account has now been transferred into a child DAO. There is a separate process for purchasers who paid more than 1 ETH per 100 DAOs to get refunded the extra amount paid (over the 1 ETH per 100 DAOs). This process is not covered in this answer, but rest assured that the developers are trying their best to fairly distribute the excess funds back to the original DAO buyers.
Wait for some time after the hard fork before attempting to convert your DAOs into ETHs. There is no deadline for the withdrawals. The safest thing to do is wait.

Withdrawing Using MyEtherWallet

Go to http://www.myetherwallet.com/#the-dao
Upload / Paste your Keystore file / Private Key to access your wallet.
Press big red button.
Confirm that you are sure you want to withdraw.
Wait a couple seconds and 2 transaction links will appear. Wait about 30 more seconds and check the balance of your account on Etherscan. You should have more ETH and 0 DAO. I (@tayvano) confirmed it worked @ 6:43AM PDT using the MyEtherWallet donation account: http://etherscan.io/address/0x7cb57b5a97eabe94205c07890be4c1ad31e486a8

Withdrawing Using Ethereum Wallet

Make sure that you have downloaded Ethereum Wallet 0.8.1 or later.

The first time you start Ethereum Wallet 0.8.1, select "Yes" to the question "Do you want to activate the chain in which funds linked to the exploit are restored to a contract where they can be withdrawn by The DAO token holders?". You have now made the choice to use the hard-forked Ethereum chain.

If you have not already added a watch on The DAO contract, see The DAO - How to add and watch the DAO contract. This step will give you access to approve the transfer of DAOs to the Withdrawal contract.

Add a watch on The DAO Withdrawal contact. Use the same procedure as in the link directly above, but set:

Contract Name: The DAO Withdrawal
Contract Address: 0xbf4ed7b27f1d666546e30d74d50d173d20bca754
JSON Interface: [{"constant":false,"inputs":[],"name":"trusteeWithdraw","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"mainDAO","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"trustee","outputs":[{"name":"","type":"address"}],"type":"function"}]
23:47 20/07/2016 AEST - I have confirmed that the process below using the Ethereum Wallet works

Approve The Transfer Of Your DAOs To The Withdrawal Contract

Get the account address from which you want to convert your DAOs into ETHs
Under the Wallet menu, select the account from which you want to convert DAOs into ETH.
Double click on the account address and copy the address into your clipboard using Control-C in Linux or Windows, or Command-C on a MacBook.
Get the balance of the account from which you want to convert your DAOs into ETHs
In the Contract menu, select The DAO contract.
Scroll down to the Balance of function under the Read From Contract column on the left.
Paste the address in your clipboard into the owner-address field.
Double click on the Balance displayed and copy the balance into your clipboard using Control-C in Linux or Windows, or Command-C on a MacBook.
Approve the transfer of your account's DAO balance to the Withdrawal contract address
In the Contract menu, select The DAO contract.
Under the Write To Contract column on the right, select the Approve function.
Paste the balance from your clipboard into the amount-256 bits unsigned integer field using Control-V in Linux or Windows, or Command-V on a MacBook.
Enter the Withdrawal contract address 0xbf4ed7b27f1d666546e30d74d50d173d20bca754 in the spender-address field.
Under the Execute from field, select the account from which you want to convert your DAOs into ETHs.
Leave the Send ETHER field as 0.
Click on Execute and enter your account password.
You should get a transaction confirmation message.
Execute The Withdrawal Contract Function

Withdraw ETH from the Withdrawal contact
In the Contract menu, select The DAO Withdrawal contract
Under the Write To Contract column on the right, select the Withdraw function.
Under the Execute from field, select the account from which you want to convert your DAOs into ETHs.
Click on Execute and enter your account password.
You should get a transaction confirmation message.
Wait a short while and your ether balance should update. If not, restart Ethereum Wallet.

Withdrawing Using geth

Make sure that you are running geth version 1.4.10 or later. And run your geth commands with the --support-dao-fork option so that you are on the hard-forked blockchain. For example:

geth --support-dao-fork console
The --support-dao-fork setting is persisted between separate executions of geth, so you only have to specify this parameter once.

Confirm your geth version using

user@Kumquat:~$ geth version
Geth
Version: 1.4.10-stable
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.5.1
OS: linux
Here is the process using geth to convert your DAOs into ETHs for your account {x}.

00:14 21/07/2016 AEST - I have confirmed that the process below using geth works

geth --support-dao-fork --unlock {your account} console
...
Unlocking account {your account}
Passhrase: {enter your passphrase}
// Allow your blockchain to sync

var account = "{your account}";
undefined

var theDAOAddress = "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413";
undefined

var theDAOWithdrawalAddress = "0xbf4ed7b27f1d666546e30d74d50d173d20bca754";
undefined

var theDAOABIFragment = [{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"type":"function"}, {"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"type":"function"}];
undefined

var theDAO = web3.eth.contract(theDAOABIFragment).at(theDAOAddress);
undefined

var approve = theDAO.approve(theDAOWithdrawalAddress, theDAO.balanceOf(account), {from: account});
undefined

eth.getTransaction(approve);
// Repeat the command above until you see that blockNumber is not null

// Wait a few blocks (~ 15 seconds each) for your approve transaction to get mined

var theDAOWithdrawalABIFragment = [{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"type":"function"}];
undefined

var theDAOWithdrawal = web3.eth.contract(theDAOWithdrawalABIFragment).at(theDAOWithdrawalAddress);
undefined

var withdrawal = theDAOWithdrawal.withdraw({from: account});
undefined

eth.getTransaction(withdrawal);
// Repeat the command above until you see that blockNumber is not null

// Wait a few blocks (~15 second each) and check your new account balance
web3.fromWei(eth.getBalance(account), "ether")
11.023456789012345678

Withdrawal Process Explanation

There is a two step process to convert your DAOs into ETHs.

a) Approve The Transfer Of DAOs From The DAO To The Withdrawal Contract

The first step is to approve the transfer of DAOs from The DAO into the Withdrawal contract. This is done by calling The DAO's approve(...) function, listed below:

From The DAO's source code, here is the TokenInterface.approve() function definition:

/// @notice msg.sender approves _spender to spend _amount tokens on
/// its behalf
/// @param _spender The address of the account able to transfer the tokens
/// @param _amount The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _amount) returns (bool success);
Here is the Token.approve(...) function that implements the function defined above:

function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
Once you have called The DAO's approve(...) function, you have created an approval for the Withdrawal contract to transfer your DAOs into the Withdrawal contract.

b) Convert Your DAOs Into ETHs With The Withdrawal Contract

The second step is to call the Withdrawal contract's withdraw() function to transfer DAOs from The DAO into the Withdrawal contract, and for the Withdrawal contract to send your account the equivalent amount in ETH.

Here is the source code for the withdraw() function:

function withdraw(){
uint balance = mainDAO.balanceOf(msg.sender);

if (!mainDAO.transferFrom(msg.sender, this, balance) || !msg.sender.send(balance))
    throw;

}

Source of information

User @lefteris in thedao.slack.com stated that The DAO Withdrawal contract can be found at 0xbf4ed7b27f1d666546e30d74d50d173d20bca754 and the process to convert DAOs into ETHs are the following:

a) call dao.approve("0xbf4ed7b27f1d666546e30d74d50d173d20bca754", dao.balanceOf(youraccount))
b) call withdrawContract.withdraw()

Withdrawal Contract Source Code And Address

The source code for the Withdrawal contract can be found at 0xbf4ed7b27f1d666546e30d74d50d173d20bca754 and is as follows:

contract DAO {
function balanceOf(address addr) returns (uint);
function transferFrom(address from, address to, uint balance) returns (bool);
uint public totalSupply;
}

contract WithdrawDAO {
DAO constant public mainDAO = DAO(0xbb9bc244d798123fde783fcc1c72d3bb8c189413);
address public trustee = 0xda4a4626d3e16e094de3225a751aab7128e96526;

function withdraw(){
    uint balance = mainDAO.balanceOf(msg.sender);

    if (!mainDAO.transferFrom(msg.sender, this, balance) || !msg.sender.send(balance))
        throw;
}

function trusteeWithdraw() {
    trustee.send((this.balance + mainDAO.balanceOf(this)) - mainDAO.totalSupply());
}

}
From The DAO's source code (referenced above), here is the Token.transferFrom(...) function:

function transferFrom(
address _from,
address _to,
uint256 _amount
) noEther returns (bool success) {

if (balances[_from] >= _amount
    && allowed[_from][msg.sender] >= _amount
    && _amount > 0) {

    balances[_to] += _amount;
    balances[_from] -= _amount;
    allowed[_from][msg.sender] -= _amount;
    Transfer(_from, _to, _amount);
    return true;
} else {
    return false;
}

}

Sort:  

Hi all...
There are still 270.000 ETH waiting to be withdrawn by The DAO holders. Many of you dont evenb know you have the balance, please check all your old ETH-dao holding addressess here.... https://refunds.thedao.fund/

If the numbers are not zero, we can recover your funds in 5-10 minutes. You need the private keys and convert DAO to ETH and ETC.

This is the DAO withdraw address ....
https://etherscan.io/address/0xbf4ed7b27f1d666546e30d74d50d173d20bca754

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 62227.11
ETH 2400.78
USDT 1.00
SBD 2.50