Consensus Mechanism of Klaytn

Intermediate

 

Consensus Mechanism of Klaytn

Welcome to our tutorial on the consensus mechanism of Klaytn. Klaytn is a blockchain platform developed by Ground X, the blockchain subsidiary of the South Korean internet giant Kakao. Klaytn aims to provide an efficient, user-friendly, and scalable blockchain platform for mainstream adoption. One of the key features of Klaytn is its consensus mechanism, which ensures the integrity and security of the network while also enabling high performance. In this tutorial, we will explore the consensus mechanism of Klaytn in detail, including how it works and its benefits. Whether you are a developer, researcher, or simply a blockchain enthusiast, this tutorial will provide valuable insights into the inner workings of Klaytn’s consensus mechanism.

The consensus mechanism of Klaytn, called BFT-DPoS (Byzantine Fault Tolerance – Delegated Proof of Stake), is a combination of two consensus algorithms: Byzantine Fault Tolerance (BFT) and Delegated Proof of Stake (DPoS).

BFT is a consensus algorithm that ensures the integrity and security of the network by allowing the nodes to reach consensus even in the presence of malicious actors (referred to as “Byzantine” nodes). In BFT, nodes communicate with each other in rounds, and in each round, a node can propose a block to be added to the blockchain. Other nodes can then vote on whether to accept or reject the proposed block. In order for a block to be added to the blockchain, it must receive a certain number of votes (usually two-thirds) from the other nodes. This ensures that a malicious node cannot propose a malicious block and add it to the blockchain without the approval of the other honest nodes.

DPoS, on the other hand, is a consensus algorithm that allows token holders to vote for “delegates” who are responsible for validating transactions and maintaining the network. The delegates are elected through a voting process, and the weight of each vote is determined by the number of tokens held by the voter. In DPoS, the elected delegates are responsible for validating transactions, creating new blocks, and maintaining the network.

In Klaytn’s BFT-DPoS consensus mechanism, a fixed number of delegates (21) are elected through a voting process and are responsible for validating transactions and maintaining the network. These elected delegates use BFT to reach consensus and validate transactions.

The process of creating a new block in Klaytn’s BFT-DPoS consensus mechanism is as follows:

The elected delegates propose new transactions to be added to the next block.

The delegates use BFT to reach a consensus on which transactions should be included in the next block.

Once consensus is reached, the block is created and added to the blockchain.

The benefits of this consensus mechanism include high scalability, high performance, and low energy consumption, and high security and fault tolerance. Additionally, since the elected delegates are responsible for validating transactions and maintaining the network, the system is more democratic and decentralized than other consensus mechanisms where a small number of nodes are responsible for validating transactions.

A consensus mechanism (algorithm) is a way of reaching a consensus between trustless entities. In blockchain technology, it is used to reach a consensus about if a block is valid or not. The performance of blockchain networks relies on the performance of the adopted consensus mechanisms, and it has a significant impact on the perceived usability of the Blockchain Applications.

Klaytn Mainnet Cypress exhibits the following performance.

Handles 4,000 transactions per second.

Immediate transaction finality.

One-second block generation time.

Over 50 consensus nodes can participate in the consensus process.

In the document, we will go over how Klaytn implemented the high-performing consensus process.

Klaytn is aiming to be an Enterprise-ready and Service-centric platform. Therefore we need to solve the finality problem written above and the network should be able to allow many nodes to participate in the network. To make this possible, Klaytn is using an optimized version of Istanbul BFT, which implements PBFT with modifications to deal with the blockchain network’s characteristics.

In Klaytn, there are three types of nodes, CN (Consensus Node), PN (Proxy Node), and EN (Endpoint Node). CNs are managed by CCOs (Core Cell Operators) and are in charge of block generation. These blocks are verified by all nodes in the network.

Klaytn achieves fast finality by adopting and improving Istanbul BFT. Because validation and consensus are done for each block there is no fork and the block’s finality is guaranteed instantly as soon as the consensus is made.

And also the issue of increasing communication volume in the BFT algorithm is solved by utilizing a randomly selected Committee. CNs collectively form a Council and on each block generation, part of them are selected as a member of Committee using a VRF (Verifiable Random Function).

Because consensus messages are exchanged only between the committee members, the communication volume can be limited under the designed level even though the total number of CNs increases.

Currently, Klaytn Mainnet Cypress can provide a high throughput of 4,000 transactions per second with a one-second block generation interval. More than 50 consensus nodes can participate in the CNN (Consensus Node Network) at the moment and the number will continuously increase as Klaytn continues to aggressively optimize the algorithm.

With this, you complete this workshop successfully!!