Qortal Project

The future of blockchain platforms

User Tools

Site Tools


how_qortal_s_consensus_works

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
how_qortal_s_consensus_works [02/21/2022 17:46] gfactorhow_qortal_s_consensus_works [11/02/2023 14:12] (current) crowetic
Line 2: Line 2:
  
 {{:qortal_official_logo_transparent_.png?400|}} {{:qortal_official_logo_transparent_.png?400|}}
- 
-Here is an explanation from @CalDescent (Qortal’s current lead core developer) on how exactly the consensus in Qortal functions: 
  
 Every node with a Level 5 (or higher) self-share "minting key" attached is eligible to sign the next block. It basically streamlines the filtering of unnecessary blocks on a technical level which is done on the client side before submitting. Lower levels may be able to sign blocks in the future depending on future development and technicalities, but remember: we do not compete to sign blocks so this is simply a necessary design for minting efficiency. The timestamp of each block must be between 30 seconds and 90 seconds after the block that precedes it. However, the actual timestamp of the minted block will depend on the minter, based on two main factors: Every node with a Level 5 (or higher) self-share "minting key" attached is eligible to sign the next block. It basically streamlines the filtering of unnecessary blocks on a technical level which is done on the client side before submitting. Lower levels may be able to sign blocks in the future depending on future development and technicalities, but remember: we do not compete to sign blocks so this is simply a necessary design for minting efficiency. The timestamp of each block must be between 30 seconds and 90 seconds after the block that precedes it. However, the actual timestamp of the minted block will depend on the minter, based on two main factors:
  
-1. Key distance. This is essentially a lottery for each block, where each minting account has only one ticket each time, and everyone knows the lottery numbers of the other minting accounts. To achieve this, we convert the previous block's signature to a number, and then convert the minter's reward share public key to another number. One is subtracted from the other, resulting in a new number. The lower this number, the more similar the two strings are. This essentially produces a random number that is a) immutable for this minter/block combo, and b) is verifiable by the rest of the network so that it can't be faked.+1. **Key distance.** This is essentially a lottery for each block, where each minting account has only one ticket each time, and everyone knows the lottery numbers of the other minting accounts. To achieve this, we convert the previous block's signature to a number, and then convert the minter's reward share public key to another number. One is subtracted from the other, resulting in a new number. The lower this number, the more similar the two strings are. This essentially produces a random number that is a) immutable for this minter/block combo, and b) is verifiable by the rest of the network so that it can't be faked.
  
-2. Minter level. The number from Step 1 is then divided by the account level of the block signer. So a level 5 account would end up with a number 5 times lower than a level 1 account, assuming that they both had comparable key distances. However, if a level 1 produces a key distance 10 times smaller than a level 5, its resulting number would be smaller than the level 5's number. On average, higher levels will produce smaller numbers than lower levels.+2. **Minter level.** The number from Step 1 is then divided by the account level of the block signer. So a level 5 account would end up with a number 5 times lower than a level 1 account, assuming that they both had comparable key distances. However, if a level 1 produces a key distance 10 times smaller than a level 5, its resulting number would be smaller than the level 5's number. On average, higher levels will produce smaller numbers than lower levels.
  
-Lower numbers translate to a lower time delta for the next block, and higher numbers translate to higher time deltas. So some nodes could sign their blocks with a timestamp 50 seconds after the previous block, and others could sign blocks with timestamp 80 seconds after the previous block, etc etc. In practice, timestamps range from around 60-90 seconds because of the way they are weighted, with the average being historical delta being around 65 seconds.+Lower numbers translate to a lower time delta for the next block, and higher numbers translate to higher time deltas. So some nodes could sign their blocks with a timestamp 50 seconds after the previous block, and others could sign blocks with timestamp 80 seconds after the previous block, etc etc. In practice, timestamps range from around 60-90 seconds because of the way they are weighted, with the average historical delta being around 65 seconds.
  
 Each block has a "weight", which is determined by the above two factors, along with the number of online minting accounts included in a block. To produce the highest weight, the block must be signed by a high level, with a low key distance, and contain a high number of online accounts. This is the "most ideal" block candidate that we aim to choose as the next "official" block in the chain. Each block has a "weight", which is determined by the above two factors, along with the number of online minting accounts included in a block. To produce the highest weight, the block must be signed by a high level, with a low key distance, and contain a high number of online accounts. This is the "most ideal" block candidate that we aim to choose as the next "official" block in the chain.
Line 19: Line 17:
 Nodes sync to the most ideal block that they can find, and the process repeats. If another, better block is found by a subset of the network, this will eventually propagate through and cause nodes on a different block to "re-org" and swap to the better chain. This generally happens within a couple of blocks, and is the expected behaviour. Nodes sync to the most ideal block that they can find, and the process repeats. If another, better block is found by a subset of the network, this will eventually propagate through and cause nodes on a different block to "re-org" and swap to the better chain. This generally happens within a couple of blocks, and is the expected behaviour.
  
-To summarize with this system: 
  
-1) Higher level accounts are preferred as block signers, on average. 
  
-2) Verifiable randomness is created, to ensure that minters on each level get a reasonably equal distribution of blocks signed, and no-one can jump the queue by minting a block with an earlier timestamp than it should have. 
how_qortal_s_consensus_works.1645483613.txt.gz · Last modified: 02/21/2022 17:46 by gfactor