The blockchain architecture can be understood based on the below wedding cake model.
Layer 0: Nodes
This layer is comprised of thousands of nodes which are connected together.
Layer 1: Consensus (Solidity, Move, Motoko)
Consensus layer makes sure that everyone sees the sees data and it achieves this through :
- Persistence: Data once added cannot be removed except under an extremely improbable and complex 51% attack (Miners owning the majority of the hash(compute) on the network collude to prevent the recording of new blocks).
- Consensus: All honest participants have the same data except for the last few blocks which will take time to show up on the chain.
- Liveness: All honest participants can add transactions.
- Open: Anyone can participate without authentication and this fundamentally the differentiator for blockchain versus other networks where some form authentication is always required. The main invention by Nakamoto was the ability to go around the double-spending problem and move towards an Open consensus mechanism.
Now that we have understood the concepts of the Consensus Layer let’s try to understand how it works. The two main players for achieving the consensus are the participants executing the transaction and the miners who help validate the transaction and then post the update to the blockchain. The participants sign the transactions using a secret key and send it to the miners. The Consensus protocol chooses a random leader from amongst the miners and this leader then collects the transaction into a block and posts it on the blockchain. While posting the transaction the leader selects the order of the transaction and gets paid with the native currency of the blockchain.
There are various types of consensus protocols:-
- Proof of work slow (Used in Bitcoin) — Miners compete to solve a cryptographic problem. This protocol is slow and energy-consuming.
- Proof of stake (Planned to be used in Ethereum) –This is based on a miner(forger) staking an amount of cryptocurrency he/she has and then based on probability driven by the amount staked the miner might get a chance to validate a block. Delegated Proof of Stake is a further variant on this wherein the miners are able to cast votes proportional to their stake and the one with the most votes gets to validate the transaction and post the block.
There are a few other protocols being used/experimented by other chains including Proof of space, Byzantine Fault Tolerance, SIEVE, Proof of Weight, Unique Node Lists, Proof of Burn, Proof of Activity and Proof of Capacity. The choice of protocol is driven by the type of applications.
1. Natural Language Generation:
The Commercial State of the Art in 2020
2. This Entire Article Was Written by Open AI’s GPT2
3. Learning To Classify Images Without Labels
4. Becoming a Data Scientist, Data Analyst, Financial Analyst and Research Analyst
Layer 1.5: Compute Layer (Blockchain Computer)
The blockchain computer is composed of thousands of nodes i.e. servers joined together by the consensus mechanism. Each “Blockchain Computer” comprises of Blocks (Memory) and Virtual Machine (Compute). This computer has a special feature that has provable trust guarantees based on the game theory of nodes and the consensus mechanism. The trust guarantee ensures that the rules of the system cannot be changed without following the process set out in the system’s governance protocols. This guarantee enabled primitives like smart contracts, decentralised organisations (DAOs), digital goods, trusted software platforms and digital money. All the code running on the blockchain is open-source which ensures transparency and is publicly verifiable as all anyone can verify state transactions.
Layer 2 : Applications / Smart Contracts / Layer 2 blockchain
A blockchain can be built using various languages like Solidity, Move, Motoko. Once the application is built then the code and the initial state of the application is loaded onto the blockchain. When someone sends a transaction to the application then the code is executed and then the new state is posted on blockchain. The focus currently is on using the blockchain as little as possible the layer 1 blockchain to try and achieve scalability. Also at the moment there is a fee called “gas” to execute a transaction but in the future, there might be costs for storing data on the blockchain and hence all the more reason to minimise data being stored on the blockchain.
Layer 3 : User Interface (Web 3.0)
These are the decentralised applications which are consumed by end-users. The end users don’t talk to the blockchain but actually talk to the application server on the cloud and get the data using the blockchain.