7 Components of Ethereum
Do not miss this exclusive book on Binary Tree Problems. Get it now for free.
In this article, we learn about the 7 different components of Ethereum such as Transactions, Consensus Rules, Consensus Algorithms and much more.
Table of Contents.
- Introduction.
- Summary.
- References.
Introduction.
Bitcoin was created to replace fiat currencies as a form of exchange of value between parties and as a store of value(gold). The bitcoin blockchain tracks the owneship of Bitcoin. It maps Bitcoins on the blockchain to their owners, this is why we can track every transaction that ever occured on the blockchain since its release in 2009. We can think of it as a distributed consensus state machine whereby every transaction causes the global state of the blockchain to change by changing the distributed ledger through change in ownership of Bitcoins.
State transitions of the blockchain are constrained by the consensus rules that allow every participant to converge on a common system state after several blocks have been mined.
Ethereum on the other hand extended blockchain applications to more that just value exchange. Instead os tracking the ownership of currency on the blockchain, it also tracks state transitions of a general purpose data store. A data store holds key-value tuples, the value holds arbitrary values each referenced by a specific key. This is similar to how data is stored on Random Access Memory(RAM) on general purpose computers.
Ethereum stores both code and data and utilizes blockchain technology to track how the memory changes over time. Ethereum loads code onto its state machine, executes the code and stores the resulting state changes on an immutable blockchain just like a general-purpose stored-program computer. The only two features that distinguish Ethereum from a general-purpose stored-program computer are that Ethereum's state is governed by consensus rules and the state is distributed among nodes of the network.
Components of Ethereum.
In the article, on 'an Introduction to Ethereum', we learned about the components that make up a blockchain. In this section we look at the componnets that qualify Ethereum as a blockchain. Remeber not all systems claiming they are blockchains are actually blockchains. Before we decide if a system is a blockchain, it has to satisfy some qualifiers such as openness, accessibility, globality, censorship, decentralization, neutrality, among others.
Ethereum's components include:
- Transactions
- Consensus Rules
- Consensus Algorithms
- State Machine
- Data structures
- Economic Security
- Software Clients
Transactions
We learned that one of a blockchain's components are messages, Ethereum transactions are network messages that have their own components such as;
Sender - the address of the person who initiates a transaction.
Recipient - the address of the person who will recive the Ether sent from the sender's account.
Value - the amount of Eth transfer from the sender to the recipient. This amount is usually in Wei which is a denomination of Eth.
Data - this is an optional field that the sender can use to include any arbitrary data such as an organization name, username, message.
Signature - this is a digital fingerprint of the sender generated when the sender's private key signs the transaction. It acts as proof that the sender indeed initatiated the transaction.
gasLimit - this is the maximum amount of gas units that the transaction can consume. The amount of gas is proportional to the computational steps involved in processing a transaction, the higher the number of steps, the higher the gas needed to process the transaction.
maxPriorityFeePerGas - a priority fee is a fee added to the base fee as a tip to the miner. Miners prefer to process transactions that give a tip rather than those paying the base fee. A transaction with a priority fee is prioritized. This field stores the maximum amount of gas to be included as a tip to the miner.
maxFeePerGas - this is the maximum amount of gas a user is willing to pay to a transaction. It is inclusive of the basFeePerGas and the maxPriorityFeePerGas.
Transactions on Ethereum can be regular - an exchange of value between two accounts, contract - a transaction without a 'to' address, in this case, the data field stores the contract code or contract execution - these transactions interact with the data field of a transaction that stores the contract code.
On Ethereum, transactions can only be initiated by an externally-owned account - an account owned by a user instead of a contract.
Consensus Rules
A blockchain must have consensus rules. These are rules that specify a blockchain's properties and procedures. All miner follow these rules when processing transactions and validating blocks on the blockchain. When the majority of nodes follow these rules, a consensus is reached and the system agrees on a common state. Nodes that fail to follow these rules are penalized and invalidated by the majority of nodes.
For nodes to reach a consensus, majority of nodes individually accept a single data value and do so unanimously.
The consensus rules of Ethereum;
- Achieve consistency of the global state whereby all nodes agree on a common state.
- Determine the validity of blocks and transactions.
- Are enforced by the client software and upheld by all full nodes.
- Invalidate bad actors.
- Are demoncratic and are agreed upon by all involved parties of the blockchain.
Consensus rules in Ethereum allow the blockchain t function without the need for trust between participants.
Consensus Algorithms
Etherum adopted Bitcoin's consensus model referred to as Proof-of-Work. This is whereby miners invest alot of computational resources to try to find a number(nonce) that when combined with the block header and hashed will result in a value less than a specified target. The computations involved here are in the trillions and after every 10 minutes depending on the network's hash power, a new block is mined and the miner is rewarded with Bitcoins or Ether. Ethereum saw this mechanism wasteful in terms of energy consumption because while the miners use alot of electric power to solve the puzzle, only one is selected and the race begins again meaning the rest wasted they energy trying to solve the puzzle. To solve this issue, Proof-of-Stake was inroduced wherby miners, now referred to as validators were selected to mine the next block based on their stake in the blockchain. The stake is the amount of a blockchain's native coins a user holds. The higher their stake, the higher the chances that they will be selected to mine the next block.
Consensus mechanisms ensure that blockchain participants remain honest in all activities relating to the blockchain. They do this through incentivizing good actors and penalizing bad ones. For example a miner is rewarded with the blockchain's native crptocurrency when he/she successfully solves the PoW algorithm or holds a higher stake in the case of PoS, in this case, this miner follows the rules and acts accordingly, on the other hand if the miner tries to change the block transactions he/she will be penalized. In the PoW algorithm, the miner is not incentivized and the block he/she mines is invalidated by all nodes, in the PoS algorithms, the miner looses his/her stake.
Both mechanisms although ensure the security of a blockchain also have downsides, for example, while the PoW is resource intensive, the PoS requires a significant amount of capital for a user to be considered a validator.
State Machine
Ethereum's state transitions are processed by the EVM(Ethereum Virtual Machine) which is a stack-based virtual machine that execute byte code. Smart contracts are the programs that run on this machine. They are written in Solidity - a high-level programming language and compiled into byte code that is executed on the EVM.
The EVM is where all smart contracts and Ethereum accounts are located. Its purpose is to determine the overall state of each block in the Ethereum blockchain.
Ethereum is similar to other blockchains such as Bitcoin, apart from having its own cryptocurrency, it utilizes blockchain technology to maintain a distributed ledger of transactions while enforcing rules on how participants operate on the network.
In addition to this, Ethereum has an additional layer because it adds smart contract functinality. This layer is referred to as a distributed state machine. It is simply a large distributed database storing accounts and balances. Similary, Ethereum's state is also a machine state that changes with each newly mined block.
The consensus rule determine how the machine changes state during block mining.
Data structures
Ethereum's state is stored locally on each node as a database containing transactions and the system state in a serialized hashed data structure referred to as the Merkle Patricia Tree/Trie. This trie also referred to as a Radix/Prefix rtei is the fastest data structure that can be used to find common prefixes. It is simple to implement and only requires small memory.
While Ethereum uses the Merkle tree to store transactions in a block efficiently, the trie is used as the core data structure for data storage on its blockchain. The Merkle Patricia Tree/Trie is also used to derive Ethereum tries such as the world state trie, the account storage trie, receipt trie and the transaction trie.
Economic Security
Ethereum uses PoW and PoS to incentivise miners and blockchain participants. This incentive helps to secure the blockchain from bad actors and at the same time motivates other people to participate in the network.
As Bitcoin rewards are halved every four years, the incentive will decrease until miners will have to rely on transaction fees which are relient on the network activity. Ethereum on the other hand takes a reverse approach to Bitcoin;s incentive model by taking away the transaction fees miners received(EIP-1559) but continue to incelivice miners for mining a block. Ethereum has an uncappend supply unlike Bitcoin's limited one(21 million) and at the same time is resistant to inflation becasue of fee burn.
Software Clients
An Ethereum client is a node that is able to parse and verify the blockchain including transactions and smart contracts. Etherum has several client software implementations such as Aleth/cpp-etherum, Geth, Trinity among others.
Summary.
Ethereum tracks an arbitrary state and programs the state machine to create a world-wide computer that operates under consensus rules. The key things to note is that Ethereum state is goverened by consensus rules and the state is distributed among all nodes of the network.
References.
Sign up for FREE 3 months of Amazon Music. YOU MUST NOT MISS.