Introduction to Ethereum Blockchain
What is Ethereum?
The whole Ethereum Blockchain works like a single virtual machine called the Ethereum Virtual Machine (EVM). You can consider EVM like an OS that is decentralized which means that all the nodes in the Ethereum network record the changes that are made in the network. Ether is the cryptocurrency used in the Ethereum blockchain and it is used to provide incentives for the nodes that verify and execute transactions in the blockchain.
Bitcoin vs Ethereum:
The primary purpose of Bitcoin is to be used as money but In case of Ethereum, ether is used as an incentive to nodes that execute operations on the network. Bitcoin doesn’t have smart contracts but Ethereum has smart contracts. Ethereum blockchain is turing complete system which means one can solve any given problem with smart contracts just like what you can do with a programming language. Bitcoin blockchain on the other hand is not a turing complete system. Ethereum is faster than bitcoin and is more secure than bitcoin. Ethereum has a strong developer community and the founders are known. No one knows the identity of the founder of bitcoin.
What is a smart contract?
A smart contract is a piece code that anyone in the network can create and commit it to the network. Anyone on the network can call the smart contract to execute that code. Ethers are paid as fee for each transaction in the network.
In Ethereum network, each operation in the network happens as a transaction. For each transaction, a particular amount of gas fee is paid to the node which executes the transaction. So the code for smart contracts are written in the most efficient way to minimize the number of computational cycles. Gas is the unit for the measurement of amount of computational effort required to complete a transaction. Gas fees is the amount of ethers paid for each unit of gas. Gas fees is denoted in gwei.
1 ether = 10^18 wei = 10^9 gwei
Why fee? Why not free?
In centralized system, the operations are performed in the user’s own hardware or in a paid cloud service. But in case of a decentralized system, no one knows which node executes the given operation. It is designed in such a way that whenever a smart needs to be executed, a calculated amount of gwei is sent by the sender address. This is used to pay the node which executes the required code for the power they spend.
Ethereum has two types of accounts:
- Externally Owned Accounts (EOA) – This is only used to store ethers by users.
- Contract Accounts (CA) – This is used to store smart contract code.
EOA can initiate smart contract and can send and receive ethers. Contract accounts can store smart contract code in blockchain, can store ethers and they cannot initiate a transaction by themselves. They are initiated by an externally owned account.
The transactions that are performed in the network are put into blocks that are generated periodically. In Ethereum , a new block is created every 15 seconds. Within that block the all the transaction details that happened within that particular time are stored into the block. This block is verified and added to the blockchain.
Types of nodes:
- Light Node – stores only the header hash of all blocks
- Full Node – stores the entire blockchain
- Archive Node – stores archives of the entire blockchain of all historical states of the EVM
Ethereum uses Proof of Work consensus mechanism. In Proof of work mechanism, the miner nodes in the network verify the blocks and solve a computationally intensive problem that is given by the network to add it to the blockcahin. After that all the nodes in the network verify and accept the new block to its chain.
Whenever a miner creates a block, it is validated and a miner reward is given to the miner node which did the work. At the time of writing the miner reward is 3 eth for each block. This computationally intensive task is to discourage fraud activities into the blockchain so that no one tries to add false data. And also the node is penalized if it provides wrong data thereby contributing to the security of the network.
Eth 2.0 is still under development. It uses Proof of Stake Consensus where there will be no miners. The staked ethers validate the blocks and transactions. The more staked ethers by an account, the more priority and reward is received by the respective account.
Proof of Stake consensus mechanism consumes less electricity and does not require high end GPUs as there is no mining involved. The gas fee is significantly reduced which is the primary barrier for current ethereum.