Send coins in Ethereum network with geth console

Here are the steps needed to make a secure transfer of your funds under linux distro of Ubuntu. To be able to transfer money safely without any 3rd party involved (no online wallet) just funds from your personal Ethereum wallet address on your computer to another Ethereum wallet address we need the official command line interface for running a full ethereum node:

geth

STEP 1) Install and run an Ethereum node with geth

Here you can follow this tutorial – “Running an Ethereum node from source under Ubuntu 16 LTS”.
The Ethereum node must be running and synced with the Ethereum network.

STEP 2) Attach to the console of geth tool

ubuntu@srv.local:~/go-ethereum/build/bin$ ./geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.2-unstable-b574b577/linux-amd64/go1.9.4
coinbase: 0x30d8810bb1a74e808b46788b2316bd93cf056517
at block: 5172179 (Wed, 28 Feb 2018 15:59:17 UTC)
 datadir: /home/ubuntu/.ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

>

STEP 3) Check how many funds you have in your Ethereum wallet address

While you are in the geth console paste the following:

> web3.fromWei(eth.getBalance('30d8810bb1a74e808b46788b2316bd93cf056517'), "ether")
0.105
> 

You can see there are 0.105 Ethers in the Ethereum wallet address 30d8810bb1a74e808b46788b2316bd93cf056517, replace the address with your public address.

STEP 3) Unlock your account

As you remember your wallet private key is encrypted with a password, so before you can use the private key to send funds you must decrypt the key with:

> personal.unlockAccount('30d8810bb1a74e808b46788b2316bd93cf056517', '<your_password>',300)
true

So your key will stay dectrypted for 300 seconds, this is the purpose of the third parameter. It can be omitted.

STEP 4) Send the amount you like to the Ethereum wallet address you like

, BE CAREFUL the operation is irreversible, if you put wrong address or unknown or unexciting one, you’ll lose your Ether coins!!
Every transaction has a cost, which is computed by the miners. That’s why the gas price is dynamic. The price is determined by the miner of a block and it can change from block to block. You can check the gas price here on http://ethgasstation.info. Determining and computing the price in Ether is very difficult there could be at least 3 new howtos about that. The best and the easiest way is just to check a site (like http://ethgasstation.info) for the average gas price in dollars and when executing a transaction of sending Ethereum funds make sure the same amount of Ether in dollars will stay in your wallet address to be used for the gas.

> eth.sendTransaction({from: '30d8810bb1a74e808b46788b2316bd93cf056517', to: '9009a960fb38c379813a4a2e26c5b94909dc8599', value: web3.toWei(0.104, "ether")})
"0x31b4f213f88f2831756bd9cc37b12e80c6dfe413a3b3423659ca91be352961fc"

If you see the transaction ID, it means the you have executed the command successfully and you can check the status of the transaction.

STEP 5) Check the transaction status.

The status of your transaction could be checked in sites offering Ethereum block explorer sites like

https://etherscan.io/

Here is the check URL for our transaction:

https://etherscan.io/tx/0x31b4f213f88f2831756bd9cc37b12e80c6dfe413a3b3423659ca91be352961fc

Here is the screenshot of the status page:

main menu
Transaction details in https://etherscan.io

And verify the other address has the coins:

ubuntu@ip-172-31-30-78:~/go-ethereum/build/bin$ ./geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.2-unstable-b574b577/linux-amd64/go1.9.4
coinbase: 0x30d8810bb1a74e808b46788b2316bd93cf056517
at block: 5195693 (Sun, 04 Mar 2018 15:40:58 UTC)
 datadir: /home/ubuntu/.ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> web3.fromWei(eth.getBalance('9009a960fb38c379813a4a2e26c5b94909dc8599'), "ether")
0.104
>

And how many coins remained at “30d8810bb1a74e808b46788b2316bd93cf056517”:

> web3.fromWei(eth.getBalance('30d8810bb1a74e808b46788b2316bd93cf056517'), "ether")
0.000811

So as you see the Gas was 0.000189 Ethers as you can see in the block explorer page.

Here is the whole output of the “geth” tool:

> ubuntu@ip-172-31-30-78:~/go-ethereum/build/bin$ ./geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.2-unstable-b574b577/linux-amd64/go1.9.4
coinbase: 0x30d8810bb1a74e808b46788b2316bd93cf056517
at block: 5193986 (Sun, 04 Mar 2018 08:48:41 UTC)
 datadir: /home/ubuntu/.ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> web3.fromWei(eth.getBalance('30d8810bb1a74e808b46788b2316bd93cf056517'), "ether")
0.105
> personal.unlockAccount('30d8810bb1a74e808b46788b2316bd93cf056517', '<the_password_of_the_address>',300)
true
> eth.sendTransaction({from: '30d8810bb1a74e808b46788b2316bd93cf056517', to: '9009a960fb38c379813a4a2e26c5b94909dc8599', value: web3.toWei(0.104, "ether")})
"0x31b4f213f88f2831756bd9cc37b12e80c6dfe413a3b3423659ca91be352961fc"
> web3.fromWei(eth.getBalance('30d8810bb1a74e808b46788b2316bd93cf056517'), "ether")
0.000811
> 

Leave a Reply

Your email address will not be published. Required fields are marked *