Everything you need to know about Ethereum blockchain network
April 29, 2023
Ethereum is the second blockchain developed after the Bitcoin blockchain's popularity. Like Bitcoin, Ethereum is a decentralized, open-source blockchain with the additional functionality of smart contracts. But before discussing the Ethereum blockchain, let us first understand the need for a second blockchain network.
Why was another blockchain network needed?
The most significant reason behind building the Ethereum networks was that the developers were inspired to build a blockchain that is not specific to only one purpose (like Bitcoin could provide payment alternatives) and could be used to build different applications.
Ethereum was built to overcome several challenges and inefficiencies faced by the Bitcoin blockchain network, such as:
- Bitcoin, whose sole purpose was to transfer a digital cryptocurrency, Ethereum was developed to build a blockchain that is not specific to only one purpose, i.e., payment alternative, and could be used to build various applications.
- Ethereum aimed to solve the mining inefficiency by using a different consensus algorithm. The Bitcoin network, developed on the Proof of Work (POW) consensus algorithm, is energy inefficient.
- The Proof of Stake (POS) consensus mechanism is used in Ethereum architecture to replace energy-intensive Proof of Work (POW).
NOTE: When writing this blog, Ethereum is still using a Proof of Work algorithm called Ethash. But there is a plan to move to the Proof of Stake algorithm called Casper at some point in the future.
Understanding why the need for a second blockchain arises, let us understand the Ethereum blockchain in detail.
Ethereum Blockchain Network
Ethereum was developed in 2013 by a 19-year-old college student Vitolik Buterin as part of his college summer project. Ethereum raised USD 18 million through an initial coin offering, and recently, its market capitalization was USD 70 billion. Ethereum is often described as blockchain 2.0.
Today, Ethereum hosts more than 90% of the new tokens on its platforms. The point to note here is that Ethereum was the first blockchain in the world to successfully implement the concept of Smart Contracts, which allowed users to create distributed apps (Dapps) over the Ethereum blockchain network.
What is Ethereum?
After understanding the need and history of the Ethereum network, let us understand what Ethereum is from a general perspective.
The Ethereum blockchain is essentially a transaction-based state machine. In computer science, a state machine refers to something that will read a series of inputs and, based on those inputs, will transition to a new state. The Ethereum blockchain starts from the Genesis state and changes after every transaction. Refer to the diagram shown below.
Every transaction happening in the system changes the state of the machine. E.g., the system was initially in Genesis state (this is the starting state of the Ethereum blockchain), and then the transaction \(T_1\) happens in the system, and the state of the system changes to \(S_1\). This process continues, and the state of the system keeps on changing.
In today's real world, two things change if a typical $5 happens between two parties. First, the location of the money. Earlier, it was in the sender's pocket, but now, it is in the receiver's pocket. And second, ownership. Earlier, $5 was owned by the sender, but now the receiver.
This is precisely what state machine goals to achieve. Ethereum attempts to build the same type of state machine system for digital assets instead of offline transactions.
The similarity of Ethereum with the Bitcoin network
The architecture of Bitcoin and Ethereum are similar as both networks are built using blocks that connect to create a blockchain. Both blockchains offer anonymous transactions, and a central authority like a bank or government controls neither.
But one big difference is that unlike the Bitcoin network, which follows the UTXO (Unspent Transaction Output) model and stores everything on the chain, Ethereum stores all accounts off-chain.
Confusing, isn't it? If Ethereum accounts are stored off-chain, then how the immutability of the network will be ensured?
This list of all accounts defines the state of Ethereum at that moment. Whenever a transaction occurs between two accounts, the state of those two accounts changes, and this new state now becomes the current state of Ethereum. The transactions are stored on the blockchain, thus ensuring the immutability of the accounts stored in off-chain states.
We will be revisiting and will do a deep dive into understanding the transaction model in the Ethereum network after understanding the "Ether" and "Gas" concepts.
Ether
Ether is the primary internal currency used in the Ethereum blockchain network. Ether's purpose, unlike Bitcoin, is to pay transaction fees to the miners. In other words, Ether is a form of payment made by the platform's clients to the machines executing their requested operations. Don't confuse this with transaction fees and rewards. These are two separate entities.
A miner is rewarded when its block gets selected in the blockchain. Additionally, a miner is rewarded for successfully mining the block and receives a transaction fee for each transaction it mines. Rewards are given by the blockchain, while the transaction fee is paid by the user who performed that transaction. Compared to Bitcoin, the rewards in the Ethereum network are much lesser as Ethereum is meant to be a fee-processing system instead of a store of value.
Ethers are available in unlimited quantity compared to bitcoins which are 21 million. But in a month, only 18 million ethers can be produced.
As the Ethereum network becomes more complex and more and more users join the network, the Ether issuance rate will go down because of the limited production of ethers in a month and will reach the value of 0. This means the reward of Ether will become 0 eventually. This is done intentionally as creators want to encourage developers to move from the POW mining model to the POS mining model.
Let us look at an example to understand how rewards and transaction fees are involved in a transaction in the Ethereum network.
Understanding with example
Suppose you need to send some money to your friend. Then you are the person making the transaction. Now, if you want your transaction to be processed/mined, you need to pay a transaction fee to the miner who is processing the transaction and putting it in its block. In Bitcoin, there is no standard logic to calculate the transaction fee, and it is at the sender's discretion how much transaction fee they want to pay. She can even choose to pay no transaction fee at all.
But Ethereum has a defined process to calculate the transaction fee. The current Ether reward for mining a block is 2 Ethers. Hence, on mining a block, a miner receives 2 Ethers + the transaction fee for each transaction in the block.
Let us next understand "Gas" as this is the concept used for calculating the transaction fee.
Gas
The transaction fee is calculated by measuring the computational power a miner spends running that transaction. These computational cycles are measured in a unit called Gas.
By introducing the concept of Gas, the Ethereum network works as a defense mechanism from spam attacks since there is a monetary value involved in performing computation on the network, which makes carrying out malicious operations expensive.
In other words, Gas is the unit used to measure the fees required for a computation. Each Gas the miner spends to run a transaction is paid in Ethers. This is called the Gas Price.
So, gas price is the number of Ethers paid per unit of Gas the miner spends for a transaction. The sender of the transaction pays this gas price to the miner. Gas price is measured in the unit Gwei.
Just like Bitcoin, Ether also has multiple denominations. The smallest unit in Ether is Wei.
1 Gwei = \(10^9\) Wei.
1 Ether = \(10^{18}\) Wei.
Now, there needs to be a check-in place such that the miner does not use more Gas than required. For this, there is a Gas Limit. The Gas Limit for a transaction is defined as the maximum amount required to run a transaction.
Hence, the transaction limit = Gas Limit x Gas Price.
A standard ETH transfer requires a gas limit of 21,000 units of Gas. The more complex the commands you want to execute, the more Gas you have to pay.
This transaction limit is the maximum amount the sender would need to spend to run a transaction successfully. The system deducts this amount from the sender based on the amount of Gas consumed in the transaction.
Can one speed up the transactions in the Ethereum network?
The simple answer is YES. One can speed up the network's transaction process by offering higher gas prices. The reason is simple. Miners will work on transactions that offer higher gas prices as the transaction fee goes straight to the miners. Therefore, they will be incentivized to prioritize transactions with higher Gwei. This is handled using the prioritization levels. There are three types of prioritization levels:
- SafeLow (<30m)
- Standard (<5m)
- Fast (<2m)
NOTE: The gas price changes for each set of prioritization levels. The details for the acceptable gas price can be found at https://ethgasstation.info/.
If one wants their transaction to be executed faster, one must be willing to pay a higher gas price. Based on the prioritization level, one must pay extra Gwei if one wants to execute a transaction at a "fast" prioritization level and for the transaction to be finalized within 2 minutes. It all depends on the urgency.
Who decides the gas limit for the transactions?
The sender sets the gas price and Gas limit for every transaction. The sender sends the maximum amount of Gas that could be used - gas limit - along with the transaction. And as the operations are performed for a particular transaction, the Gas keeps getting consumed.
If excess Gas remains, it is returned to the sender. And if all the Gas is consumed before the transaction is completed, the transaction fails due to the shortage of Gas, and no Gas is returned to the sender. Hence, the calculations to gauge how much Gas would be needed for each transaction need to be done correctly, or else your transaction will fail, and you will also lose the Gas that you sent with the transaction.
Before we dive deep into the transaction model in the Ethereum network, let us understand the different types of accounts available. This will help us further understand transactions on the Ethereum network.
Accounts in the Ethereum network
Accounts in Ethereum are stored in a global 'shared state' in the form of key-value pairs. A shared state primarily means that the values of all the accounts are stored off the chain, unlike Bitcoin, where the values of the account are stored on the blockchain.
The list of all these key-value pairs representing accounts defines the state of Ethereum at that point.
Types of Account
There are two types of accounts in Ethereum:
- Externally Owned Accounts (EOA): these are controlled by private keys and have no code associated with them. An externally owned account may be owned by a person or an external server and connects the Blockchain to the external agents.
- Contract Accounts (CA): these are controlled by their contract code and have a code associated with them. Any person or external agent does not own contract accounts, and their primary purpose is to store contract codes. CA accounts are further divided into two different accounts:
- Simple account: Only one account holder creates and owns the account.
- Multisig account: A Multisig Wallet has several owners for the account, out of which one will be the account's creator.
Structure of Ethereum Accounts
The key is a 20-byte string in a key-value pair, usually the account's public key. Value, on the other hand, represents the state of the account. Value is a structure with four values regardless of the type of account, defined as follows:
- Nonce: If the account is externally owned, this number represents the number of transactions sent from the account’s address. If the account is a contract account, the nonce is the number of contracts created by the account.
- StorageRoot (Storage Hash): This is a hash of the root node of a Merkle tree that encodes the hash of the storage contents of an account.
- codeHash: This is the hash of this account's EVM (Ethereum Virtual Machine ) code. For contract accounts, this is the code that gets hashed and stored as the codeHash. For externally owned accounts, the codeHash field is the hash of the empty string. Therefore all externally owned accounts have the same empty string codehash.
- Balance: This is the number of Wei owned by an address. There are 10^18 Wei per Ether.
The primary difference between EOA and CA accounts is their use in the network. EOA can only trigger transactions, and CA can never trigger a transaction.
Transactions supported between different types of Ethereum accounts
Transaction between two EOA accounts
An EOA can send transactions to other EOAs, by creating and signing a transaction using its private key, called a "value transaction."
This transaction is primarily the transaction of ethers from one EOA to another EOA account.
Transaction between two EOA to CA account
Another type of transaction is between EOAs and CA accounts by creating and signing a transaction using its private key. This type of transaction called a "message call transaction" triggers the code or function available in the CA account.
A transaction (also referred to as a message) from an EOA to a CA activates the CA’s code, allowing it to perform various actions (e.g., transfer tokens, write to internal storage, mint new tokens, perform some calculations, create new contracts, etc.).
Transaction between two CA accounts
The last and final type of transaction is between two CAs accounts. Unlike EOAs, CAs cannot initiate new transactions on their own. Instead, CAs can only fire transactions in response to other transactions they have received (from an externally owned account or another contract account).
An action on the Ethereum blockchain is always set in motion by transactions fired from externally controlled accounts. This is primarily to exchange messages between two CAs accounts.
Let us revisit the transaction model in the Ethereum network and understand it in detail.
Revisiting the transaction model in Ethereum
As we have discussed earlier, whenever a transaction occurs in the network, the state of Ethereum changes. Based on the different types of accounts that we have discussed above, there are three types of feasible transactions in the Ethereum network:
- Message Calls: These are the internal transactions from EOA to CA or from one CA to another CA. When one contract sends a message to another, the associated code on the recipient contract account is executed.
- Value Transfer: Transfer from one EOA to another EOA.
- Contract Creation Calls: Transaction is initiated by EOAs, and the recipient's address is kept empty. Such transactions create a new contract account and are used to create and install new Ethereum contracts.
Let us understand step by step process involved while carrying out transactions in the Ethereum network.
Transaction structure in the Ethereum network
The following values are encoded:
- The recipient address: The account address to which the transaction is being sent.
- The sender signature: Data that identifies and authenticates the transaction’s sender.
- The transaction value: The amount of ether to transfer from the sender to the recipient. This amount may be zero.
- The gas limit: The maximum amount of Gas consumed by the transaction.
- The gas price value: The amount the sender will pay for each gas unit.
- The nonce – A sequence number called a nonce. The sequence number is per sender and must match exactly the following available sequence number.
- The data: Optional arbitrary binary data. During contract deployment, this is where the contract’s bytecode is sent. When calling a function on a contract, this specifies which function should be called and with what arguments. For simple ether transfers, the transaction's data portion is typically omitted.
The top three values (recipient address, sender signature, and transaction value) are the same for almost every blockchain. However, gas limit and gas price value is specific to the Ethereum blockchain.
Further, having nonce and cryptographic signature data in a transaction guarantee that only authorized transactions are performed.
Checklist before executing the transaction
Let us start by defining the checklist that has to be followed before carrying out transactions in the Ethereum network. A transaction has to go through the following checks before being executed:
- First, the Ethereum blockchain checks to see if the transaction contains all the data as discussed in the "Transaction structure in the Ethereum network" section.
- The validity of transaction nonce is checked. Recall that the nonce of an account is the count of transactions sent from that account. A transaction nonce must be equal to the sender account’s nonce to be valid.
- The sender’s account balance must have enough Ether to cover the 'upfront' Gas cost the sender must pay.
- The transaction’s gas limit must be equal to or greater than the intrinsic Gas used. The intrinsic Gas includes:
- A predefined cost of 21,000 gas for executing the transaction.
- A gas fee for the data or code sent with the transaction.
- If the transaction is contract-creating, an additional 32,000 gas will be sent.
If the transaction meets all of the above requirements for validity, we move on to the next step, which is the execution of a transaction.
Process in executing a transaction
By now, we have understood the technical details behind a transaction and what data is required to carry out the transaction. Now, let's discuss the process or how a transaction on Ethereum is executed.
Ethereum paper provides a simplified graphic about how the transaction works and changes the machine's state. A transaction goes through a series of steps before being completed:
- Firstly, the upfront cost of executing a transaction is deducted from the sender’s balance.
- Then, the nonce of the sender’s account is increased by 1 to account for the current transaction.
Once the above two steps are performed, the transaction starts executing.
- Throughout the execution, Ethereum keeps track of the 'substate,' which is a way to record information accrued during the transaction that will be needed immediately after the transaction is complete. Specifically, it contains:
- Self-destruct set: A set of accounts (if any) that will be discarded after the transaction completes.
- Log series: Archived and indexable checkpoints of the virtual machine’s code execution.
- Refund balance: the amount refunded to the sender's account after the transaction.
- The various computations required by the transaction are processed.
Once all the steps required by the transaction have been processed and assuming there is no invalid state, the state is finalized as:
- Firstly, the state is finalized by determining the amount of unused Gas to be refunded to the sender.
- The sender also refunds some allowance from the 'refund balance.'
With this, the transaction gets executed successfully, and the machine's state is changed to the new state.
Having an understanding of how the transaction works, let's move forward and understand how blocks are created out of the transactions carried on the Ethereum network.
Block Anatomy
All transactions are grouped together into 'blocks'. A blockchain contains a series of such blocks that are chained together. A block consists of:
- Block header
- Transactions included in that block
- Ommers block headers
A block header in Ethereum is quite similar to a block in Bitcoin, and apart from components like Parent Hash, nonce, difficulty, mix hash, and Timestamp, it also contains Gas used to mine that block and the Gas limit defined for that block. Let's look at a diagram explaining block structure in the Ethereum network.
As shown in the diagram above, all the transactions are stored in the body of the block. Further, every block header also contains three important Trie structures.
NOTE: A Trie data structure is used for storing and retrieval of data and the same operations could be done using another data structure which is Hash Table but Trie can perform these operations more efficiently than a Hash Table.
Let's explore them next: Merkle root of the current state of all the accounts
- State Root: The state of Ethereum is a collection of key-value objects representing accounts. It is the Merkle root of all the accounts at that moment. In simple terms, all the key-value pairs which represent accounts together form a Merkle tree, and the root of that Merkle tree is known as the state root.
This state root is captured by a block at the time of its creation. If someone tampers with the data, then that user would have to calculate the Merkle root all over again such that the Merkle tree root matches the state root in the block. This is highly impossible and, hence, maintains the immutability feature of the blockchain.
- Transaction Root: Similar to state root which represents the root of the accounts, the Merkle root of all the transactions mined in that block is also stored as transaction Root.
- Receipt Root: It represents the Merkle root of the receipts for all the transactions in that block. We will be discussing receipts later in the post.
Along with other data, the state root, the transaction root, and the receipts root are also used to capture the state of the network in every block. Hence, we can conclude that Ethereum captures the network state every time a new block is created, and it captures the network state by calculating and storing the above three roots in the created block.
These three roots together define the state of the Blockchain network at any given time. Whenever a new block is created, the network state is captured using these three roots. Hence, we can say that at the creation of every new block, the network state changes, and the new state is defined by the state Root, transaction Root, and receipts Root at that instance.
The network state in Ethereum is captured every time a block is created and since the block creation rate in Ethereum is approximately 15 seconds, we can say that the network state is captured every 15 seconds in Ethereum.
Ommer Blocks
We have seen earlier that, apart from headers and transactions, every block will also have the header of the Ommer block. The natural question is, what are Ommer blocks?
The way Ethereum is built, block times are much lower (~15 seconds) than those of other blockchains, like Bitcoin (~10 minutes). This enables faster transaction processing. However, one of the downsides of shorter block times is that more competing block solutions are found by miners. These competing blocks are also referred to as 'stale blocks' (i.e., the mined blocks do not make it to the main chain).
These stale blocks which couldn't make it to the main chain are called the Ommer blocks and their header are put inside the header of the Ommer block section of the main block (In the diagram shown below, the headers of Ommer block C2 and D2 will be added to the C3 block).
An Ommer or uncle block will further have a parent which is equal to the current block’s grandparent. In the diagram shown above, it will be the A1 block which will be the grandparent to the C3 block and B2 will be the parent.
Ommer blocks concept was introduced to enhance the security of the chain and reward the miners. An important thing that differentiates Ethereum from Bitcoin is the Ommer rewards. Unlike Bitcoin, Ethereum also rewards people for creating Ommer blocks; however, the rewards for Ommer blocks are much less compared to the rewards for creating the main block.
Receipts and Logs
As we have seen earlier in the post, when a transaction is sent by an EOA and ends up being committed on the blockchain, the Ethereum blockchain issues something called Receipts. It is essentially some sort of process that is undergoing inside of Ethereum that lets the sender of the transaction know that it is mined and put on the blockchain. Each receipt contains certain information about the transaction such as:
- Block number
- Block hash
- Transaction hash
- Gas used by the current transaction
- Cumulative gas used in the current block after the current transaction has been executed
- Logs created when executing the current transaction etc.
Logs are the special property that is created inside of Ethereum Receipts. It is triggered because of a process available inside of Ethereum called Events. Ethereum transactions or smart contracts can actually trigger events as part of executing the smart contract function. When events are triggered they produce logs. A series of such logs are included inside of receipts that are generated when the transaction is committed onto the blockchain.
Ethereum also has logs to make it possible to track various transactions and messages. A contract can explicitly generate a log by defining the 'events' that it wants to log. A log entry contains:
- Logger’s account address
- Series of topics that represent various events carried out by this transaction (We will look at topics when we will be discussing smart contracts)
- Any data associated with these events
Logs stored in the header come from the log information contained in the transaction receipt.
We have covered a lot so far. Let's move to the last missing bit in the Ethereum Network called as the consensus algorithm.
Consensus in Ethereum blockchain - Proof of work
A consensus algorithm is a procedure through which all the peers of the Blockchain network reach a common agreement about the present state of the distributed ledger. In this way, consensus algorithms achieve reliability in the Blockchain network and establish trust between unknown peers in a distributed computing environment.
Ethereum blockchain as of today is using the POW algorithm as a consensus algorithm. In the POW algorithm, the miner needs to calculate a hash that is lower than the difficulty level defined by the system, and the first miner to find such hash is declared the winner, and its block is accepted.
But this is a highly computational problem, regular people cannot become miners as they don’t have the machines required to compete with some big miners in the Bitcoin network, who are equipped with very powerful machines. So, to make mining fair and give everyone a chance, Ethereum made its mining process highly I/O intensive. This is done with the help of DAG (Directed Acyclic Graph) - a very big file that is passed along with the block as input to the hashing algorithm - Ethash.
This DAG requires decent memory size, thus making the entire hashing process CPU-based rather than GPU-based. Thus, anyone with a memory big enough to hold the DAG can now fight to mine the block. And this is the reason why Ethereum has a 15-second block creation rate as compared to 10 minutes in Bitcoin. The computations in Ethereum when mining a block are highly I/O intensive and, thus, the blocks are mined much faster. Next, let's look at how DAG forms an important component in the Ethash algorithm.
DAG - Directed Acyclic Graph
DAG stands for Directed Acyclic Graph. In Ethereum, a DAG is a large dataset that is sent as input to Ethash, which is the hashing algorithm used for mining in Ethereum. DAG is introduced to keep the mining process fair by making the entire mining process highly I/O-intensive rather than computation-intensive. Because of this, anyone can mine a block in Ethereum, unlike Bitcoin, where mining is highly computation-heavy and large mining groups with extensive machines have a huge advantage over normal users like us.
The DAG’s initial size was 1 GB, and it changes at every Epoch. When 30,000 blocks are mined, it is said to be one Epoch. In other words, an Epoch is a cycle of 30,000 block creations. After every Epoch, the DAG's size increases by 72% and the size of DAG has now crossed 3 GB.
Bonus Topic: What are forks in the Ethereum blockchain?
Forks in blockchain are points where the Blockchain splits into multiple chains. There are two types of Forks in Ethereum:
A soft fork is a fork that gets created as a result of multiple blocks being created at the same time. But as the chain moves forward and a dominant chain is chosen, other chains become sort of irrelevant. A soft fork can still work with older versions.
A hard fork is a fork that is intentionally inserted. It divides the blockchain into two separate chains. Both are dominant chains, and some people work on one chain while some people work on the other. A hard fork is generally a change to a protocol that renders older versions invalid. If the older versions continue running, they will end up with a different protocol and with different data than the newer version. This has happened in Ethereum and, as a result, there are two separate chains in Ethereum: Ethereum and Ethereum Classic.
Challenges for Ethereum
Before answering this let's first understand what is Turing complete.
Is Ethereum a Turing complete system?
Turing completeness is a property of a computational system that states that the system is as computationally powerful as a Turing machine. It basically means everything that needs to be computed can be computed using that machine. So, if somebody says 'My new thing is Turing Complete', it means that in principle (although often not in practice), it could be used to solve any computation problem.
C, C++, Java, JavaScript, Python, etc. are examples of Turing's complete programming languages. On the other hand SQL, and HTML are examples of 'not Turing complete' languages.
Consider an example, where we want to do simple computation 2+2 and this cannot be done with HTML as it is a specific language meant to create a DOM of the page. Similarly, SQL is a language that is meant to fetch and update the database hence making them not Turing complete. Ethereum is a Turing complete system hence giving an opportunity of performing any sort of computation which is possible, unlike Bitcoin which is a non-Turing complete blockchain.
Having an understanding of what Turing's complete system is, let's go forward and understand the challenges in the Ethereum network.
Issues faced in the Ethereum network
Ethereum currently faces the following main challenges:
- Scalability/Throughput: The number of Transactions Per Second (TPS) in Ethereum is much lower than the TPS for other payment alternatives like Visa.
- Cost: As you saw earlier, the mining process in Ethereum is expensive, and the variable value of the Gas price adds to the trouble.
- Decentralization: In Bitcoin, 5 miner groups together control 61% of the network. This violates the base of the Blockchain, which is decentralization because these 5 minor groups can together administer or control the entire system. The same can happen in Ethereum. Though the algorithms for mining were designed such that the chances of this happening are less, the fact that this can happen is a real possibility.
- Size: The size of the Ethereum Blockchain is increasing, and nodes have to be highly equipped to store a Blockchain of this size.
- Ethereum-based DApps are not user-friendly yet.
- Ethereum is not Quantum-resistant as it uses curve cryptography, which is not quantum-resistant.
- The rise of emerging competitors like EOS, NEO, and Cardano.
One of the major problems that Ethereum face is the risk of decentralization.
How Ethereum development community is tackling the problem? To solve the problem of decentralization, Ethereum is building its own Proof of Stake algorithm which they call Casper Protocol. Let's explore this further.
Future of Mining in Ethereum - Proof of Stake
To solve the risk of decentralization, the POS algorithm actually virtualizes the whole mining process and is moving from the concept of miners to the concept of validators. Now, the validator's job is to look at the different blocks created in the network and pick the block which is most likely to be the next block in the network. Let's look at how this works.
In Proof of Stake, each validator owns some stake in the network and has to lock it in order to be selected.
- Anyone who holds the base cryptocurrency (Ether) can become a validator, although sometimes a locked-up deposit is required.
- Validators place bets on the blocks being created, and if the block on which they bet is selected to be in the main chain, then these validators receive some rewards. The higher amount of cryptocurrency one has, the higher the number of blocks one can place a bet on. And the chances that a block they bet on is selected are high, and this will fetch them some rewards.
In the above-discussed setup, since validators have nothing to lose, it may happen that they behave maliciously and start making bets on the unauthorized blocks as they have nothing to lose by placing such bets. And this problem is called the "Nothing at stake" problem.
- To prevent the "Nothing at stake" problem from happening and to ensure that validators bet on only one block, Ethereum developers are trying to build a concept where the validators will have something on stake, and betting on more than one block might result in them losing out that stake.
- Ethereum is building its own Proof of Stake algorithm, which they call Casper Protocol. Here, the validators have to put some amount at stake, and if they try to use unfair means like placing bets on more than one block, then they will end up losing their stake.
- There are more operational and logical challenges to implementing Casper Protocol, and the Ethereum developers are working on successfully implementing it.
Still Proof of Work is the consensus algorithm used in Ethereum. Ethereum will move to a Proof of Stake algorithm in the future but it's still in the research and development phase and the modified version of Proof of Stake that will be implemented on Ethereum is called Casper Protocol.
Summary
Ethereum has made significant, incremental improvements to the Bitcoin network by introducing the concept of smart contracts and has opened doors far beyond the financial world.
To summarize, a transaction is a cryptographically-signed message that specifies what change is to be made in the state of the Ethereum network. Based on the consensus rules defined in the Ethereum network, the network has to agree that the transaction is valid and is included in a block that is added to the blockchain.
Ethereum consists of several blocks and each block has a header that contains the following:
- State root, which is nothing but a hash of the root of the Merkle tree, and each branch of the tree will have a single account.
- Ethereum account has various elements such as nonce, storage hash, etc. Storage hash is nothing but the hash of the root of the Merkle tree where every element inside of the Merkle tree is basically a storage element that we store inside every account.
Refer to the diagram shown below explaining the above concept.
Ethereum, as a state transaction system, has to play an essential role as handling transactions plays a critical role in any blockchain network.