Note
If you are new to the field of information technology, taking our Free Information Technology Course for Beginners and Cloud Technology Course for Free with Certification is highly recommended. Also, for a comprehensive coverage of blockchain concepts and its use cases, taking our Free Blockchain Course with Certification is highly recommended.
Recap
In our previous article (How Digital Signature Works In Blockchain), we learned about the mechanism behind Digital Signatures and what role they play in a blockchain system.
In this article, we learn about the role and types of consensus algorithms that are widely used in the blockchain applications.
Anatomizing a blockchain consensus mechanism
A fundamental problem in large-scale distributed systems is how to achieve overall system reliability in the presence of failures. Systems need to be fault-tolerant. This requires a process for distributed, often heterogeneous systems to reach a consensus and agree on the network state, whether it is a database commit or an action to take. In this article, we will make an introduction to consensus algorithm in blockchain, followed by two separate articles covering two types of consensus algorithms, Proof-of-Work (PoW) and proof-of-stake(PoS) in depth.
One-to-One Live Blockchain Classes
Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.
What is consensus?
Consensus in a blockchain is the process by which a network of mutually distrusted nodes reaches an agreement on the global state of the chain of blocks. In blockchain, transactions or data are shared and distributed across the network. Every node has the same copy of the blockchain data. Consensus allows all of the network nodes to follow the same rules to validate transactions and add new blocks to the chain, and therefore allows it to maintain uniformity in all of the copies of a blockchain.
Sometimes, it is also called a consensus mechanism or consensus algorithm. A consensus mechanism focuses on the process and approach of how to reach an agreement. A consensus algorithm is a formal procedure or computer program for solving a consensus problem, based on conducting a sequence of specified actions. It is designed to achieve reliability in a network involving multiple nodes. Consensus algorithms ensure that the next block in a blockchain is fully validated and secured. Multiple kinds of consensus algorithms currently exist, each with different fundamental processes. Different blockchain platforms may implement different consensus mechanism. In this article, we will focus on the following two popular algorithms, show how they work, and discuss the pros and cons of each mechanism:
- PoW: This consensus algorithm was introduced by Satoshi and commonly adopted by many other blockchains, including Ethereum. The PoW is the mining process with the purpose of finding an answer to a cryptographic hashing problem. To do so, the miner has to follow the block selection rules to locate the previous block and use the hash from the previous block header, together with the Merkle root of current transactions in the new block, to solve the hashing problem. It requires considerable computations and hashing power. In Bitcoin, block selection rules that specify the longest chain wins.
- PoS: This consensus algorithm aims to select miners based on the various combinations of random selection based on the miners’ wealth or age (the stake). Instead of miners competing to solve energy consuming cryptographic hash functions, the network will instead use a pool of validators. Validators are nodes that are willing to stake their cryptocurrency on the blocks of transactions that they claim should be added to the public blockchain.
Next Article
Congratulation! We now successfully finished our first article series. In our second article series, we gradually move on to Ethereum blockchain development by covering the following 9 articles:
- Review of Architecture and Components of Ethereum
- How Ethereum Manages Accounts
- How Ethereum Manages Transactions
- How Smart Contracts Work in Ethereum
- How Ether and Gas Work in Ethereum
- How Ethereum Virtual Machine works
- How address and wallet work in Ethereum
- How mining works in Ethereum
- List of Tools and Technologies in Ethereum Ecosystem
This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.
Resources
coming soon