<?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[Stories by Mervin Ho on Medium]]></title>
        <description><![CDATA[Stories by Mervin Ho on Medium]]></description>
        <link>https://medium.com/@mervinho?source=rss-3657ae454d70------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nPPTTe4rZMUHUc2oTG5RIA.png</url>
            <title>Stories by Mervin Ho on Medium</title>
            <link>https://medium.com/@mervinho?source=rss-3657ae454d70------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 14:47:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mervinho/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Decentralized Consensus Problem]]></title>
            <link>https://medium.com/venture-buoy/the-decentralized-consensus-problem-2065e65c9e60?source=rss-3657ae454d70------2</link>
            <guid isPermaLink="false">https://medium.com/p/2065e65c9e60</guid>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[venture-capital]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Mervin Ho]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 20:17:20 GMT</pubDate>
            <atom:updated>2021-03-26T20:17:20.592Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q4ONxSH6DTdc9YQbOtyGaw.png" /></figure><p>It is January of 2021. Bitcoin has been making waves in the media for breaking its all-time high price of US$19,783.21 back in 2017 and it is still increasing — the new all-time high is at US$41,940 at this time of writing (Coindesk, 2021). Even your colleague at work who doesn’t know a thing about cryptocurrencies is talking about it during lunch. While an increasing proportion of the general population is talking about trading cryptocurrencies such as Bitcoin, one might wonder, <em>how does this whole thing work?</em></p><p>We hear these buzzwords being thrown around all the time — blockchain, which is the underlying technology that powers cryptocurrencies such as Bitcoin, is always touted as being “secure”, “immutable”, “transparent” and the like. However, perhaps the most radical attribute of blockchain technology (and therefore, what makes it so highly-valued by its proponents) is that it is <strong><em>decentralized</em></strong>, meaning that there is no need for a central entity involved for blockchain and cryptocurrencies to work. Using a very widely-mentioned analogy, sending a certain amount of money to someone else traditionally requires a central entity such as a bank or a payment service such as Visa. In such an arrangement, this central entity is also a <em>trusted entity</em>. When I send $1,000 to the bank to process a transfer to someone else, I do it without worry that the bank will run away with my precious thousand dollars, due to regulation and reputation, and that they will facilitate my transfer according to my instructions (when I say send $1,000 to John, that’s it, not $700 to John and $300 to Mary). The interesting thing here is that in the case of cryptocurrencies, the blockchain <em>itself</em> is the trusted entity, and just like how I can depend on the bank to send money to John, I can also depend on the blockchain to make the same payment to him with cryptocurrency.</p><p>This raises an interesting question as to how a blockchain can be a trusted entity due to its decentralized nature. In short, the blockchain is a network comprising of <em>nodes </em>(which can be your computer or mine, for instance), each of them holding a record of transactions done on the network and are capable of transmitting information of new transactions to one another. Therefore, for the blockchain to work, all of the nodes within the network must be able to come to a <strong><em>consensus</em></strong><em>, </em>or an agreement, on any information that is transmitted within the network. Take, for example, the earlier example in which I wish to send $1,000 (now in cryptocurrency) to John through the blockchain. This transaction information is broadcasted to all the nodes in the network, and only when all the nodes agree that is transaction is valid, can this transaction proceed to be added to the record and for John to receive his funds.</p><h3>The Two Generals Problem</h3><p>However, the consensus in a decentralized network can easily fall through in two prevalent scenarios. The first lies in unreliable communication channels between nodes and is best illustrated with the famous <em>Two Generals Problem</em>, first popularized by Jim Gray in 1977. Suppose that there are two armies at war, Army A (yellow in the graphic below) and Army B (red). Army A is split into two halves led by two generals, both positioned on two different sides of Army B. While Army B is greater in size than each half of Army A, it is smaller in size against their combined strength. Therefore, for Army A to successfully achieve victory, both of its halves must launch an attack at the same time. The only way for the two generals to communicate is through the use of messengers, and unfortunately, these messengers are unreliable — they may get lost, injured, or captured by the enemy en-route.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GjqS-vlf8ishqKcMUk19xg.png" /></figure><p>The first general might start by sending a messenger to the second general to deliver the instructions to attack at dawn the next day. If the second general receives the message successfully, for there to be consensus, he must send another message acknowledging and accepting the plan of attack. The problem here now lies in the unreliability of the messenger — if the messenger has the potential to lose his way, get injured, or be captured, the first general cannot be certain that the second general has received his message and will attack at dawn. This unreliability of the messenger may also cause the second general to hesitate in making a move as he is uncertain that the first general will receive his acknowledgement. As a result, either general may choose not to act as there is no clear guarantee that both of them have received and agree on the plan of attack.</p><p>From the above, we can see that with unreliable communication channels between nodes, consensus in a decentralized network can fail in different ways, outlined below:</p><ul><li>Timing/performance failure → when a node delivers a message too early or too late</li><li>Send omission failure → when a node fails to send out a message</li><li>Receive omission failure → when a node fails to receive an incoming message</li><li>Crash failure → when a node experiences an omission failure and stops responding</li></ul><p>If unreliable communications can result in consensus failing, then what’s the solution? As it turns out, the Two General’s Problem is proved to be <em>unsolvable</em> in Fischer, Lynch &amp; Paterson’s paper in 1985. No matter how many messages the two generals try to send to each other, as long as the messengers are unreliable, they will never be able to safely come to a consensus to launch an attack at dawn. Many have since put forth workarounds that attempt to reduce the possibility of failure in the presence of unreliable communications, for instance, sending multiple messages at once, making it more likely that one will be delivered safely. However, these workarounds still do not provide certainty that consensus will be reached. How then, does a decentralized network such as the blockchain do so?</p><h3>The Byzantine Generals Problem</h3><p>Before we get to that, I present the second prevalent scenario in which consensus can fail, that is when there are nodes in the network that send out incorrect or meaningless data. This problem is also commonly illustrated using another loosely related analogy — the <em>Byzantine Generals Problem</em>, first set out by Lamport, Shostak &amp; Pease in 1982. Suppose now, there are three divisions of an army, led by a Commander, and two Lieutenants (labelled 1 and 2). These three divisions surround an enemy army, and they have to either attack or retreat together to avoid being wiped out. The only mode of communications between the three divisions are once again, through the use of messengers — and we will assume that they are reliable this time around, to highlight that the Byzantine Generals Problem is still a problem even if communication channels are not compromised. With the presence of a hierarchy in this analogy, all loyal Lieutenants must follow the order given out by the Commander. The problem arises from the possibility that one out of the three parties can be a traitor (red in the following diagrams), and if so, there is no guaranteed way for the other two loyal divisions to agree on the same plan, or in other words, to <em>achieve</em> <em>consensus</em>.</p><h4>Case I:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0IF2HLonUFIhct4Y9yMOVQ.png" /></figure><p>Let’s see how the scenario plays out when one of the Lieutenants (in this case, Lieutenant 2) is a traitor. The loyal commander sends out the order to attack to both of them, but Lieutenant 2 deliberately sends out an order to retreat to Lieutenant 1 in an attempt to thwart the entire mission. Lieutenant 1 receives conflicting orders, but due to his loyalty to the commander, he will proceed to attack. Therefore, this results in both loyal parties — the Commander and Lieutenant 1 — agreeing to attack, and here consensus is indeed achieved.</p><p>The above-mentioned example seems to show that achieving consensus is straightforward. However, consider another scenario, where the traitor is the Commander himself.</p><h4>Case II:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLeaqDOXlzjwloBkkKe8uA.png" /></figure><p>As a traitor, the Commander sends out differing orders to the two Lieutenants — an order to attack to Lieutenant 1 and an order to retreat to Lieutenant 2. Once again, the two Lieutenants are confused when they pass on and receive the acknowledgement from each other, but as loyal Lieutenants, they will obey the Commander’s order to them. As a result, both loyal parties act differently and thus fail to achieve consensus.</p><p>The scenario in Case II thus gives rise to the Byzantine Generals Problem — that consensus cannot be achieved with certainty amongst loyal parties, at least in a set-up of three parties where one is a traitor. Translating this to nodes in a decentralized network, when nodes are unreliable themselves, consensus can fail in the following ways:</p><ul><li>Arbitrary failure → when a node sends out meaningless or arbitrary information randomly</li><li>Byzantine failure → when a node sends out different information to other nodes</li></ul><p>Is the Byzantine Generals Problem present in other set-ups then, such as four parties with a traitor or five parties with two traitors? For brevity purposes, Lamport, Shostak &amp; Pease found that a setup can be <strong><em>Byzantine fault-tolerant</em></strong><em> </em>— meaning that all loyal parties can come to a consensus even in the presence of traitors, if and only if, when there are minimally <em>n = 3m + 1</em> parties in total, in which <em>m</em> denotes the number of traitors. There are also additional conditions to make the solution possible. Firstly, if no order is given by the Commander, the Lieutenants will follow a default order e.g. to retreat. Secondly, amongst all orders that are received from the other parties, the order that is the<em> majority </em>will be the one that is executed. Cases III and IV below are presented to better understand this, where <em>n = 4 </em>and <em>m = 1</em>.</p><h4>Case III:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xmx7QxyZpMSF56X22uYAAg.png" /></figure><p>The Commander sends out an order to attack, and Lieutenants 1 and 2 echo the same order to each other. Lieutenant 3, being a traitor, sends out an order to retreat to the other Lieutenants. However, since the order to attack is the majority here, Lieutenants 1 and 2 will do so and consensus is achieved.</p><h4>Case IV:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLomRJNI4AMQ-E2IyqFDBA.png" /></figure><p>Suppose now that the Commander is the traitor and he sends out orders to attack to Lieutenants 1 and 2 but to retreat for Lieutenant 3. In this scenario, all Lieutenants will receive two orders to attack and one to retreat, and once again, since the order to attack is the majority here, all of them will do so and consensus is achieved again.</p><p>It is also noteworthy that in the real world, a “Commander” node is not restricted to just being able to transmit either an “attack” or “retreat”. The “Commander” node can send an arbitrary value <em>X</em> to the first “Lieutenant” node, Y to the second, and correspondingly, Z to the third. All three “Lieutenant” nodes will then receive, in the end, the same three arbitrary values X, Y, and Z, thereby achieving consensus, regardless if any of the values of X, Y and Z are equal or not.</p><p>So there you have it, decentralized networks can achieve consensus if they are Byzantine fault-tolerant — when loyal nodes can still “survive” and agree with each other despite the presence of an <em>m </em>number of unreliable or malicious nodes. As a side note, a Byzantine fault-tolerant network, by extension, is also tolerant of arbitrary failures, timing failures, omission failures, and crash failures which were mentioned before. This is because of the differences in the severity of the failures, and Byzantine failures, which are the most severe types of failures, contain or cover less severe failures. If a network can handle nodes that are transmitting incorrect information (Byzantine failure), then surely it can handle nodes that are transmitting meaningless information (arbitrary failure). If the network can handle arbitrary failures, then it can also surely handle nodes that transmit information too late or early (timing failure), and even nodes that do not transmit information (omission and crash failures), because no information is as good as meaningless information.</p><p>Therefore, as decentralized networks grow in prominence over time, an increasing number of <em>consensus algorithms </em>or <em>consensus mechanisms</em> have surfaced in an attempt to ensure Byzantine fault tolerance in these systems. While many of these solutions, which I will not go into detail about here, have been implemented in various use cases, it was not until the introduction of Bitcoin that brought about one of the most significant innovations in achieving decentralized consensus. Through its proof-of-work mechanism, Bitcoin has sparked renewed interest and subsequently, further innovations in the field. Chaudry &amp; Yousaf (2018) list as many as eight more consensus algorithms since Bitcoin’s proof-of-work mechanism and at the time of writing, more have emerged, which I may discuss in a future piece.</p><p><strong>Note: This is a republished post from my website at </strong><a href="https://www.venturebuoy.com/"><strong>venturebuoy.com</strong></a><strong>. Head over to read more writeups!</strong></p><h4>References &amp; Resources</h4><ol><li>Graphics designed with a PRO account at <a href="https://piktochart.com/">Piktochart</a></li><li>Chaudry, N., Yousaf, M.M. 2018. <a href="https://www.researchgate.net/publication/330880555_Consensus_Algorithms_in_Blockchain_Comparative_Analysis_Challenges_and_Opportunities">Consensus Algorithms in Blockchain: Comparative Analysis, Challenges and Opportunities</a>. <em>Punjab University College of Information Technology.</em></li><li>CoinDesk, 2021. <a href="https://www.coindesk.com/price/bitcoin">Bitcoin Price</a>.</li><li>Fischer, M.J., Lynch, N.A., Paterson, M.S.1984. <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.122.9034&amp;rep=rep1&amp;type=pdf">Impossibility of Distributed Consensus with One Faulty Process</a>. <em>Journal of the Association for Computing Machinery. </em>32(2), 374–382.</li><li>Gray, J. 1977. <a href="http://jimgray.azurewebsites.net/papers/dbos.pdf">Notes on Database Operating Systems</a><em>.</em> <em>Operating Systems</em>. 393–481.</li><li>Lamport, L., Shostak, R., Pease, M. 1982. <a href="https://www.researchgate.net/publication/220431045_Impossibility_of_Distributed_Consensus_with_One_Faulty_Process">The Byzantine Generals Problem. </a><em>ACM Transactions on Programming Languages and Systems.</em> 4(3), 382–401.</li><li>Laszlo, B. 2008. <a href="http://www-itec.uni-klu.ac.at/~laszlo/courses/DistSys_BP/FaultTolerance.pdf">Fault Tolerant Systems</a>. <em>Advanced Topics in Distributed Systems.</em></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2065e65c9e60" width="1" height="1" alt=""><hr><p><a href="https://medium.com/venture-buoy/the-decentralized-consensus-problem-2065e65c9e60">The Decentralized Consensus Problem</a> was originally published in <a href="https://medium.com/venture-buoy">Venture Buoy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>