<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Aerius Labs - Medium]]></title>
        <description><![CDATA[An R&amp;D lab working on the forefront of zero knowledge - Medium]]></description>
        <link>https://medium.com/aerius-labs?source=rss----80c2f6b3647f---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Aerius Labs - Medium</title>
            <link>https://medium.com/aerius-labs?source=rss----80c2f6b3647f---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 17 May 2026 10:30:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/aerius-labs" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Finality — Part 2| Blockchain for Dummies]]></title>
            <link>https://medium.com/aerius-labs/understanding-finality-part-2-blockchain-for-dummies-8a7ede08c80a?source=rss----80c2f6b3647f---4</link>
            <guid isPermaLink="false">https://medium.com/p/8a7ede08c80a</guid>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[solana-network]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cosmos]]></category>
            <category><![CDATA[consensus]]></category>
            <dc:creator><![CDATA[Ranamahima]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 07:48:28 GMT</pubDate>
            <atom:updated>2024-08-23T07:48:28.660Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*onhic4Yp32fiIQ9DFHBslA.png" /></figure><h3>Understanding Finality — Part 2| Blockchain for Dummies</h3><p><em>In the previous part of this article, we had discussed the different types of finalities that can be achieved by a blockchain protocol based on their synchronicity and probability. We also looked at how Ethereum and Near blocks achieve finalities in their respective networks. In this article, we will look at the process for three more popular blockchains — Solana, Polkadot and Cosmos.</em></p><h3><strong>Solana</strong></h3><p>Solana, another very popular blockchain, also uses a version of BFT called <strong>Tower BFT</strong>, along with <strong>PoH </strong>(Proof of History). Solana relies heavily on PoH as it puts a timestamp on every block(to get more information on PoH, please read our article on Consensus Mechanisms). The PoH ledger itself acts as a network clock. (5) All the nodes in Solana need to have a common understanding of the passage of time due to the application of timestamps in the protocol. The network clock is nothing but a synchronised and consistent timekeeping mechanism that helps maintain order and coordination across different nodes or participants in the network.</p><p>Tower BFT is the PoH version of PBFT or Practical Byzantine Fault Tolerance. PBFT is an algorithm designed to address the challenges of achieving consensus where some nodes may be faulty or malicious. It can tolerate up to 1/3rd of nodes being malicious and achieves this by operating in multiple phases. During the process of achieving consensus, very often a node has to wait for a predefined period to receive responses from other nodes in the network. This period is called a <strong>PBFT time-out</strong>. Since the Solana ledger works as a reliable network clock, PBFT time-outs can be encoded in the ledger itself. This means that the timeouts taken by PBFT when nodes are waiting for responses from other nodes can be included in the PoH hashing itself.</p><p>There is no separate gadget to achieve finality. Instead, it makes use of the consensus mechanism itself. We had explained in the article on consensus mechanism that in Solana, PoH operates by creating a sequence of hashes, where each hash is linked to the previous one. This provides <strong>proof of the passage of time</strong> between hashes and by extension, provides security. When validators check this proof of passage of time, they vote for the block if they are confident of its validity.</p><p><strong><em>Firstly, a vote starts with the time-out of N hashes</em></strong> i.e. the node will wait for all the responses till the PoH hashing function does not produce N hashes. The validators need to vote for a specific hash which is a reference to a certain point in the PoH ledger. This certain point is the PoH hash corresponding to the time the block was produced. Here ’N’ stands for the number of hashes and can vary according to Solana’s protocol design and configuration.</p><p>It is important to note that a PoH hash is different from a block hash. When a validator votes, he guarantees that once a vote for PoH hash has been cast, the validator will not vote for any PoH hash that is not a child of that vote, for at least N hashes.<strong><em> </em></strong>The above statement can come off as a bit complicated so let us go back to PoH once. In our consensus mechanism article, we have discussed through an example how a block leader produces hashes and includes transactions in the input hashes and gets output hashes. These input and output hashes can be used to verify when a transaction has taken place in the PoH ledger.</p><p>Now if another block leader was trying to maliciously make another block when it was not his turn, his hashes, both input and output, would have been different and hence, the hashes for their succeeding blocks would also be different (the input-output sequence keeps getting passed on from one leader to another). When the validators commit to voting only for the child of a PoH hash they have already voted for, they are committing that they will not vote for any blocks that are not the children of the block they had already voted for before, as seen in the figure below. But this is only applicable for N hashes. The figure below simplifies the theory above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Meyg_YUKiGpDl768_HrG1A.png" /></figure><p><strong><em>Secondly, the time-outs for all the predecessor votes double</em></strong>. Voting is restricted to a fixed period, which are called slots of 400ms and the goal is to have these N hashes completed before 400ms. These hashes can be assumed to be computational work that has to be completed within this time limit. Every 400ms, the network has a potential rollback point in case there is a network delay and no majority is achieved or if there are conflicting transactions. A <strong>rollback point </strong>allows the network to revert to its previous state but every subsequent vote doubles the amount of real time the network would have to stall before it can unroll that vote.</p><p>So if a validator has voted 32 times during the last 12 minutes, the vote 12 seconds ago now has a timeout of 232 slots which is equal to 54 years. Effectively, this vote will never be rolled back by the network. As new blocks are added to the ledger, old blocks are increasingly likely to be confirmed because the number of slots old votes are committed to doubles every slot, or every 400ms. (1) The rough work for this calculation is shown in the diagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFZNpASMxXgai567Mc4XkQ.png" /></figure><p>This explanation might make it seem that Solana achieves probabilistic finality. But that is not true. Solana actually achieves deterministic finality as once 2/3rd of the validator set has voted for a particular PoH hash, that hash cannot be rolled back.</p><p>Solana is not the only blockchain to use BFT, Polkadot uses it too.</p><h3>Polkadot</h3><p>Polkadot blockchain network uses BFT along with the GRANDPA finality gadget for the finalisation of blocks. <strong>GRANDPA</strong> stands for <strong>Ghost-based Recursive Ancestor Deriving Prefixing Agreement</strong> which allows for finality of not just a single block but chains. (2) In Polkadot, finality is achieved by consecutive rounds of voting by the validator nodes. These rounds are ‘<strong>pre-vote</strong>’ and ‘<strong>pre-commit</strong>’. The gadget works independently of the block production mechanism in the network and works in a partially synchronous network model as long as ⅔ of the nodes are honest and can cope with ⅕ of the Byzantine or malicious nodes in an asynchronous setting.</p><p>We shall understand each term that makes up the abbreviation ‘GRANDPA’ to comprehend its functioning. The first word in the abbreviation is <strong>‘Ghost’</strong>. Ghost in itself stands for ‘<strong>Greediest Heaviest Observable Sub-tree</strong>’. Ghost is a <strong>fork selector</strong> that helps the blockchain decide which fork should be considered as the main chain. We can see in the diagram below that forking has occurred and A is the parent block for all the other blocks. The question is which block is considered to be part of the main chain. One validator, called the <strong>‘primary’</strong>, is chosen who will initiate the Ghost protocol and then the validators vote on which subchain they think should be added (BC or DEF). Post-voting, they broadcast their votes to the network.</p><p>The protocol, once the voting has been completed, checks the number of votes that every sub-tree has received. These votes are weighted in nature i.e. the weight that a vote carries is dependent on the stake that has been deposited by the validator. We can see that the votes of the descendants have also been added to give the total weight of the first block in the sub-tree. Since D has 60% of the total weighted votes, DEF becomes the sub-tree to become a part of the main chain. This explains why the protocol uses the term ‘heaviest observable sub-tree’. This does not mean that the longest fork will always have more votes. If C had 60% votes or the total of EFG had been lesser, BC could have become part of the main chain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J95llkAyY2Pns8Wn1Z4Xww.png" /></figure><p>The GRANDPA protocol is Ghost-based, which means that it also asks the validator set to vote for a set of blocks or a chain instead of just one block for finality and chooses the sub-tree with the maximum weightage of votes. As mentioned above, this is done in two different steps. The first step is called ‘<strong><em>pre-vote</em></strong>’. This is where all the validators find the highest block they consider to be valid in a chain. Now this block may vary from one validator to the next, so the protocol finds the highest block that more than 2/3rd of the validators set has voted for. This highest common block along all its ‘ancestors’ forms the longest common chain (identified by the ‘g’ function). The g function finds the common prefix or the chain of ancestor blocks of the highest common block voted. (3)</p><p>Suppose the range of blocks that are considered for finality, ranges between the height of 542 and 555 (refer the figure below). According to validator A, the highest block to be finalised is 555, according to B, it should be 551, according to C, it should be 553 and according to D, it should be 549. The highest common block in this round would be 549. This entails that 549 including all its ancestor blocks till 542, the longest common chain, would be considered for the second round.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gi486mBL22btIpXOMt4SIA.png" /></figure><p>The second round is known as ‘<strong>pre-commit’</strong>. As the result from the first round shall be used in this round, the process becomes <strong>‘recursive’</strong> in nature. The same process is repeated. All the validators again vote for the heaviest block between 542 and 549. Again the validators may vote differently and the highest common block, imagine it to 547, gets voted as the highest common block. Now the blocks between height 542 and 547 (all these blocks together, forming a chain, are called a ‘<strong>prefix’</strong>) all get finalised together. Here as well, the g function identifies the longest prefix with the most 2/3rd of the votes. The pre-vote round is similar to an expression of faith while the pre-commit round is similar to an expression of confidence.</p><p>Thus GRANDPA identifies a common highest block in two different rounds to finalise it along with its ancestors or prefix, forming a chain, based on the weighted votes of the validators in these rounds.</p><h3>Cosmos</h3><p>Unlike all the blockchains we have discussed above, the only blockchain that achieves instant finality is Cosmos by using the Tendermint protocol. Users can be sure that their transactions are finalised as soon as the block is included. The reason for this is the use of Byzantine Fault Tolerance for achieving consensus while validating the block itself. A block can only be added to the chain if it gets a supermajority in all the rounds — pre-vote, pre-commit and commit phase. Once it receives a supermajority, the block cannot be reverted and the block becomes finalised, thus making it <strong>deterministic finality</strong>. BFT also allows for the protocol to function even if ⅓ of the validators are malicious. You can read about this in our article on Consensus Mechanism. In all the above blockchains, BFT has not been used to validate the block but to finalise it.</p><h3>Conclusion</h3><p>Achieving finality in blockchains is a process in moving towards transparency and immutability. The notion that once a transaction is confirmed, it is irrevocable, brings immense value to a lot of industries such as finance, healthcare, supply chain management and voting systems.</p><p>References —</p><ol><li><a href="https://medium.com/solana-labs/tower-bft-solanas-high-performance-implementation-of-pbft-464725911e79">https://medium.com/solana-labs/tower-bft-solanas-high-performance-implementation-of-pbft-464725911e79</a></li><li><a href="https://wiki.polkadot.network/docs/learn-consensus#protocol">https://wiki.polkadot.network/docs/learn-consensus#protocol</a></li><li><a href="https://research.web3.foundation/Polkadot/protocols/finality">https://research.web3.foundation/Polkadot/protocols/finality</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a7ede08c80a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aerius-labs/understanding-finality-part-2-blockchain-for-dummies-8a7ede08c80a">Understanding Finality — Part 2| Blockchain for Dummies</a> was originally published in <a href="https://medium.com/aerius-labs">Aerius Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Finality- Part 1| Blockchain for Dummies]]></title>
            <link>https://medium.com/aerius-labs/understanding-finality-part-1-blockchain-for-dummies-2a2472aea926?source=rss----80c2f6b3647f---4</link>
            <guid isPermaLink="false">https://medium.com/p/2a2472aea926</guid>
            <category><![CDATA[near-protocol]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[consensus]]></category>
            <category><![CDATA[consensus-algorithm]]></category>
            <dc:creator><![CDATA[Ranamahima]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 07:43:34 GMT</pubDate>
            <atom:updated>2024-08-23T07:43:34.230Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzI0Qn45ywrY2_7eNT-WHQ.gif" /></figure><p>The concept of “finality” plays a big role in establishing immutability and reliability in a blockchain network. <strong>Finality</strong> refers to the point at which a block and the included transactions are irrevocably confirmed and added to the blockchain’s immutable (unchangeable) history. While different blockchains employ different protocols to achieve finality, the end goal is the same — to provide a trustless and secure environment where all honest participants agree on the current state of the chain. In this article, we delve into the difference between deterministic and probabilistic finality, synchronous and asynchronous finality and how blockchains achieve it in their environments.</p><p>After a block is built, first it achieves consensus and then achieves finality. To understand the basics of different consensus mechanisms, you can refer to the consensus article— <a href="https://blog.aeriuslabs.org/decoding-consensus-blockchain-for-dummies-part-1-c9cb71609e11">https://blog.aeriuslabs.org/decoding-consensus-blockchain-for-dummies-part-1-c9cb71609e11</a></p><p><strong>Byzantine Fault Tolerance</strong><br>In any decentralised network, there is always a probability that some validators may behave maliciously or attempt to disrupt the proper functioning of the network. Such validators are known as <strong>Byzantine validators</strong>. Byzantine Fault Tolerance is a property that ensures that a system can function correctly even when a certain number of participants are acting maliciously (usually any network with BFT is prepared to tolerate up to 1/3rd of the validators acting maliciously).</p><p>Malicious behaviour can consist of multiple scenarios. These include -</p><ul><li>The inclusion of invalid transactions in a block by the proposer or multiple validators trying to create a block together at the same time i.e. in the same slot. This would create a conflict as to which block should be the next one to be added to the chain. When this happens, during voting, validators may get confused and vote for more than one block to be the next in the chain.</li><li>Malicious validators may also collude with each other to vote for a block containing invalid transactions or for multiple blocks.</li></ul><p><strong>Probabilistic and Deterministic Finality </strong><br>In probabilistic finality, a block is considered final once it has been included in the blockchain and has a subsequent number of blocks on top of it. Probabilistic finality implies that the probability of a block reverting lowers as more blocks are added on top of it, because the amount of resources, computational or economical, that are required to chain increase as the block gets deeper into the chain.</p><p>There always remains a small probability of reversal, though this probability reduces as time passes. Probabilistic finality assumes that simple majority of validators are honest and hence, all the transactions in the block that have achieved consensus shall be deemed finalised as the chain in front of it gets longer and longer.</p><p>On the other hand, deterministic or absolute finality, achieved through Byzantine Fault Tolerance (BFT) mechanisms provides a stronger guarantee of permanence, as once a block is added to the chain, it becomes finalised. BFT mechanism ensures that the chain shall sustain if less than 1/3rd of the validators in the set are malicious. While deterministic finality offers faster block finalization, the number of validators required to halt consensus are much less than probabilistic models. Furthermore, validator sets for chains with deterministic finality are smaller because multiple rounds of consensus are required to deem a block ir-revertable (this is due to partial synchrony assumptions required, which is discussed later)</p><p>It may seem that deterministic finality is more desirable than probabilistic finality but certain tradeoffs make probabilistic finality the first choice for many blockchains. Eric Brewer’s <a href="https://medium.com/mechanism-labs/finality-in-blockchain-consensus-d1f83c120a9a">CAP theory</a> suggests that in case of network failure, a distributed system, such as a blockchain, can only preserve either its <strong>consistency</strong> or its <strong>availability</strong>. A consistency-preserving system would rather halt than let inaccurate transactions through whereas an availability-preserving system would continue even if it lets inaccurate transactions through. Deterministic finality is preferred by consistency-favouring systems and availability-favouring systems provide probabilistic finality. In the case of making payments, users favour constant availability over consistency. (1)</p><p><strong>Synchronous and Asynchronous finality<br></strong>In the former, the network operates in rounds with known and fixed time intervals for each round. Once a block is validated, it is considered final. There is no time lag between the block validation and finality and these two steps are sequential. Synchronous finality is more deterministic and offers strong guarantees about the state of the blockchain. It is often used in blockchain networks which have applications such as real-time payments or critical financial transactions.</p><p>Asynchronous finality, on the other hand, does not rely on time intervals. It allows for a more continuous process of reaching an agreement on block confirmation. Blocks can be confirmed and finalised at different times and do not have to be sequential. It allows for more flexibility in dynamic environments, such as when a lot of validators are offline or there is a network failure.</p><p>Various blockchains also assume <strong>partial synchronous networks</strong> which is a middle ground between asynchronous and synchronous networks. In this model, there is an assumption that the network eventually becomes synchronous but there is no guarantee when that transition will occur. Initially, the network may face some network failure or snag and display asynchronous behaviour. Still, over some time the network gradually transitions to smoother message delivery within a known time frame and better network behaviour.</p><p><strong>Forking </strong><br>Before we move ahead, we need to make ourselves familiar with <strong>‘forking’</strong>. A block contains the hash of the previous or the parent block to identify the sequence of blocks in a chain. When two blocks have the hash of the same parent block, forks are made. This creates a new branch or version of the blockchain. Forking happens for two reasons — <br>1. Major updates in protocol <br>2. Network delays or disagreements within the community such that two block proposers produce blocks in the same slot.</p><p>Forking due to disagreements can fragment the community, resources and development efforts making it harder to achieve consensus. It also compromises the security of the network and hurts the economic model of the blockchain.</p><p>Let us deep-dive into how some popular blockchains achieve finality.</p><p><strong>Ethereum<em><br></em></strong>The method of achieving finality changed for Ethereum as they shifted from Proof of Work to Proof of Stake (Eth2.0). We have already seen in the article on consensus mechanisms that Ethereum has a time system that it follows to create and validate blocks. A block is produced in every slot (one slot = 12sec) and an epoch is made of 32 such slots, which makes it 384 seconds or 6.4 minutes long. This means that every epoch has 32 block proposers and produces 32 different blocks. Every one who shall vote for these blocks in every slot is called an <strong>‘attestor’</strong>.</p><p>Now that we have covered the basics, we can talk about the finality gadget Eth2.0 uses called ‘<strong>CASPER FFG</strong>’, where FFG stands for ‘friendly finality gadget’. It is also a BFT protocol that assumes that 1/3rd of the total number of validators are malicious. To understand it better, assume that there are 3 sequential epochs and we name them A, B and C as seen in the figure below. Before epoch <strong>A</strong>, there was an epoch <strong>N</strong>. During <strong>A</strong>, 32 blocks were produced (one in each slot) and the same follows for epoch <strong>B</strong>. We shall also suppose that epoch C has just begun so the blocks for epoch C are still being produced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YVvK7IDibSLSKVEe_pPaaQ.png" /></figure><p>Now the job of the finality gadget starts. Finalisation does not happen for every block but for an epoch. CASPER FFG assigns the first block produced during every epoch to be a <strong>‘checkpoint’</strong>. This means that the first block in epoch N, called N1, and the first block in epoch A, called A1, become checkpoints. During the production of blocks in epoch B, assuming I am one of the validators, I will tell the network that I believe that checkpoint A1 is valid. This means that I have broadcasted an attestation for the checkpoint of epoch A. Once I do this, all the nodes in the network start to think if they find A1 valid or not. If they do, they further broadcast their attestations or votes on the network. If more than ⅔ of the validators broadcast for the same checkpoint, the checkpoint A1 becomes <strong>‘justified’</strong>. This is the first round which ‘justifies’ a checkpoint. When a checkpoint gets justified, all the blocks <strong>preceding the checkpoint in the previous epoch are justified</strong>. So all the blocks from N1 to N32 are now justified.</p><p>The second round leads to the <strong>finalisation</strong> of checkpoint A1. This happens when epoch C has begun. In this round, I tell the network that A1 checkpoint has been justified and the collective opinions I gained from round 1 (the attestations from my local network). Then I shall also gather the attestations from the rest of the network i.e. outside my local network. If I get more than 2/3rd of the votes from the entire network, the checkpoint gets finalised. (Refer to the figure below)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UY3pipqpB_aHuahj7W5JrQ.png" /><figcaption>Fig. Example to understand how CASPER FFG functions</figcaption></figure><p><strong>Under ideal conditions, it takes one epoch to justify a checkpoint and another epoch to finalise the same checkpoint</strong>. At the start of epoch C, we are aiming to justify checkpoint B1 and to finalise checkpoint A1. This means that while B1 checkpoint was justified during epoch C, It would only get finalised during epoch D. The finalisation also happens only if the network gives a ⅔ majority for B1.</p><p>This entire process of voting for both rounds is spread out during the entire duration of an epoch. But one can imagine that there are thousands of validators and these thousands of validators would send thousands of messages simultaneously which will create a lot of confusion. To avoid this confusion, in each slot, only 1/32 of the total validator set is scheduled to broadcast a vote. This means each validator gets to vote only once during an epoch. Also, each of these validator votes is weighted based on the amount of ETH that has been staked by them.</p><p>Finality is achieved in 12.8 minutes i.e. 6.4 minutes for the checkpoint to get justified and another 6.4 minutes for it to reach finality. But as two rounds overlap and are pipelined, the finalisation of some checkpoint always happens every 6.4 minutes. Network congestion is one of the reasons for the delay in finalisation due to which it has also taken approximately 14 minutes to finalise a checkpoint. (1) Ethereum’s CASPER FFG leads to <strong>deterministic finality</strong> in the blockchain.</p><p><strong>NEAR<em><br></em></strong>The process of achieving finality in Near protocol and Ethereum can be considered similar if not the same, one of the differences being the use of checkpoints and a round of finalisation in Ethereum. In Near, finality is achieved using ‘<strong><em>Doomslug</em></strong>’ and a finality gadget called ‘<strong><em>Casper NFG</em></strong>’ or ‘Casper Nightshade Finality Gadget’. Doomslug allows the participants that have been chosen in an epoch (epoch = one day) to produce and broadcast blocks over the network. To understand what Doomlug does, we shall assume that there is a block at height ‘h’ called <strong>A</strong>. The height of a block is a way of indicating how many blocks have been added before a certain block. So if the height of A is 1000, this would mean that 999 blocks have been added before A.</p><p>Doomslug chooses a proposer out of the validator set to produce <strong>A</strong>. Once <strong>A</strong> has been produced, it is broadcast to the entire network. All the participants who have received the block shall check the validity of all the transactions that have been included in the block and show their faith or confidence in it if they find the block to be valid. To display this confidence in block A, participants send their endorsements or signatures to the participant responsible for producing the next block which has a height of ‘h+1’. If the producer for the next block named <strong>‘B’</strong> has more than half the endorsements for Block A, he will produce block <strong>B</strong>. But, if after some predetermined time, the block producer for B does not produce the block, the endorsements are sent to the block producer responsible for producing the block at height ‘h+2’ or block <strong>C</strong>. Once the block producer of <strong>C</strong> receives more than half of the endorsements to proceed, he proceeds to produce <strong>C</strong>. (3)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jpKeruslOpS-4C9AcZoD5g.png" /></figure><p>One can conclude that every block has the endorsements of more than half the participants for the previous block. In this case, block B contains over half the endorsements for block A. Considering these endorsements, the finality gadget of the protocol declares block A to have less than full finality or as it is called, ‘<strong><em>Doomslug Finality’</em></strong>. This means that A is not 100% final but somewhere mid-way. This is considered as one round of communication. Block A is now irreversible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j1ZbUiarMjbKTS5z1w1auA.png" /><figcaption>Fig. When a block is being produced, the previous block gets ‘Doomslug finality’ and the second to last block gets ‘BFT finality’</figcaption></figure><p>Similarly, block C has more than half the endorsements for block B, thus giving Doomslug finality to B. But what happens to A? Once block C has been produced and block B has received Doomslug finality, block A reaches <strong>full BFT finality</strong>. This is considered round two of communication. The above explanation indicates that <strong>when a block at height ‘h+2’ or C is created, the block at height ‘h+1’ or B reaches Doomslug finality and the block at height ‘h’ reaches full BFT finality</strong>. By extension, if a block at height ‘h+3’ or D is created, block at height ‘h+2’ or C reaches Doomslug finality and block at height ‘h+1’ or B reaches full BFT finality. Thus, it takes a block of 2 rounds of communication to reach full BFT finality.</p><p>To reverse a block that has achieved full BFT finality, ⅓ of the total stake deposited by the participants would have to be slashed. (4)</p><p><strong>There is a Part 2!<br></strong>To make sure that the article does not become too difficult to read, we decided to split and serve it in two parts. The second part will discuss finality in Solana, Cosmos and Polkadot.</p><p>Stay tuned!</p><p><strong>References</strong> <br>1. <a href="https://medium.com/mechanism-labs/finality-in-blockchain-consensus-d1f83c120a9a">https://medium.com/mechanism-labs/finality-in-blockchain-consensus-d1f83c120a9a</a></p><p><a href="https://eth2book.info/capella/part2/consensus/casper_ffg/">2. https://eth2book.info/capella/part2/consensus/casper_ffg/</a></p><p><a href="https://near.org/blog/doomslug-comparison">3. https://near.org/blog/doomslug-comparison</a></p><p><a href="https://near.org/papers/proof-of-space-time">4. https://near.org/papers/proof-of-space-time</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a2472aea926" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aerius-labs/understanding-finality-part-1-blockchain-for-dummies-2a2472aea926">Understanding Finality- Part 1| Blockchain for Dummies</a> was originally published in <a href="https://medium.com/aerius-labs">Aerius Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[User Anonymity in an adversarial environment: Exploring Rate Limiting Nullifiers using Zero…]]></title>
            <link>https://medium.com/aerius-labs/protecting-user-anonymity-exploring-rate-limiting-nullifiers-using-zero-knowledge-proofs-2b97e7b68e52?source=rss----80c2f6b3647f---4</link>
            <guid isPermaLink="false">https://medium.com/p/2b97e7b68e52</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Shreyas Londhe]]></dc:creator>
            <pubDate>Sat, 03 Feb 2024 12:16:08 GMT</pubDate>
            <atom:updated>2024-02-03T12:19:08.093Z</atom:updated>
            <content:encoded><![CDATA[<h3>User Anonymity in an adversarial environment: Exploring Rate Limiting Nullifiers using Zero Knowledge Proofs</h3><h3>Introduction</h3><p>In today’s digital landscape, striking a balance between user privacy and safeguarding against spam and abuse is a paramount challenge. While conventional spam protection methods often compromise anonymity, privacy-preserving applications require innovative approaches to maintain user privacy while effectively combating malicious activities. One such solution is the implementation of Rate Limiting Nullifiers (RLN) using Zero Knowledge Proofs (ZK). In this article, we will explore how RLN and ZK enable a privacy-preserving approach to spam protection, ensuring the anonymity of users in applications that value privacy.</p><h4>Spam Protection and Privacy: A Delicate Dilemma</h4><p>In the quest for reaching a large user base, online applications constantly grapple with the issue of spam protection. Traditional techniques, such as user identification or IP blocking, prove effective in thwarting spam. However, they come at the expense of user privacy, rendering them unsuitable for applications that prioritize anonymity, such as privacy-preserving chat platforms or online voting systems.</p><p>To better understand the significance of Rate Limiting Nullifiers (RLN) using Zero Knowledge Proofs (ZK), let’s consider a straightforward example: an <em>anonymous voting application</em>. In this context, the primary security goals revolve around two crucial aspects:</p><ol><li><strong>Preventing Denial of Service (DoS) Attacks: Ensuring One Vote per User within the Allotted Time Frame —</strong> In an anonymous voting application, it is vital to limit users to casting only one vote within a specific time frame, often referred to as an <em>epoch</em>. This measure serves as a defense mechanism against spamming and potential Denial of Service (DoS) attacks. By imposing a rate limit on voting activities, the application can maintain the integrity of the voting process and prevent malicious actors from overwhelming the system.</li><li><strong>Safeguarding Against Sybil Attacks: Mitigating Identity Replication — </strong>Another critical security concern in anonymous voting applications is guarding against Sybil attacks. A Sybil attack occurs when an adversary attempts to create multiple fake identities to influence the voting outcome unfairly. To maintain the integrity of the voting process, it is crucial to prevent users from easily replicating identities, thus ensuring that each individual has only one voting identity.</li></ol><p>Rate Limiting Nullifiers using Zero Knowledge Proofs present an elegant solution to address these security goals in anonymous voting applications. By employing RLN with ZK, the application can enforce rate limits and prevent multiple votes from a single user, all while preserving the anonymity of voters.</p><h4>WTF are Zero Knowledge Proofs</h4><p>For someone who has reached this point but still wondering wtf are Zero Knowledge Proofs, let me explain briefly.</p><p>Zero Knowledge Proofs (ZKPs) are a clever cryptographic technique that lets someone prove they know something without revealing the actual information. It’s like showing someone you have a secret code without actually telling them what the code is. ZKPs are used to ensure privacy while still proving that someone has certain knowledge or meets certain conditions. They’re a powerful tool for building secure systems where people can authenticate themselves without giving away sensitive information.</p><p>ZKPs are awesome and there are tons of resources on them <a href="https://github.com/matter-labs/awesome-zero-knowledge-proofs">here</a></p><h3>The Protocol: Unveiling its Three Key Components</h3><p>The Rate Limiting Nullifier (RLN) Protocol comprises <em>three</em> fundamental parts that work together seamlessly to enable effective rate limiting while preserving user privacy and anonymity.</p><ul><li><em>User Registration</em></li><li><em>User Interaction</em></li><li><em>User Removal</em></li></ul><p>Let’s understand each component in detail.</p><h4>User Registration</h4><p>Users are required to stake a valuable asset and generate a secret key. By hashing the secret key and adding it to the Registry Merkle Tree, the protocol ensures a unique and verifiable user presence. This prevents users from easily generating multiple identities, promoting fairness and integrity in rate limiting.</p><p>The Registry Merkle Tree serves as cryptographic proof of user existence within the RLN Protocol. By incorporating hashed identity commitments, the tree verifies the presence of each user in the system. This mechanism strengthens identity integrity, mitigates the risk of identity replication, and establishes a reliable foundation for subsequent interactions.</p><h4>User Interaction</h4><p>Each user interaction with the application requires the generation of a zero-knowledge proof. This proof assures verifiers, such as servers in centralized applications or other users in decentralized applications, that the user is a valid member with their identity commitment included in the membership Merkle tree.</p><p>Interactions vary depending on the application, such as voting in a voting application or sending messages in a chat application. To prevent spam, an anti-spam rule is introduced, often in the form of limiting the number of interactions per epoch.</p><p>For simplicity, let’s consider the rule as <em>“Users must not send more than 1 message per second.”</em></p><p>The anti-spam rule is implemented using <a href="https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing">Shamir’s Secret Sharing</a> scheme, which enables secret sharing through polynomials. By splitting the user’s secret key into shares, a minimum number of shares is required to reconstruct the original secret. In this case, a 2/2 Shamir’s Secret Sharing scheme with a linear polynomial is used, meaning the user’s secret key can be reconstructed if they send two votes per epoch.</p><p>To ensure validity, the user’s zero-knowledge proof must include shares of their secret key (the X and Y shares) and the epoch. If any of these fields are missing, the proof is considered invalid. By exceeding the allowed number of interactions per epoch, users risk full reconstruction of their secret key by the verifiers, as each interaction leaks a portion of it. This ensures the <em>Rate Limitng</em> factor of the protocol.</p><h4>User Removal</h4><p>Once a user exceeds the maximum number of interactions allowed, the protocol automatically exposes all the shares of their secret key. Since all the shares are public, anyone can recreate the spammer’s secret key. The spammer is then slashed, i.e removed from the Registry Merkle Tree and the first user to report the spammer gets the spammer’s stake as a reward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbRnmb1vGf4TmPl0U80j6A.png" /><figcaption>Figure 1: The RLN protocol flow</figcaption></figure><h3>Use Cases: Applying the RLN Construct in Anonymous Environments</h3><p>The Rate Limiting Nullifier (RLN) construct has a wide range of applications in environments where user identities are anonymous. Any application that facilitates interactions among users with anonymous identities can greatly benefit from spam protection provided by the RLN construct.</p><p>Here are a few interesting use cases where the RLN construct can be applied and explored:</p><ol><li>Private communication channel for ETH2 validators: The RLN construct can be utilized to establish secure and private communication channels among validators in the Ethereum 2.0 network. This enables confidential information exchange while preventing spam and ensuring the integrity of the network.</li><li>Instant messaging applications for private and anonymous communications: By implementing the RLN construct, instant messaging applications can maintain user privacy and anonymity while effectively combating spam and abuse. Users can engage in private conversations without the fear of identity disclosure or excessive spamming.</li><li>Cloudflare-like service with RLN for spam protection: RLN can be employed as an alternative to traditional CAPTCHA mechanisms in services similar to Cloudflare. By incorporating RLN-based spam protection, these services can maintain user anonymity and privacy while effectively filtering out spam and malicious activities.</li><li>Decentralized, anonymous voting applications: The RLN construct can play a pivotal role in decentralized voting applications, ensuring fair and secure elections while preserving voter anonymity. By implementing rate limiting and anti-spam measures, the RLN construct enhances the integrity of the voting process.</li><li>Privacy-preserving peer-to-peer networks: Peer-to-peer networks that prioritize user privacy can leverage the RLN construct to prevent spam and abuse within the network. This enables secure and anonymous file sharing, communication, and collaboration among network participants.</li></ol><h3>Further Reading</h3><ul><li>Technical Overview of RLN — <a href="https://rate-limiting-nullifier.github.io/rln-docs/protocol_spec.html">https://rate-limiting-nullifier.github.io/rln-docs/protocol_spec.html</a></li><li>Great video explaining Shamir’s Secret Sharing — <a href="https://www.youtube.com/watch?v=K54ildEW9-Q">https://www.youtube.com/watch?v=K54ildEW9-Q</a></li><li>A great way to get coding ZK Circuits — <a href="https://github.com/ConsenSys/gnark">https://github.com/ConsenSys/gnark</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b97e7b68e52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aerius-labs/protecting-user-anonymity-exploring-rate-limiting-nullifiers-using-zero-knowledge-proofs-2b97e7b68e52">User Anonymity in an adversarial environment: Exploring Rate Limiting Nullifiers using Zero…</a> was originally published in <a href="https://medium.com/aerius-labs">Aerius Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decoding Consensus | Blockchain for Dummies— Part 2]]></title>
            <link>https://medium.com/aerius-labs/decoding-consensus-blockchain-for-dummies-part-2-98e2c2eb9c5e?source=rss----80c2f6b3647f---4</link>
            <guid isPermaLink="false">https://medium.com/p/98e2c2eb9c5e</guid>
            <category><![CDATA[polkadot]]></category>
            <category><![CDATA[near-protocol]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cosmos]]></category>
            <category><![CDATA[tendermint]]></category>
            <dc:creator><![CDATA[Ranamahima]]></dc:creator>
            <pubDate>Thu, 25 Jan 2024 09:14:39 GMT</pubDate>
            <atom:updated>2024-01-25T09:14:39.183Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>In the first part of the article, we discussed the fundamentals of consensus mechanism and delved into the mechanisms used by Ethereum and Solana to achieve consensus within their respective blockchain networks. In this part, we will discuss the mechanisms employed by Polkadot, Cosmos and Near blockchains. For background and terminology, read the first part at </em></strong><a href="https://blog.aeriuslabs.org/decoding-consensus-blockchain-for-dummies-part-1-c9cb71609e11">https://blog.aeriuslabs.org/decoding-consensus-blockchain-for-dummies-part-1-c9cb71609e11</a></p><p><strong><em>Let’s dive into the second part<br> <br></em>Polkadot</strong></p><p>Polkadot uses something called <strong>“Nominated Proof of Stake</strong>”. It has two main actors — validators and nominators.</p><ul><li>Validators are responsible for validating the transactions</li><li>Nominators nominate the validators they support</li></ul><p>NPoS encourages everyone who holds the native token, DOT, to become ‘nominators’. A person should stake a minimum of 250 DOT to express an intention to nominate. (This value keeps on changing in every era, a specific period of time during which certain events take place). An interesting thing to note, in Polkadot, is that anyone can display an interest in being a validator. A list of all the interested validators is sent to all the nominators. Each nominator can then share a list of 16 validators they support. After this, the distribution of stake takes place where nominators allocate their tokens or their stake to the validators they support. The interested validators with the highest support or staking become active validators and the network then distributes the stake evenly amongst all the validators, maximising security.</p><p>Currently, the minimum stake backing a validator in the active validator set is 2055241.409 DOT in the era 1269. For any node to become a validator, he should be able to stake the ‘minimum amount + 1’ DOT.<br>(Era is 24 hours on Polkadot) (Source — <a href="https://support.polkadot.network/support/solutions/articles/65000168050-what-is-an-era-)">https://support.polkadot.network/support/solutions/articles/65000168050-what-is-an-era-)</a></p><p>Hence, the staking is not just done by the validators but by the nominators also who are backing a validator as seen in Fig.1. Both the parties have a stake in the network. They can earn rewards for their participation and a penalty is charged on both the nominators and validators in case of any malicious activities by the validator.</p><p>Nominated proof of stake is an extended version of the proof of stake consensus mechanism. When a validator is chosen and successfully validates transactions, it earns rewards in the form of additional tokens. These rewards contribute to the validator’s increased token holdings, further enhancing their chances of being selected as a validator. However, if only self staking (a validator only puts up their own tokens forstaking ) can cause relative concentration of stake and repeated selection can potentially challenge the decentralisation aspect of the blockchain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*49ntFtyonH_m9oMsywUQig.png" /><figcaption>Fig.1. The diagram is a simple representation of how NPoS works</figcaption></figure><p>The process of reaching consensus is very similar to that of Ethereum itself and for that reason, we are not repeating it here. While Polkadot claims that NPoS alleviates the centralisation problem to a great extent by allowing all participants (token holders) to become nominators and earn rewards by backing the desired validator, a similar problem might plague NPoS as well. Nominators with higher stakes might only support one validator again and again thus leading to centralisation and biases. NPoS may also suffer from lower participation which can again skew the mechanism towards a few validators.</p><p><strong>Cosmos</strong></p><p>Cosmos moves away from just using PoS by adding BFT (explained ahead) to its mechanism. Cosmos is not just one blockchain but a network of multiple blockchains that can interact with one another. One of the many things that we have learnt till now is that every blockchain has its consensus mechanism, but the same is not the case with Cosmos. From an architecture point of view, blockchains can be divided into three different layers — <strong>application layer</strong> which processes transactions, <strong>networking layer</strong> which propagates messages and <strong>consensus layer</strong>. Cosmos packages the networking and consensus layer of the blockchain into a generic engine (making it a common feature) so that developers can create new application layers on top of it. (1)</p><p>Cosmos uses <strong>‘Tendermint’</strong> and a <strong>Byzantine</strong> <strong>Fault</strong> <strong>Tolerance</strong> (BFT) engine to power itself. Tendermint uses the Proof of Stake algorithm to achieve BFT. Just like any other PoS blockchain, Cosmos also requires its participants to stake its native token (ATOM) to become a validator. As we have read before, a block proposer proposes a block i.e. he will validate the transactions sent to him through the network, put it inside the block, and then send this block to all the validators for voting.</p><p><strong>What is BFT?</strong><br>In any decentralised network, there is always a probability that some validators may behave maliciously or attempt to disrupt the proper functioning of the network. Such validators are known as <strong>Byzantine</strong> <strong>validators</strong>. BFT is a property that ensures that a system can function correctly even when a certain number of participants are acting maliciously. Tendermint’s consensus algorithm is designed to tolerate up to one-third of the total number of validators misbehaving. That means as long as less than one-third of the validators are acting maliciously, the system can still reach a consensus on the valid state of the blockchain.</p><p>Malicious behaviour in the cosmos network can consist of multiple scenarios. These include the inclusion of invalid transactions in a block by the proposer or multiple validators trying to create a block together at the same time i.e. in the same slot. This would create a conflict as to which block should be the next one to be added to the chain. When this happens, during voting, validators may get confused and vote for more than one block to be the next in the chain. To add to that, malicious validators may also collude with each other to vote for a block containing invalid transactions or for multiple blocks. BFT accounts for all of these malicious nodes by already assuming their existence in the network and hence, the multi-step process acts on a two-thirds majority.</p><p><strong>How the consensus mechanism has been designed to allow for one-third of malicious actors without hampering the validation process?</strong>Tendermint’s protocol is a multi-step process, each with certain roles and responsibilities of the validators. The first is proposing where a single validator acts as a <strong>block</strong> <strong>proposer</strong>, who creates a block with all the valid transactions. The next step is <strong>‘pre-voting’</strong>. Once the block proposer creates the block, he broadcasts it to the network. Other validators then independently validate the proposed block and cast their ‘<strong>pre-votes</strong>’. A pre-vote indicates that a validator has checked the proposed block and finds it valid based on the consensus rules of the protocol.</p><p>The third step is ‘<strong>pre-committing</strong>’. Once a proposer receives a sufficient number of pre-votes (two-thirds of the total voting power), they move to this phase. During pre-commit, the proposer broadcasts a <strong>pre-commit vote</strong> to the network. This vote includes the hash of the proposed block they pre-voted for. Essentially, a pre-commit vote means that a validator is ready to commit the proposed block to the blockchain if the block gathers enough support from other validators. Finally, if a block receives two-thirds or more pre-commits, it moves to the <strong>‘commit’</strong> phase. During this, the proposed broadcasts a final “commit” vote to the network, confirming the proposed block’s validity. Once two-thirds of the validators have committed to the same block, the block becomes confirmed and is added to the blockchain as the next block. At this point, it is considered the canonical version of the blockchain’s state. The diagram below is a representation of the entire process that a block has to go through.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWR143r4bd6y0LbpHpFjyw.png" /><figcaption>Fig.2. This framework explains how BFT in Tendermint works in the Cosmos protocol</figcaption></figure><p><strong>Near Protocol</strong></p><p>Another version of PoS is ‘Thresholded Proof of Stake’ which is being used by NEAR as its consensus mechanism. The underlying concept is very similar to the usual PoS where the participants have to stake a certain number of native tokens, NEAR tokens in this case, into their accounts to be considered to become a validator. As soon as this transaction is made, the deposits are locked for three days. In the NEAR environment, participants are known as ‘witnesses’.</p><p>NEAR also uses a time system to function smoothly which consists of slots and epochs. To increase decentralisation, the protocol is built such that a large number of participants make decisions during a specific interval of time. This interval is fixed at one day as a default. Each interval is split into a large number of block slots — 1440 slots per day i.e. one slot per minute with a large number of participants/witnesses per block, which is also fixed at a default number of 1024. With these defaults, the number of witness seats available makes up to 1,474,560 (1024*1440 = 1474560) that need to be filled for one day. (2)</p><p>A seat is the number of votes a participant can cast in the consensus protocol. Every seat is then auctioned to all the participants and there is a threshold number of tokens that have to be deposited to get a seat. This threshold amount of each seat is decided by a pre-designed formula which is a ratio of the total number of tokens staked by all the willing participants to the total number of seats. At the end of each day, all deposited tokens are counted and the calculation is done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qhp4aGSvvul-MEYbxxsHGg.png" /><figcaption>Fig. 3. Representation of the example given below. <br>Source — <a href="https://near.org/blog/thresholded-proof-of-stake">https://near.org/blog/thresholded-proof-of-stake</a></figcaption></figure><p>Let us take an example to understand the process better. Imagine there are 6 participants, A, B, C, D, E and F. (Refer to the table below). Let us assume A has staked 1,200,000 tokens, B has staked 700,000 tokens, C has staked 450,000, D has staked 450,000, E has staked 149,199 and finally F has staked 1 token. This makes the total number of tokens equal to tokens. Thus, the threshold amount per seat will be 2,949,200/1474560 which is equal to 2 tokens per seat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*LbLEBs_knWcXD62Enq9uNw.png" /></figure><p>According to our calculation, A has the highest number of seats and thus can vote the highest number of times. As one can notice, one block slot has 1024 seats to be filled. This means A will be allocated seats in more than one block slot and this allocation will be done by pseudorandom permutation. A pseudorandom permutation in simpler terms is a function that uses a specific algorithm and a secret key but to the observers, it seems to be completely random as they do not know the secret key being used.</p><p>Once the validator set (validators voting per block) has been chosen, the block proposer proposes a block after verifying all the transactions that are supposed to be a part of that block. This block is then broadcasted to the validator set which again validates the transactions and checks for any malicious transactions. Once the block proposer receives a supermajority i.e. a positive vote from 2/3rd of the validator set, the block is finalised and made a part of the blockchain. As an incentive for participating in the consensus mechanism, the witnesses are given an inflated reward i.e. an inflation rate is proposed to be defined as the percentage of the total number of tokens and then divided amongst the witnesses as per their deposits. In case a witness blocks two different blocks, their deposits are forfeited or slashed. One day after the witness stops being a part of the consensus protocol, his deposit is unlocked and can be used freely.</p><p><strong>Conclusion</strong><br>All the above blockchains have used PoS as the foundation to build their consensus mechanisms. The reason why PoS is used so widely is because firstly, it does not require the validators to put in extensive computing power to mine blocks, like Proof of Work did. Secondly, PoS also encourages good behaviour from the validators by rewarding them for voting for the right blocks. It also discourages malicious behaviour by introducing ‘slashing’ thus increasing accountability for validator’s actions. The various versions of PoS that have been introduced focus on increasing decentralisation in the blockchain’s consensus protocol by including as many participants as possible. These also, in certain blockchains, increase security (adding BFT) and reduce the time taken to finalise the blocks once they have been created (such as in PoH). Ultimately, each blockchain’s consensus mechanism is tailored to meet specific needs, attracting developers, enterprises and users with distinct requirements. As the blockchain industry continues to evolve, these mechanisms will drive the future of decentralised applications, bringing us closer to a more inclusive and interconnected digital world.</p><p><strong>References</strong> -<br>1.<a href="https://v1.cosmos.network/intro">https://v1.cosmos.network/intro</a><br>2. <a href="https://near.org/blog/thresholded-proof-of-stake">https://near.org/blog/thresholded-proof-of-stake</a><br>3. <a href="https://wiki.polkadot.network/docs/faq">https://wiki.polkadot.network/docs/faq</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98e2c2eb9c5e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aerius-labs/decoding-consensus-blockchain-for-dummies-part-2-98e2c2eb9c5e">Decoding Consensus | Blockchain for Dummies— Part 2</a> was originally published in <a href="https://medium.com/aerius-labs">Aerius Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decoding Consensus | Blockchain for Dummies - Part 1]]></title>
            <link>https://medium.com/aerius-labs/decoding-consensus-blockchain-for-dummies-part-1-c9cb71609e11?source=rss----80c2f6b3647f---4</link>
            <guid isPermaLink="false">https://medium.com/p/c9cb71609e11</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[solana-blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[consensus]]></category>
            <dc:creator><![CDATA[Ranamahima]]></dc:creator>
            <pubDate>Mon, 22 Jan 2024 17:25:54 GMT</pubDate>
            <atom:updated>2024-01-22T17:25:54.117Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QNZnIZAwpcLhIzY_XddN0g.jpeg" /></figure><p>Blockchains have changed the way we access and utilise various services. We can now transfer assets directly without relying on intermediaries, establish decentralised organisations governed by participants, execute contracts automatically without intermediaries, and much more. However, the absence of a central authority raises questions about ensuring the integrity of activities and decisions regarding future blockchain upgrades. How can participants trust that actions conducted on blockchains are in good intent? Moreover, without centralised governance, how do we determine which features should be incorporated in the next upgrade? Addressing these concerns is crucial to utilise the full potential of blockchain technology. That is where the consensus mechanism, a core concept of blockchains, steps in.</p><p><strong>What is a Consensus Mechanism?</strong><br>Consensus means to agree on something. A consensus mechanism in a blockchain is like an algorithm that allows all the participants in a network to come to a mutual agreement regarding the ledger’s state. The state involves information on account balances, smart contracts, transaction history, permission and access control, metadata, etc. A state change can be as small as subtracting tokens from one account and adding to another. The state acts as a foundation for trust and security in a decentralised computer network by enabling all the nodes to reach a consensus without relying on a central authority.</p><p>Let us assume that there is a group of kids who are playing a game but have forgotten the score. An argument ensues where they are trying to decide what the current score is. To ensure that everyone agrees on the score, a consensus mechanism is decided. This is known as the <strong>Proof of Agreement </strong>as it considers everyone’s opinions to achieve a consensus<strong>. </strong>Every time a point is scored, every participant announces what they believe to be the score. For example, kid A may say that the score is 3–2 but kid B believes that the score is 4–1. Now each player announces their score one by one and they try to reach an agreement. They can share their reasons, present evidence and try to convince each other that their score is right. The discussion continues till they reach an agreement. This is the activity of <strong>consensus building</strong>. Once an agreement is reached, all the players verify the agreed-upon score. They check if it aligns with their understanding and if it makes sense to them. If everyone finds the agreed valid score valid, consensus is achieved. This is the process of <strong>verification</strong>. The last step is <strong>record-keeping</strong> where the decided score becomes the game’s current score. This score will now be used for any future reference. This is how consensus mechanisms work with the participation of all the members and without the presence of any central authority.</p><p>Before we hop onto a more technical explanation, there is a need to understand certain terms that are frequently used in this article.</p><p><strong>Terminology</strong></p><ul><li><strong>Transaction</strong> — With reference to blockchain, a transaction is a single unit of activity. It typically involves the transfer or modification of assets or information between participants and signifies ‘state change’ in a ledger.</li><li><strong>Block</strong> — When a certain number of transactions are brought together, they form a block. The number of transactions in a block varies from one blockchain to another.</li><li><strong>Block Header</strong> — A block header is used for identifying a block in a blockchain. It contains metadata and necessary information for it to be identified and function easily. One can think of it as a fingerprint as it is unique for each block.</li><li><strong>Tokens</strong> — Every blockchain has a cryptographic representation of a tradeable asset. Tokens are particularly useful to become a part of the consensus mechanisms in some of the blockchains.</li><li><strong>Node</strong> — Nodes are essentially network stakeholders and their devices which are authorised to keep track of the distributed ledger and serve as communication hubs for various tasks. If a node participates in the consensus mechanism, they are termed as validators, else they are just referred to as ‘<strong>Full nodes</strong>’. And a <strong>network</strong> is a collection of nodes that communicate with each other to share information.</li><li><strong>Gossip Network </strong>— A gossip network is a communication model where nodes share information through a process of exchanging information in a peer-to-peer fashion.</li></ul><p><strong>Characters in the block creation and validation process</strong></p><ul><li><strong>Validator</strong> — A subset of Full Nodes that participate in the consensus mechanism by voting.</li><li><strong>Block proposer</strong> — A validator node that proposes the block, decides which transactions shall become a part of the new block and also, builds the block. They also propagate the block on the network to their peers. After block creation, validators vote to decide the validity of the block.</li></ul><p>We can see in Fig.1. that a block proposer is chosen from the set of validator nodes and each validator node is also a full node. Each validator node is a full node but vice versa is not true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Xvu5j7j5R-KBpYCyeu7Q0Q.png" /><figcaption>Fig.1. Block proposer node is a subset of the Validator node set which in turn is a subset of Full nodes.</figcaption></figure><p>All thee characters mentioned above participate in the consensus process, as seen in Fig.2. The figure also displays how transactions and blocks achieve consensus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F0JALwASsWc0-UVy" /><figcaption>Fig.2. Gives an overview of a transaction travels and consensus is achieved</figcaption></figure><p>As we have said before, every blockchain uses a different consensus mechanism. We will now delve into the methodologies some of the popular chains use to achieve consensus.</p><h3><strong><em>Ethereum</em></strong></h3><p>In 2022, Ethereum transitioned to the “<strong>Proof of Stake</strong>” consensus mechanism. In Proof of Stake, interested participants, who wish to become validators, must stake a specific amount of ETH (native token of Ethereum) to participate in the consensus. To become a validator, the participants need to deposit ETH, currently set at 32ETH, into a deposit contract. This amount acts as collateral and demonstrates the validator’s commitment to the network. This is a mandatory requirement to become a validator. Once the ETH has been deposited, the user joins the activation queue.</p><p>Every node in Ethereum has to run two clients — a consensus and an execution client. A client is a software that participates in the Ethereum network. The description, role and function of both the clients is explained in the Fig.3. below. Both clients run in parallel and relay information and instructions during the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bRPNNEF7OpPBIejL" /><figcaption>Fig.3. Role of the Execution and Consensus client in an Ethereum node.</figcaption></figure><p>In case, a node wants to act as a <strong>validator</strong>, a third software for the validator can be run on the consensus client which allows it to attest to blocks and propose them, if chosen as a proposer. The functions of both the clients will become clearer once we see the process flow.</p><p><strong>Process Flow</strong></p><p>To understand the process flow, assume there are two individuals — A and B. A and B both are validators.</p><p>A receives a notice saying that he is the next block proposer.</p><ul><li>A’s consensus client calls ‘create block’ in the execution client.</li><li>The execution client accesses the transaction pool (where all the transactions sent by all the validators are collected).</li><li>The execution client bundles all in a block, executes them and generates a block hash (a unique number that will identify the block).</li><li>The consensus client takes the transactions and the block hash from the execution client and adds them to the block.</li><li>The consensus client broadcasts the block over the block gossip network and the consensus client of other nodes, such as B, receives it.</li></ul><p>After B receives it from the gossip protocol,</p><ul><li>the consensus client in the node pre-validates the block by ensuring that it arrives from a valid sender with the correct metadata.</li><li>The transactions from the block are sent to the node’s execution client(running in the same node) which executes the transactions and validates the state of the block header.</li><li>The execution client passes over this data back to the consensus client. The block is now considered to be valid.</li><li>The consensus client adds the block to the head of its own blockchain and attests to it, and broadcasts the validation vote to the network.</li></ul><p>If validators who hold 66% of the staked ETH attest or validate the block, it gets finalised and can never be removed in the future (Finality will be discussed thoroughly in our next article). To prevent any validator from acting maliciously, a process called ‘<strong>slashing</strong>’ has also been implemented. In case any validator gives his support or confidence to an invalid transaction or a malicious translation, his stake is slashed or confiscated. This is the process followed to reach a consensus in Ethereum. Ethereum follows a time-based system. Time is divided into slots (12sec) and epochs (32 slots). Blocks are produced in every slot which also means that 32 blocks are produced in every epoch.</p><p>Various other blockchains, such as Solana, Polkadot, Near and Cosmos have taken PoS and added their own twists to change certain processes. But at the very ground level, the rules of PoS remain the same i.e. requirement of staking a certain number of tokens to become validators.</p><h3><strong><em>SOLANA</em></strong></h3><p>Solana has implemented Proof of Stake along with a new mechanism known as ‘<strong>Proof of History</strong>’ or PoH. Both these mechanisms work in tandem to give us blocks whose time of origin can be seen. The PoS mechanism used by Solana requires participants to create a ‘vote account’ which must have a reserve of 0.02685864 SOL. Any participant who wishes to become a validator has to stake SOL. Validators are chosen to become leaders or block proposers based on their staking amount, the period of time for which they have staked etc. Solana’s blockchain is broken into slots and leaders are chosen ahead of each slot to avoid confusion.</p><p>The leader will be responsible for verifying the transactions and creating a new block. They receive all the transactions through the network and verify them for their validity. If found valid, the transactions shall be added to the block and if not, the transactions shall be discarded.</p><p>Before we begin understanding the PoH mechanism, we shall look at a few terminologies utilised in this process.</p><ul><li>The first one is a ‘<strong>hash</strong>’ function. A hash function is a function that takes any input given to it and converts it into a unique output of a fixed length or size.</li><li>What is special about a hash is that it is <strong>collision-resistant</strong>, which is the second term, which means that no two inputs will give the same output. The smallest amount of change in the input will change the output hash completely, thus making a hash completely secure. Let us imagine I give the function an input ‘book’ and name the output as hash0. A small change such as capitalising the first letter to ‘Book’ will change the output hash. Moreover, one can never trace back the input from the output hash.</li><li>Third is a <strong>blockhash </strong>which is a PoH hash for a particular slot (explained ahead) that can be thought of as a timestamp.</li></ul><p>PoH is a method for proving that transactions are in the correct sequence and found by the right leader. It uses a hash function to create hashes as fast as possible such that each output is the next input. This creates a series of loops and a snapshot of every loop is taken to record how much time was taken to create it.</p><p>The tabel given below shows the input and output in PoH. The hash of the previous block is passed from the previous leader to the current leader. The current leader continues the hashing process and keeps on adding transaction IDs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*inh8SDOXSz-Qes7Tz0Akyw.png" /></figure><p><strong>How do these hashes (called PoH hashes) help in the consensus mechanism? <br></strong>The first thing we need to know is that Solana also follows a time-based method by defining ‘slots’ which is a period during which a leader executes transactions and produces a block. Collectively slots create a logical clock. Slots are ordered sequentially and are non-overlapping</p><p>Secondly, Solana adds the time concept (in the form of PoH) to ensure security and prevent attacks related to the manipulation of the creation of blocks. The block producers hash transaction IDs into the stream of hashes to record which transactions were recorded in their block. PoH can be trusted because each hash must be produced sequentially. Each produced block contains a block hash and a list of hash checkpoints called <strong>‘ticks’</strong> so that validators can verify the full chain of hashes in parallel and prove that some amount of time has passed.</p><p>This proves that the block leader has taken time to correctly validate the transactions and add them to the block. It is not necessary that every input hash will have a transaction combined with it.</p><p>Every block in Solana has a timestamp. A timestamp is a recording of when a particular event or transaction had taken place. It is a combination of the previous hash (output), the index or the number of times the hash function has run (which is equal to the transaction number) and the data or the transaction itself. A timestamp allows the validators to check when a transaction has happened or whether it has even occurred or not. If a hash50 has been generated, we know that all the transactions from T1 to T50 have already been completed (according to the table above) and only then were they used to generate the hash output hash50. A timestamp allows us to go back into the past and confirm when a transaction was made and whether it was made or not.</p><p>One can think of PoH as a conveyor belt which puts a timestamp on every event that place, as is seen in Fig.4. These events can then be referred to in the future with the help of the timestamps put on them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VAkuG9LimPApOMna" /><figcaption>Fig.4. In Solana, every block has a timestamp put on it to know exactly when it was built. This is done using the PoH hashes.</figcaption></figure><p>Now comes the work of the <strong>validators</strong>. The validators are provided the entire list of the inputs (including the transactions) and the output hashes so they know what is supposed to be the output with every input they hash. Every validator can either verify all the hashes by himself or to reduce the amount of verification time can divide the list with fellow validators and then verify it. This division can be done for a few reasons.</p><ul><li>The list of hash checkpoints has been provided to them which allows them to know which transactions they are verifying.</li><li>Every validator has its core and because the one input will only give the output given in the list, they know what they are looking at.</li></ul><p>So if Validator1 runs the list from hash0 to hash10, and Validator2 verifies from hash11 to hash20, the collision-resistant property of hashes ensures that they know if there is any change in the sequence. Plus if there are n validator cores shall reduce the verification time to (1/n)th time.</p><p>For every block that a validator agrees with, he has to give a fee of 1.1SOL. If the validators give a super majority (2/3rd majority) that the leader has spent time ‘t’ to complete the process (time taken to get the output hash), the block is formed. This entire process uses the ‘Verifiable Delay Function’ where the leader has to prove that he has spent time ‘t’ to hash all the input hashes and transactions to give a final output hash. This will be proven if the validators also get the same output hash as an output when they run the process just like the leader did. Also, the validators do not vote for just the last output hash, they vote for every hash that is an output during the process. Essentially, the validators have to agree on the order of transactions to achieve consensus.</p><p>Imagine the validators see that two blocks have been produced at the same time. Both these blocks have a different output hash. This could get confusing because obviously, one of the blocks has been produced by a malicious participant. This is again where PoH helps. First thing to remember is hashes are unique and collision resistant, we know that any change in the input will change the output. Second thing to remember is that the previous leader has passed on the last output hash to the new leader. The validators can easily check which block is valid just by starting the verification from the last output hash of the previous leader, hashing it x number of times (x being the number of times the hashing was done while block building) and checking which block matches it to the output hash.</p><p>This article has been divided into two parts to enhance the reading experience and to ensure the information is more comprehensive. In the next part, we will discuss about the consensus mechanisms of Polkadot, Cosmos and Near protocol. Stay tuned!</p><p>References — <br>1. <a href="https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/">https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/</a><br>2. <a href="https://ethereum.org/en/developers/docs/networking-layer/#connecting-clients">https://ethereum.org/en/developers/docs/networking-layer/#connecting-clients</a><br>3. <a href="https://docs.solana.com/running-validator/validator-reqs">https://docs.solana.com/running-validator/validator-reqs</a><br>4.<a href="https://blockworks.co/news/what-is-solana-everything-you-need-to-know-about-the-ethereum-rival">https://blockworks.co/news/what-is-solana-everything-you-need-to-know-about-the-ethereum-rival</a><br>5. <a href="https://solana.com/solana-whitepaper.pdf">https://solana.com/solana-whitepaper.pdf</a><br>6. <a href="https://docs.solana.com/terminology#slot">https://docs.solana.com/terminology#slot</a><br>7. <a href="https://docs.solana.com/developing/transaction_confirmation#proof-of-history-refresher">https://docs.solana.com/developing/transaction_confirmation#proof-of-history-refresher</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9cb71609e11" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aerius-labs/decoding-consensus-blockchain-for-dummies-part-1-c9cb71609e11">Decoding Consensus | Blockchain for Dummies - Part 1</a> was originally published in <a href="https://medium.com/aerius-labs">Aerius Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying KZG Commitments]]></title>
            <link>https://medium.com/aerius-labs/demystifying-kzg-commitments-f1de10f13e93?source=rss----80c2f6b3647f---4</link>
            <guid isPermaLink="false">https://medium.com/p/f1de10f13e93</guid>
            <category><![CDATA[plonk]]></category>
            <category><![CDATA[zero-knowledge]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[kzg-commitment]]></category>
            <dc:creator><![CDATA[Rahul | Aerius]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 08:32:12 GMT</pubDate>
            <atom:updated>2023-05-02T12:45:57.824Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T53nvBdr9gauM1dIBjREJQ.png" /></figure><p><strong>We now present a very simple walkthrough of the entire process in an attempt to make the reader understand the KZG commitment scheme.</strong></p><p>Let g₁ = (ℤ𝟟,+) and fix G<em>₁ = 2</em> as the generator of this group, similarly let g₂ = (ℤ𝟟,+) and fix G<em>₂ = 3</em> as the generator and finally let the polynomial that we wish to commit be <em>p(x) = 3x+2. </em>The pairing that we will use for this example will be <em>e(x, y) = 2ˣʸ modulo 7</em></p><p>Moving on to the setup, let for some security parameter λ<strong> </strong>the randomly sampled τ = 5 and we shall pretend to forget it once the keys have been computed. Take <em>m </em>(we have taken it as 3 for the example)<em> </em>to be any number greater than the degree of polynomial (1 in this case) that we wish to commit. Thus <strong>τⁱG</strong><em>₁ </em>= {3, 1, 5} for <em>i</em> = {1,2,3} respectively and <strong>τG</strong><em>₂ = </em>1 . The setup phase has now concluded with the prover key as {3, 1, 5} and the verifier key as 1.</p><p>We now calculate the commitment <strong>C</strong> = 3 × 3 + 1× 2 = 11 = 4 modulo 7</p><p>Say we want to prove that <em>p(1) = 5 ie. y = </em>5<em> </em>and<em> z = </em>1<em>. </em>Then we compute the polynomial<em> q(x) = ( p(x) — </em>5<em> )/( x — </em>1<em> ) = </em>3<em> </em>×<em> (x — </em>1<em> ) / ( x — </em>1<em> ) = </em>3<em> </em>and thus<em> </em><strong>π = </strong>3G<em>₁ = 6.</em></p><p>Finally we just need to verify whether the pairing check holds.</p><h4>Left Hand Side</h4><p><em>e(π, vk — zG₂) = e(6, 1–3) = e(6, 5) = ²³⁰</em> modulo 7 = 1</p><h4>Right Hand Side</h4><p><em>e(C — yG₁, G₂) = e( 4–3, 3) = e(1, 3) = ²³ </em>modulo 7<em> = 1</em></p><p>Since LHS = RHS, our polynomial commitment has now been verified.</p><h3>Closing Notes</h3><p>From the above example one might think that the KZG scheme is very easy to fool however one must remember that the example made use of groups of very small order and a cryptographically insecure pairing. The actual protocol makes use of carefully chosen groups and prime fields that have a very high order such that the probability of a wrong commitment getting verified is infinitesimally close to zero.</p><h3>References</h3><p><a href="https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html">https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html</a></p><p><a href="https://hackmd.io/@yelhousni/kzg">KZG polynomial commitment - HackMD</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1de10f13e93" width="1" height="1" alt=""><hr><p><a href="https://medium.com/aerius-labs/demystifying-kzg-commitments-f1de10f13e93">Demystifying KZG Commitments</a> was originally published in <a href="https://medium.com/aerius-labs">Aerius Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>