Geth Balance Transfer

jalthagejalthage Member Posts: 15
Can someone please provide a step by step guide to how to get my current ether balance from my geth wallet, to my new wallet? Super guide for dummies would be awesome.
I'm clearly no good at using the cmd prompt and I don't want to lose that ether.
Thank you!

Comments

  • erstwealerstweal MidwestMember Posts: 118 ✭✭
    By geth wallet I will assume that you mean the account created on your local computer made when you first did “geth account new”.

    This is all from an Ubuntu perspective, so if you’re using Windows, you’ll need to adjust a bit.

    A couple things to keep in mind:

    Your address is associated with a keystore that is on your machine. The keystore in combination with your password will allow you to unlock your account so that you can send transactions.

    From what I can tell, this whole deal works with units called wei instead of ether, which you might find surprising since we are ethmining. You will probably want to use ether as a unit since we can understand it more. There are functions to convert from wei to ether (web3.fromWei) and from ether to wei (web3.toWei) which I’ll use below.

    You need to be careful when you do cut and paste with anything that uses “ and ‘ because they don’t always come across the same way. For some reason, my computer likes to change them to different versions of apostrophes and such. Whenever I cut and paste, I go back and re-type the “ so that it comes out.

    You need to unlock your account before you can actually send anything out.

    I generally use geth attach to send ETH out, but there are other ways as well. You need to have geth running in another terminal window already.

    From Ubuntu prompt:~$ geth account list

    This tells you your accounts, presumably you have just one, but you can have several if you want.

    Below is a transfer I made:

    :~$ geth attach
    Welcome to the Geth JavaScript console!

    It will list a few lines of information, including your account number here. If your account number which is called coinbase. If that is what you expect, then you are all set.

    This will give you your balance (in units of ether)

    > web3.fromWei(eth.getBalance(eth.coinbase),"ether")

    1.35822727

    First I try to send, but it says that the account is not unlocked.

    > eth.sendTransaction({from: eth.coinbase, to: "0x8F3e5B7c30BA103e4d1a78312B7c53eeAD726e01", value: web3.toWei(1.00, "ether")})
    Error: authentication needed: password or unlock
    at web3.js:3104:20
    at web3.js:6191:15
    at web3.js:5004:36
    at :1:1

    This command unlocks the account. It prompts for the password which you type in without seeing it. The true means that it accepted the password. If you fail, try it again, but be more careful.

    > personal.unlockAccount("e451e767bed70ba82dccaeaabc38d3258cce5b8f")

    Unlock account e451e767bed70ba82dccaeaabc38d3258cce5b8f
    Passphrase:
    True

    This time the transfer will work and it gives you a long transaction number that you can track to see the transfer go through.

    > eth.sendTransaction({from: eth.coinbase, to: "0x8F3e5B7c30BA103e4d1a78312B7c53eeAD726e01", value: web3.toWei(1.00, "ether")})
    "0x6f1cbb8fcda869b7a90f4072a14f4................4fe226d4cfc5cdd510"

    Feel free to message if you run into problems.
  • CodeCryptorCodeCryptor Member Posts: 10
    Well written reply @erstweal . I had my concerns about this same issue and you have answered them precisely in easy to understand terms. Good job mate.
Sign In or Register to comment.