Getting Started with Geth
Geth is a Go implementation of the Ethereum protocol and is currently one of the more widely used programs in Ethereum DApp development. Let’s take a quick tour on some of its core features.
Make sure you have Ethereum installed on your machine. On MacOS, you can do this by running:
brew tap ethereum/ethereum
brew install ethereum
brew install geth
geth is installed correctly if you’re able to run
When you run
geth for the first time, you’ll notice that it prints a bunch of INFO level logs like this:
geth is basically syncing Ethereum nodes here. This might take a while, but you can go ahead and close it by typing Ctrl-C:
One thing that you’ll soon notice is that all these INFO logs can be pretty chatty and distracting. The is because the verbosity level is set to 3 (INFO) by default. This verbosity flag/value goes from 0 to 6. Here are some examples:
geth --verbosity 0 will look something like this:
geth --verbosity 4 will have output that look more like this:
The stuff we’ve been covering so far involves the main network. If you’re starting to develop decentralized applications, aka DApps, you’ll probably want to test out your smart contracts first on a test network.
There are a few popular test networks out there, including Ropsten and Rinkeby test networks.
geth gives you the option to use either of these networks by appending the
rinkeby command line arguments.
geth --testnet and
Every interface that you do on the main network via
geth can be done on these test networks by just appending the right test network CLI flag.
One of the core features of
geth is the wallet.
You can create multiple accounts on your local node like this:
This will prompt you for a password. Go ahead and type it in then you’re done!
You can also list all wallet(s) stored on your machine like this:
Updating an Existing Account
You can also choose to change your passwords on your account via
geth. Go ahead and run this, and you’ll be prompted for current and new passwords.
Since this can get pretty chatty, I suggest running it with the verbosity flag set to 0 like this:
geth --verbosity 0 console
You can go ahead and query account balances etc. via the console. It’s pretty sweet!
This is very short post on how and what are the core
geth features. There’s also a lot of room for improvement within the Ethereum community such as proper documentation and better/more robust tooling, so feel free to contribute in whatever way you can.
geth is capable of doing much more features that aren’t covered here, but I’ll have some useful links below if you want to challenge yourself and learn more about it.
Go-Ethereum GitHub page: https://github.com/ethereum/go-ethereum