In this article, we will introduce a permissionless blockchain implementation called Ethereum. The chapter will cover the core features of Ethereum platform, how to setup a local instance of Ethereum, deploy smart contracts and build an end-to-end sample application.
As per the Ethereum website –
“Ethereum is a decentralized platform that runs smart contracts, applications that run exactly as programmed without the possibility of downtime, censorship, fraud or third party interference.”
Let’s understand this definition in a detail by understanding the terminology and core features of an Ethereum platform.
Core Features Of Ethereum Platform
In this section, we will talk about the core features of the Ethereum platform.
Application
An application in an Ethereum platform is referred to as a DApp (decentralized application). The DApp typically comprises of a frontend and a backend code. The frontend code is developed using programming languages like JavaScript. The frontend code communicates with the backend code on the blockchain network. The backend code is referred to as a smart contract and is typically developed using a higher-level language like Solidity. The smart contract runs on the decentralized Ethereum network. The DApp maps to the application layer of our reference architecture.
Note – The frontend part of the DApp does not run on Ethereum network. So in an Ethereum context, a DApp could be simply referred to as the smart contract running in the Ethereum network.
Smart Contract
We had described smart contract earlier in Chapter 1. Smart Contract defines and executes transactions in the form of a software code. It comprises of operations that act on the state of the blockchain.
This smart contract acts as a digital contract, which can be used to move value and ownership of assets between parties in a given network or across networks. These contracts can be between a consumer to consumer – like a wire transfer between individuals using their cell phones without any intermediary, a business to business – like a trade finance contract where multiple parties are involved viz. exporter bank, importer bank and shipment vendor, a business to consumer – like an insurance or a health contract which rewards people for their good health behaviors or even between system to system – which enables system to work in a secure and autonomous way, for instance, a contract that defines whether a new device can connect seamlessly to your connected home.
The smart contract in an Ethereum network runs inside an Ethereum Virtual Machine (EVM) and its available on every node in the Ethereum network. Every node has the same copy of the smart contract and runs the same code/logic. We would go through the process of developing and deploying a smart contract during the course of this chapter.
The Smart contract maps to the smart contract layer of our reference architecture.
Note – Solidity is compiled into bytecode that is executed on EVM.
Ether And Gas
To run applications on the public Ethereum blockchain network, you need ethers. Ether is a form of payment – a digital fuel that client applications need to pay in order to deploy the smart contract and execute its operations. Each operation requires some computation; this computation work is referred to as a gas. Different operations require different gas units, which is auto calculated by the system. Based on the gas required, the client needs to pay the appropriate ethers. Think of ether being paid for a gas, as a software service fee for executing the code on the network.
Note – Ether is a form of digital currency, similar to Bitcoin. But instead of using ether as a market currency, the design of Ethereum platform uses ether as a means to run the decentralized applications.
Ethereum Wallet
The Ethereum Wallet allows you to hold and secure ethers and other crypto-assets created on Ethereum. It also allows you to write, deploy and use smart contracts. We would soon see Ethereum Wallet in action as part of our sample application demonstration. The Ethereum Wallet can be mapped to the application layer of our reference architecture, which provides a capability to interact with our Ethereum network.
One important point is to understand how consensus is reached across the Ethereum network and data (i.e., blocks) committed to Ethereum. In the next section, we will talk about this in detail.
Please note, the Ethereum Wallet is deprecated and you can similar alternatives like Mycrypto ( https://download.mycrypto.com/).