Jun 2, 2016

Transfer of "The DAO" tokens from your local wallet to another Ethereum address using geth

Unable to transfer DAO tokens using the Mist Wallet

Fascinated by the idea of a distributed autonomous organization I bought some DAO tokens sending ethereum money to the address 0xbb9bc244d798123fde783fcc1c72d3bb8c189413 as explained by The DAO.
Due to the nice GUI I decided to use the Mist Wallet to maintain my ethereum and to do money transfers. The voting page of the project explains quite well how to configure mist to track your DAO. In combination with the getting started article on howto build your own crypto currency it should be quite clear how to setup the mist wallet and how to transfer DAO tokens to another address. However for the time being it does not work on my mac with mist wallet 0.7.4. The wallet simply hangs when doing the transfer.

Falling back to the command line

As an alternative it is also possible to use the command line tool geth to do the transfer. If you have not yet installed it you can follow the instructions on the geth github page.
The following steps need to be performed in order to transfer The DAO tokens from your local wallet to another address (e.g. on the poloniex exchange):
  1. First create a file with the name password containing the password of your ethereum wallet followed by a newline:
    $ vi password
  2. Open a terminal and unlock your local wallet. Note that the hex address in the following example should be the address of your local wallet account.
    $ geth --password password --unlock 0x0df977bb21cf972a538187f72299614121549450
  3. In another terminal attach to the running geth instance.
    $ geth attach
  4. The command opens an interactive shell. In this shell define a variable that holds the ABI of The DAO by pasting the json content (do not add quotes) from the following address: https://gist.github.com/fivedogit/4f3e9a035262b99b2e7356a4fdf6dd34
    $ var abi = <pasted json content>;
  5. Define the contract using the fixed The DAO address
    $ var contract = web3.eth.contract(abi).at("0xbb9bc244d798123fde783fcc1c72d3bb8c189413");
  6. Check the balance of your DAO tokens in your local wallet. If you have tokens associated with your ethereum address the value should be greater than 0. Note that the result must be devided by 10^16.
    $ contract.balanceOf("0x0df977bb21cf972a538187f72299614121549450")/10000000000000000;
  7. Now in order to transfer the tokens to a poloniex deposit address first login and identify the address in the balances section of your poloniex account by clicking Deposit in the line for DAO. For this example we assume a deposit address of 0x8686c1799fad1a10f044b64533ecf0200416fc50.
  8. Execute the following command to transfer 14000 tokens to this address.
    $ contract.transfer("0x8686c1799fad1a10f044b64533ecf0200416fc50", 140000000000000000000, {from:"0x0df977bb21cf972a538187f72299614121549450"});
  9. Recheck that your balance is now 0
    $ contract.balanceOf("0x0df977bb21cf972a538187f72299614121549450")/10000000000000000;
  10. It can take about an hour until the tokens are transferred.
  11. After you are done do not forget to remove the password file
    $ rm password

No comments: