Introduction to Ethereum – ETH
This article assumes that you are familiar with the terms of distributed ledger, blockchain, token, blocks or transactions.
What is Ethereum
The Ethereum blockchain was launched in 2015 by Vitalik Buterin. It was designed at a time when people recognized the power of the Bitcoin model, and were trying to develop blockchain applications. The main purpose of Ethereum was to provide smart contract execution and decentralized applications on the blockchain. Bitcoin was also able to be used with some kind of smart contract by integrating logics in the transactions. The constraints in Bitcoin are too restrictive (which also gives security) which is the reason explaining the success of Ethereum.
First it may be interesting to define what is a smart contract. The name is very misleading as there is no such thing as “contract” in Ethereum in the sense that there is an agreement/contract signed by 2 parties. The smart contract term here means a smart transaction which is embedding some programmable logic. An example of a smart contract could be an address waiting to receive a certain amount of Ethereum tokens and then send all of it to a charity organisation address once the goal is reached.
Ethereum is the world computer.
Ethereum allows the users to create many different types of decentralized applications. It is often described as the “world computer” as it is constantly computing and executing the different logic programmed in the smart contract. The nodes composing the Ethereum blockchain will have the Ethereum Virtual Machine which is running the different smart contracts. However, there are some restrictions on the contracts, (to avoid an execution running forever) managed by the gas which is linked to the ETH token.
There are many decentralized applications being in fact cryptocurrency themselves. That is what we call the ERC-20 tokens, like AAVE, USDC, CHZ or CRO. These cryptotokens are defined and programmed in smart contracts and relies on the Ethereum blockchain for the transactions, security, execution etc…
The Ethereum white paper explaining the goal and the different component of the blockchain can be found on the official website here: https://ethereum.org/en/whitepaper/.
About the ETH token
The Ethereum token is called Ether and is used for the execution of smart contracts. It is used as a gas to power the Ethereum network (we often say gas instead of Ether). You can’t execute or create a smart contract if you do not pay some Ether tokens.
Bitcoin has a supply limit of 21 millions bitcoins which will be reached in 2140 approximately. Currently, Ether does not have a supply limit and can have an unlimited production. The Ether token is generated by the miners every time a block is created and verified. However, the production rate is fixed and 15.5 millions Ether are mined every year (20 ETH per minute) which is much greater than Bitcoin producing 6.25 BTC every 10 minutes. Today, in march 2021 there are 115 millons of Ether tokens.
When a smart contract is deployed it will be evaluated in terms of ether consumption. Let’s say one script line execution equals 1 ether consumption. If a smart contract script contains 10 lines it will hypothetically be evaluated as a 10 ether consumption program. We can see ether as a time unit or CPU consumption unit. Now, if for some reasons someone executes this same smart contract but takes much more than 10 ether then it will simply be stopped and canceled. This is the mechanism protecting smart contract to run for a very long time.
About the Ethereum blockchain
Blocks are batches of transactions with a hash of the previous block in the chain. The Ethereum blocks are bounded in size and each block has a gas limit. The total amount of ether/gas consumed by all transactions in the block must be less than the gas block limit. This limit is set by the Ethereum network and the miners. The block gas limit at the genesis block 0 was initialized at 5000. Every mined block can alter the global gas limit by 0.1% to increase or reduce this limit. In march 2021, the gas limit was set to 12.5 millions. The gas limit directly influence the number of transactions contained in a block. Increasing the number of transactions allow the network to be faster but it may slow down some miners who can’t add more transactions in their node system.
The average block size as of march 2021 is 45,000 bytes with an average of 1,200,000 transactions per day (approximately 14 transactions per second). When Ethereum 2.0 will arrive it will be able to handle up to 100,000 transactions per second.
A very interesting website to observe the different charts regarding the Ethereum blocks, transactions, supply is https://etherscan.io/charts.
Proof of Work
The blocks in the Ethereum blockchain are generated by the miners. They are taking the latest submitted transactions and form a block out of it. In order to propagate the block to the other nodes of the network it needs to be valid. Like Bitcoin, Ethereum is using as of march 2021 the Proof-of-Work (PoW) concept meaning the miners needs to spend a lot of computation efforts and electricity to create a valid block. When they have what seem to be a valid block, the will send it to others nodes which are going to check and validate the block. If the verification doesn’t go well it the block is simply rejected and if it’s correct then it will be propagated to other nodes. This concept gives security to the network as it is better for the miner to act honestly and generate valid block instead of spending electricity for nothing.
To create a valid block a miner needs to integrate the transactions data, the previous block hash, block difficulty, nonce and other informations. All of the information will then be mixed to give a single value (mixHash) using the hashing algorithm. And the whole purpose of mining, is to get this value produced by the hashing function less than the block difficulty value. Essentially, we can modify the value of what we call the nonce parameter so that the input of the hash function differ, leading to a different hash result.
Block mining example
For example, let’s say we have a block difficulty equals to 500 and that the hashing function is giving output from 0 to 100,000,000. If the mixed transactions information (mixHash) with a nonce equals to 0 is giving 500,000 after running the hash function then we know the nonce is invalid. We will then try again with a different value of nonce, like 1 and now the hash function gives 12,345,678, which is still not valid. The hash function output is unpredictable. So now we have to try all the possible value for the nonce until we get a hash function result giving an output less than 500. That is why it is called Proof-of-work, because you have to try and work different values for the nonce until you have one valid. The values we gave are completetely hypothetical, and the numbers are much bigger for the real Ethereum blockchain.
To sum up, the consensus algorithm used by Ethereum to generate, validate and add blocks in the blockchain is the Proof-of-Work concept. A new Ethereum block is generated every 14 seconds which is the time to mix the transactions, find an appropiate nonce value and send the block.
The Proof-of-Work concept is used by Ethereum 1.0 but soon Ethereum 2.0 will come out which will use Proof-of-Stake instead of Prood-of-Work. You can go to this link to read more about Ethereum 2.0: https://ethereum.org/en/eth2/.
The purpose of the hash function is to produce a one-way output for every input. The one-way term means that it is computationally impossible to retrieve the input value from the output value. The only way to determine a possible input is to conduct a brute-force search, checking all possible value until we obtain the expected output.
Bitcoin is using the SHA-256 hash algorithm, which is different for Ethereum. Indeed, Ethereum is using the Keccak-256 hash algorithm, also called SHA-3.
To sum up, Ethereum is meant to grow and evolve more and more over time to really become the world computer. It is currently using the Proof-of-Work concept but will soon transition to Proof-of-Stake in Ethereum 2.0. It provides the users the ability to create smart contracts which can be defined for many different applications. We can also deploy a cryptocurrency in the Ethereum network using the ERC-20 standard.
There main differences between Ethereum and Bitcoin can be listed as follow:
- Bitcoin is meant as a store of value like gold. Ethereum is used as the gas of the world computer execution.
- Bitcoin has a maximum token supply of 21 millions. Ethereum currently doesn’t have a limit.
- A Bitcoin block is generated every 10 minutes. An Ethereum block is generated every 14 seconds.
- The Bitcoin production rate is halving every 210,000 blocks. The Ether production is fixed.
- Ethereum has less constraints and more possibility in the development of smart contracts.
- Bitcoin uses the SHA-256 hash algorithm. Ethereum uses the Keccak-256 hash algorithm.
Waiting the Cardano blog post 😉 keep going, very nice insights ! Much appreciate !