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
> 

Building from source an Ethereum node under Ubuntu 16 LTS

The program, which makes an Ethereum node in your computer, is called

geth

. “geth” is written using the GO language and the latest version depends on GO version 1.7+. Ubuntu 16 LTS has GO language package version 1.6 so to build it from source we need first to install a proper version of GO Language.

STEP 1) Install a proper version of GO Language 1.7+

In our tutorial you will install 1.9 using this howto: “Install GO language in Ubuntu 16 LTS from the official site package”

STEP 2) Update your system and install dependencies

sudo apt-get update -y
sudo apt-get install -y build-essential libgmp3-dev git

STEP 3) Get the “geth” code and compile it

git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
make geth

STEP 4) Check is everything is OK, installed geth version 1.8.2-unstable

srv@local:~/go-ethereum$ cd ./build/bin
srv@local:~/go-ethereum/build/bin$ ./geth version
Geth
Version: 1.8.2-unstable
Git Commit: b574b5776695eb30e034fd8c7a468b3f03d4c6b9
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.4
Operating System: linux
GOPATH=
GOROOT=/usr/local/go

* Next tutorial is getting the node up and running here!

* Troubleshooting

  • if you get
    ~/go-ethereum$ make geth
    build/env.sh go run build/ci.go install ./cmd/geth
    build/env.sh: 30: exec: go: not found
    Makefile:15: recipe for target 'geth' failed
    make: *** [geth] Error 127
    

    You did not install properly go, check our manual here: “Install GO language in Ubuntu 16 LTS from the official site package”. Check whether you source /etc/profile in your current ssh/console/login session, check if you exported the PATH, your PATH must include “your_goinstallation_path/bin”, it’s like “/usr/local/go”.

  • if you get
    ~/go-ethereum$ make geth
    build/env.sh go run build/ci.go install ./cmd/geth
    ci.go:190: You have Go version go1.6.2
    ci.go:191: go-ethereum requires at least Go version 1.7 and cannot
    ci.go:192: be compiled with an earlier version. Please upgrade your Go installation.
    exit status 1
    Makefile:15: recipe for target 'geth' failed
    make: *** [geth] Error 1
    

    The installation just uses the default installed GO language of your system, which is 1.6 and is not supported by the “geth” Ethereum program. There are two options:

When we talk for crypto currency the best source is always the GIT version (probably the best one is the stable tag, but it is safe to use the unstable, too), it is most secure source you could get. Do not download from 3rd party sites or unofficial repositories, you could lose your money.

* Here is the building output

