hypersign-protocol / whitepaper

2 stars 0 forks source link

Understanding POS #17

Open Vishwas1 opened 2 years ago

Vishwas1 commented 2 years ago
Vishwas1 commented 2 years ago

Paper: A Survey on Blockchain Consensus with a Performance Comparison of PoW, PoS and Pure Po .

But how is the forger gets selected to forge the block?

For a proof of stake method to work effectively, there needs to be a way to select which user gets to forge the next valid block in the blockchain. Selecting the forger by the size of their account balance alone would result in a permanent advantage for the richer forgers who decide to stake more of their cryptocurrency units. To counter this problem, several unique methods of selection have been created. The most popular of these methods are the ‘Randomized Block Selection’ and the ‘Coin Age Based Selection’ methods.

Randomized Selection:

In the randomized block selection method of selection, a formula which looks for the user with the combination of the lowest hash value and the size of their stake, is used to select the next forger.

For example, if a user stakes 50% of the total number of staked coins, he has a 50% chance of being chosen to validate the next block on the blockchain.

To sim-ulate the stake-based leader selection process, the Follow-the-Satoshi (FTS) algorithm has been adopted in many PoS-based blockchain networks such as Cardano, Sp8de, and Tezos.

The FTS algorithm is a hash function that takes a seed (i.e., a string of arbitrary length such as the previous block’s header or a random string created by some other selected nodes) as the input.

image

How to mitigate stake pools problem - see this papre

image

image

What problems does consensus solves

The consensus’s main purpose is to allow a group of peers to agree on a single state of the ledger, avoiding two problems: (1) the double-spending (refer to Section 4.1) and (2) the creation of forks.

Why does fork happens?

To understand what a fork is and why it matters, we should consider two main factors: (1) the propagation latency of both blocks and data transactions and (2) the coexistence of many leaders in the network.

  1. The former affects the list of data transactions that a node receives: a user close to the data source obtains data transactions earlier than a node located in proximity of the network boundary.
  2. The latter will impact the number of leaders that are in charge of generating the next block.

deally, a well-designed consensus procedure should allow the presence of only one leader at a time. These two factors combined together—the propagation latency and the multiple leaders—might end up into a weird situation in which leaders propagate divergent blocks through the network. As a consequence, the nodes receive more than one block at a time and they are not able to discriminate either the correct block or the block that should be get rid of.

In this uncertainty situation, nodes behave by temporarily adding all correct blocks to the chain and creating a fork. Afterwards, the nodes just continue by adding the subsequent blocks to the chain. When a block is covered by enough other blocks (in Bitcoin a transaction must be followed by at least 6 blocks), the nodes come to an agreement by pruning the orphan branch, according to the longest chain rule (see Section 4.1). When the chain gets pruned, several situations may arise. From discarding a valid transaction that will be later re-proposed, increasing the transaction confirmation latency, up to validate invalid blocks. Taking advantage from this behaviour, some malicious parties might double-spend their digital assets with the aim to get them validated by the consensus procedure. This behaviour might cause severe consequences.

A consensus procedure has to guarantee safety and liveness. Safety states that the algorithm should not do anything wrong, while liveness ensures that eventually something good happens.

Unfortunately, due to an impossibility result from Fischer et al. [40], no deterministic algorithm solves the consensus problem in an asynchronous system. Roughly speaking, in an asynchronous distributed system, no deterministic consensus algorithm can satisfy both safety and liveness while preserving fault-tolerance.

Consensus is also crucial in any distributed system to allow overall reliability in the presence of faulty nodes. A fault simply implies an unexpected behaviour of the nodes that can result in [31]: (1) fail-stop failures or (2) Byzantine failures.

The concept was firstly introduced in 2012 by Peercoin

Particularly, to avoid that wealthy nodes may get richer receiving the reward for delivering invalid transactions, a random election model is adopted.

But to make matters worse every blockchain implements its own method or a combination of them. Some blockchains use a combination of lowest hash value and highest stake, others a coin age selection where tokens staked for a long time will give more profits.

Blockchain and CAP theorem

three important properties that every shared database must deal with.

The prevailing idea of consistency in distributed systems is quite different from the one proposed during the early database stages by the ACID properties. The cloud computing entirely changed this scenario and these ACID properties have not-well fitted this new distributed paradigm. Eric Brewer was the person who has introduced a milestone in the database systems’ theory. Such milestone is known as the CAP theorem and it claims that every distributed database system, such as the blockchain, cannot simultaneously guarantee more than two out of three of these properties (availability, consistency and partition tolerance)

Ref: https://core.ac.uk/download/pdf/158801494.pdf In order to make participants agree on a block signer, random choice is a must. So our first approach was focused on a round based selection. The main idea of this algorithm is to randomly find an IP address and so its owner, who will be the winner for the selection of the block signer.

  1. In the first place, the block signer of the previous block (n-1) will randomly choose a list of participants public keys to be candidates to sign the block "n".

Ref: Paper: Provably Secure Proof-of-Stake Blockchain Protocol. : https://eprint.iacr.org/2016/889.pdf https://iohk.io/en/research/library/authors/aggelos-kiayias/