Ethereum 101 - Part I - Introduction
Ethereum is an open source blockchain. It is a transaction based state machine. Starting with the genesis block, transactions are grouped into blocks and are subsequently validated by a group of Ethereum nodes dedicating their resources to solve a complex proof of work puzzle. The decentralized fundamentals of Ethereum ensure that it experiences zero downtime as an immutable public ledger. It is a fault tolerant system, meaning that nodes can drop offline with negligible impact to the security and throughput of transactions on the network. Nodes simply synchronize to the current state upon coming back online.
There has been no shortage of innovative decentralized app development on the Ethereum blockchain. A sample of decentralized apps that have cropped up over the past several years includes, but is not limited to: decentralized exchanges, prediction markets, decentralized support services, open source identity systems, casinos, games, and many others. A quick internet search will return a long list of ongoing, more theoretical work-in-progress decentralized applications, many of which are working to solve real-world problems. For a more curated list, please reference: https://www.stateofthedapps.com/
Developing on the Ethereum Platform
It is relatively easy to establish an Ethereum node, send and receive transactions, trade cryptocurrencies, and bring test environments online, though understanding the moving parts and complexities of such a fledgling technology is a formidable task. The aim of this ETH 101 documentation is to give developers an introductory look at the Ethereum ecosystem, demonstrate how the various clients and environments work together, and in general serve as a springboard into meaningful development.
Basic Decentralized Stack (not an exhaustive list) The above Web3 stack is not an exhaustive list, it includes only applications and concepts that will be touched on throughout this document. Readers are encouraged to perform their own thorough research should they desire more detailed information.
Within the sections of this document, you’ll find technical level details on how to connect to the Ethereum network with the Go-Ethereum client, how accounts and transactions work, options for programming, compiling, and testing smart contracts, and options to help you setup a tailor made development environment. At the end of each section, you’ll typically find a link to official documentation for extended reference. We will begin by completing an exercise demonstrating the power of the Go Ethereum official client and the Mist Wallet.
Kickstarting an Ethereum Development Environment
_This section includes a quick, down to brass-tacks guide on bootstrapping an Ethereum development environment with a Go-Ethereum node and Mist Wallet into existence. _
In fact, it is so simple that we will spin up an introductory development environment to kick off this document. Using your operating system of choice:
- Download and install Go Ethereum (geth) @ https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum
- Download and install Mist Browser @ https://github.com/ethereum/mist/releases
Open a first terminal and enter the following command:
$ geth --dev --dev.period 15 console 2>>eth.log
Immediately take note of the file location of the geth.ipc file as the node spins up in the terminal. On an Ubuntu system it should be located in “/tmp/geth.ipc”.
Open a second terminal and enter the following command to effectively split the ethereum log away from the geth console:
$ tail -F eth.log
Open a third terminal and enter the following command to spin up our Mist ethereum wallet:
$ ethereumwallet --rpc /tmp/geth.ipc
And just like that, you’ve bootstrapped an Ethereum development private node. Let’s take a brief look at some commands that will help you navigate the geth and web3 libraries. Don’t worry, we will review these elements in greater detail later in this documentation. For now, we will take a look at geth’s functionality.
In terminal 1, use the below commands to start and stop the mining process. When we first started the geth node in this terminal, we used the “--dev.period 15” command to instruct the client to mine only every 15 seconds.
miner.start() miner.stop() ` You can try using the Mist Ethereum Wallet to send a few transactions, just make sure to start the miner in order to write the state change to the blockchain.
To recap, above we used the Go Ethereum client and Mist to spin up a quick private development environment. Running a private node is much different than running the full archived geth client, or running a fast or light node.
Official documentation and additional reading:
- Go-Ethereum: https://github.com/ethereum/go-ethereum/wiki/geth
- Mist: https://github.com/ethereum/mist
The Go Ethereum Client
The Go Ethereum client is the official Ethereum client. However, there are other clients supported by various different languages. Selecting a client supported by a language you’re more familiar with may help you more rapidly acclimate to the Ethereum ecosystem.
Go Ethereum, “geth,” is the official implementation of the Ethereum protocol. Throughout this documentation geth protocols and commands will typically be referenced as we walk through various Ethereum methods and processes. It is recommended that the reader builds ethereum using the installation instructions available here: https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum
Above we ran geth in a private local development environment (using “--dev”). Geth is capable of running in different modes (e.g. full nodes, fast nodes, light nodes, private nodes). For all practical purposes described within, a fast-synced geth node will provide you with all the functionality required to create accounts, transfer funds, and deploy and interact with contracts. To run a fast-synced geth node, use the below command:
$ geth --fast --cache=1024
Go-ethereum (Geth) and Parity are generally considered the leading Ethereum clients. However, should you want to utilize an ethereum client employing a different language, the following clients are also available:
|Trinity||Python||Ethereum Foundation / Piper Merriam|
|Quorum||Go (a fork for go-ethereum)||JPMorgan Chase|
Source (has been modified from original source) http://ethdocs.org/en/latest/ethereum-clients/choosing-a-client.html#why-are-there-multiple-ethereum-clients [https://github.com/ConsenSys/ethereum-developer-tools-list#ethereum-clients] (https://github.com/ConsenSys/ethereum-developer-tools-list#ethereum-clients)
This is not an exhaustive list, and some of the clients here have been deprecated or are aging without a strong developer base supporting their ongoing development. With that said, this table shows the level of programming and language diversity within the Ethereum development ecosystem. Perhaps using an Ethereum client in a language that you are more familiar with for your first foray into the ethereum ecosystem would help you acclimate quicker. Ideally, the general pathway is to eventually gravitate towards the clients that have strong foundations and a contributive developer base.