srv@local:~/go-ethereum$ make geth
build/env.sh go run build/ci.go install ./cmd/geth
>>> /usr/local/go/bin/go install -ldflags -X main.gitCommit=b574b5776695eb30e034fd8c7a468b3f03d4c6b9 -v ./cmd/geth
github.com/ethereum/go-ethereum/crypto/sha3
github.com/ethereum/go-ethereum/common/math
github.com/ethereum/go-ethereum/rlp
github.com/ethereum/go-ethereum/vendor/github.com/go-stack/stack
github.com/ethereum/go-ethereum/common/hexutil
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/comparer
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/storage
github.com/ethereum/go-ethereum/crypto/secp256k1
github.com/ethereum/go-ethereum/vendor/github.com/golang/snappy
github.com/ethereum/go-ethereum/log
github.com/ethereum/go-ethereum/vendor/gopkg.in/karalabe/cookiejar.v2/collections/prque
github.com/ethereum/go-ethereum/common
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/cache
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/filter
github.com/ethereum/go-ethereum/vendor/github.com/aristanetworks/goarista/monotime
github.com/ethereum/go-ethereum/common/mclock
github.com/ethereum/go-ethereum/event
github.com/ethereum/go-ethereum/crypto/randentropy
github.com/ethereum/go-ethereum/vendor/github.com/pborman/uuid
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/opt
github.com/ethereum/go-ethereum/vendor/golang.org/x/sys/unix
github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/pbkdf2
github.com/ethereum/go-ethereum/params
github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/scrypt
github.com/ethereum/go-ethereum/vendor/gopkg.in/fatih/set.v0
github.com/ethereum/go-ethereum/cmd/internal/browser
github.com/ethereum/go-ethereum/metrics
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/errors
github.com/ethereum/go-ethereum/common/fdlimit
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/iterator
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/journal
github.com/ethereum/go-ethereum/vendor/github.com/hashicorp/golang-lru/simplelru
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/context
github.com/ethereum/go-ethereum/vendor/github.com/hashicorp/golang-lru
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/websocket
github.com/ethereum/go-ethereum/vendor/github.com/edsrzf/mmap-go
github.com/ethereum/go-ethereum/common/bitutil
github.com/ethereum/go-ethereum/vendor/github.com/rs/xhandler
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/memdb
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/table
github.com/ethereum/go-ethereum/crypto/bn256
github.com/ethereum/go-ethereum/vendor/github.com/rs/cors
github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/ripemd160
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/httpu
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/scpd
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/soap
github.com/ethereum/go-ethereum/rpc
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/ssdp
github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify
github.com/ethereum/go-ethereum/vendor/github.com/elastic/gosigar
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html/atom
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/internal/identifier
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/transform
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/internal/utf8internal
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/internal/tag
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/language
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/runes
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/internal
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/charmap
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/japanese
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/korean
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/simplifiedchinese
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/traditionalchinese
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/unicode
github.com/ethereum/go-ethereum/ethdb
github.com/ethereum/go-ethereum/vendor/github.com/jackpal/go-nat-pmp
github.com/ethereum/go-ethereum/p2p/netutil
github.com/ethereum/go-ethereum/eth/tracers/internal/tracers
github.com/ethereum/go-ethereum/vendor/gopkg.in/olebedev/go-duktape.v3
github.com/ethereum/go-ethereum/vendor/github.com/golang/protobuf/proto
github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
github.com/ethereum/go-ethereum/log/term
github.com/ethereum/go-ethereum/metrics/exp
github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-colorable
github.com/ethereum/go-ethereum/vendor/gopkg.in/urfave/cli.v1
github.com/ethereum/go-ethereum/vendor/github.com/prometheus/prometheus/util/flock
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/htmlindex
github.com/ethereum/go-ethereum/les/flowcontrol
github.com/ethereum/go-ethereum/vendor/golang.org/x/sync/syncmap
github.com/ethereum/go-ethereum/internal/jsre/deps
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html/charset
github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-isatty
github.com/ethereum/go-ethereum/vendor/github.com/fatih/color
github.com/ethereum/go-ethereum/vendor/gopkg.in/sourcemap.v1/base64vlq
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp
github.com/ethereum/go-ethereum/vendor/gopkg.in/sourcemap.v1
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/token
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/dbg
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/file
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/dcps/internetgateway1
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/dcps/internetgateway2
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/ast
github.com/ethereum/go-ethereum/internal/debug
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/parser
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/registry
github.com/ethereum/go-ethereum/internal/web3ext
github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner
github.com/ethereum/go-ethereum/vendor/github.com/maruel/panicparse/stack
github.com/ethereum/go-ethereum/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor
github.com/ethereum/go-ethereum/p2p/nat
github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-runewidth
github.com/ethereum/go-ethereum/vendor/github.com/mitchellh/go-wordwrap
github.com/ethereum/go-ethereum/vendor/github.com/naoina/go-stringutil
github.com/ethereum/go-ethereum/vendor/github.com/naoina/toml/ast
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto
github.com/ethereum/go-ethereum/accounts/usbwallet/internal/trezor
github.com/ethereum/go-ethereum/vendor/github.com/nsf/termbox-go
github.com/ethereum/go-ethereum/vendor/github.com/naoina/toml
github.com/ethereum/go-ethereum/vendor/github.com/gizak/termui
# github.com/ethereum/go-ethereum/vendor/gopkg.in/olebedev/go-duktape.v3
In file included from vendor/gopkg.in/olebedev/go-duktape.v3/api.go:7:0:
vendor/gopkg.in/olebedev/go-duktape.v3/api.go: In function ‘_duk_error’:
vendor/gopkg.in/olebedev/go-duktape.v3/duktape.h:510:127: warning: right-hand operand of comma expression has no effect [-Wunused-value]
  (duk_error_raw((ctx), (duk_errcode_t) (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
                                                                                                                               ^
vendor/gopkg.in/olebedev/go-duktape.v3/api.go:153:2: note: in expansion of macro ‘duk_error’
  duk_error(ctx, err_code, "%s", str);
  ^
github.com/ethereum/go-ethereum/internal/jsre
github.com/ethereum/go-ethereum/crypto
github.com/ethereum/go-ethereum/trie
github.com/ethereum/go-ethereum/crypto/ecies
github.com/ethereum/go-ethereum/p2p/discover
github.com/ethereum/go-ethereum/p2p/discv5
github.com/ethereum/go-ethereum/core/types
github.com/ethereum/go-ethereum/p2p
github.com/ethereum/go-ethereum
github.com/ethereum/go-ethereum/core/state
github.com/ethereum/go-ethereum/core/bloombits
github.com/ethereum/go-ethereum/core/vm
github.com/ethereum/go-ethereum/accounts
github.com/ethereum/go-ethereum/ethclient
github.com/ethereum/go-ethereum/accounts/keystore
github.com/ethereum/go-ethereum/accounts/usbwallet
github.com/ethereum/go-ethereum/consensus
github.com/ethereum/go-ethereum/consensus/misc
github.com/ethereum/go-ethereum/dashboard
github.com/ethereum/go-ethereum/whisper/whisperv5
github.com/ethereum/go-ethereum/consensus/clique
github.com/ethereum/go-ethereum/consensus/ethash
github.com/ethereum/go-ethereum/eth/fetcher
github.com/ethereum/go-ethereum/node
github.com/ethereum/go-ethereum/console
github.com/ethereum/go-ethereum/core
github.com/ethereum/go-ethereum/eth/downloader
github.com/ethereum/go-ethereum/eth/filters
github.com/ethereum/go-ethereum/light
github.com/ethereum/go-ethereum/internal/ethapi
github.com/ethereum/go-ethereum/miner
github.com/ethereum/go-ethereum/eth/gasprice
github.com/ethereum/go-ethereum/eth/tracers
github.com/ethereum/go-ethereum/eth
github.com/ethereum/go-ethereum/les
github.com/ethereum/go-ethereum/ethstats
github.com/ethereum/go-ethereum/cmd/utils
github.com/ethereum/go-ethereum/cmd/geth
Done building.
Run "/home/ubuntu/go-ethereum/build/bin/geth" to launch geth.
srv@local:~/go-ethereum$