{"id":22371,"date":"2022-04-04T22:22:51","date_gmt":"2022-04-04T22:22:51","guid":{"rendered":"https:\/\/davidgerard.co.uk\/blockchain\/?p=22371"},"modified":"2023-05-27T21:25:26","modified_gmt":"2023-05-27T21:25:26","slug":"if-you-want-a-scalable-ethereum-blockchain-then-pnp","status":"publish","type":"post","link":"https:\/\/davidgerard.co.uk\/blockchain\/2022\/04\/04\/if-you-want-a-scalable-ethereum-blockchain-then-pnp\/","title":{"rendered":"If you want a scalable Ethereum blockchain, then P=NP"},"content":{"rendered":"<p>The Ethereum project has an unfortunate tendency to propose six impossible things before breakfast \u2014 ideas that would win a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fields_Medal\">Fields Medal<\/a> for mathematical genius if they could possibly work.<\/p>\n<p>If you want a horizontally scalable blockchain &#8230; then P=NP. If you want transaction sharding to work, then P=NP.<\/p>\n<p>You could bodge either of these, of course. Do you feel lucky?<\/p>\n<p>But maybe it doesn&#8217;t matter \u2014 and maybe it was never meant to matter.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-22391\" src=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/1649\/09\/ethereum-hamster.jpg\" alt=\"\" width=\"510\" height=\"315\" srcset=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/1649\/09\/ethereum-hamster.jpg 680w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/1649\/09\/ethereum-hamster-300x185.jpg 300w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/1649\/09\/ethereum-hamster-348x215.jpg 348w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>NP-completeness and P=NP<\/h3>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/NP-completeness\">NP-complete<\/a> problems are one particular class of mathematical problem where it&#8217;s easy to check a result is correct, but hard to calculate the result in the first place.<\/p>\n<p>NP-completeness is a big deal, because a lot of NP-complete problems would be near-magically useful to solve. And <a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_NP-complete_problems\">all NP-complete problems<\/a> are mathematically equivalent \u2014 so if you can analytically solve one, you\u2019ve\u00a0 solved them all.<\/p>\n<p>We don\u2019t <i>know<\/i> if NP-complete problems can be solved. We do know that if we could solve them, it would turn the world upside down. The shorthand for this is <a href=\"https:\/\/en.wikipedia.org\/wiki\/P_versus_NP_problem\">\u201cP=NP\u201d<\/a> \u2014 that NP-complete problems could be solved in polynomial time.<\/p>\n<p>Problems of interest to the cryptocurrency field that P=NP could solve include quickly factoring integers to break public-key cryptography, or reversing hashes.<\/p>\n<p><em>The Golden Ticket: P, NP, and the Search for the Impossible<\/em> by Lance Fortnow [<a href=\"https:\/\/amzn.to\/37fmbym\"><em>Amazon<\/em><\/a>] is a good non-technical introduction to just how many amazing things you could do if P=NP.<\/p>\n<p>But we&#8217;ve never found how to do any of those amazing things. So we presume that if a problem is NP-complete, there isn\u2019t an analytical solution.<\/p>\n<p>There <em>might<\/em> be a solution! But the burden of proof is firmly on the claimant.<\/p>\n<p>Mathematicians have gotten pretty good at spotting NP-completeness in exciting new ideas in the past few decades. It\u2019s not a good sign.<\/p>\n<h3>Data Finnovation: let&#8217;s construct some proofs<\/h3>\n<p>Let\u2019s look at some requirements for a scalable blockchain. Scalability like this was first posited by Ethereum, then the promises were copied into the white papers for other blockchain projects. If the fabulous future promises come true, your blockchain will need to do these:<\/p>\n<ul>\n<li>A scalable blockchain will process more transactions per unit time than a single node on the network.<\/li>\n<li>Balances can never go negative in the system.<\/li>\n<li>We need to reconcile multiple lists of valid transactions, with a requirement of no negative balance, into a single merged list, such that the maximum number of possible transactions go through.\u00a0 This must be achievable efficiently.<\/li>\n<\/ul>\n<p>Here\u2019s a post from the Data Finnovation blog that aims to do the following: [<a href=\"https:\/\/datafinnovation.medium.com\/the-consequences-of-scalable-blockchains-8c4d23c6af4d\"><i>Data Finnovation<\/i><\/a>]<\/p>\n<ol>\n<li aria-level=\"1\">Describe these three requirements.<\/li>\n<li aria-level=\"1\">Show that the problem of making a blockchain that does all of these things is NP-complete.<\/li>\n<li aria-level=\"1\">Show how, if you have such a blockchain, you can <i>right now<\/i> break hash functions and public-key cryptography, and construct a proof that P=NP.<\/li>\n<\/ol>\n<p>For an encore, the author shows that if transaction sharding \u2014 calculating transactions and running smart contract programs in parallel \u2014 could work as advertised, then that too would be NP-complete. [<a href=\"https:\/\/datafinnovation.medium.com\/sharding-is-also-np-complete-8faeafaf360a\"><i>Data Finnovation<\/i><\/a>]<\/p>\n<p>I won&#8217;t copy their work here \u2014 this is a post about the Ethereum project. But do enjoy working through the maths.<\/p>\n<h3>Worse is better<\/h3>\n<p>In real-world programming, when you hit an NP-complete problem, you can <i>usually<\/i> get away with an approximation to the right answer.<\/p>\n<p>Ethereum is likely to bodge a solution to scaling and sharding, because so many things in Ethereum are bodges. Ethereum is the epitome of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Worse_is_better\">&#8220;Worse is Better&#8221;<\/a> \u2014 a product that does the job inelegantly but exists now is better than one that&#8217;s more elegant, but doesn&#8217;t exist yet.<\/p>\n<p>The risk is that we already know how creative blockchain hackers are in seeking out <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2022\/04\/02\/blockchain-bridges-how-the-smart-contract-pinata-works-and-why-bridges-keep-getting-hacked\/\">self-service bug bounties<\/a> \u2014 especially when a bodge breaks.<\/p>\n<p>This is why Ethereum keeps promising fabulous new scaling intiatives \u2014 then doesn&#8217;t implement them for years, or abandons them when they realise the only way is to bodge it.<\/p>\n<p>The current Ethereum proof-of-stake test network generates less CO<sub>2<\/sub> \u2014 but it&#8217;s still a single-threaded application, that can&#8217;t run faster than a single standalone node.<\/p>\n<p>To some extent, the Ethereum project has just given up on scaling the main blockchain. \u201cFor Ethereum to scale and keep up with demand, it has required rollups\u201d \u2014 do the work somewhere else and send back the result. The blockchain is only usable if you work around actually using it. [<a href=\"https:\/\/ethereum.org\/en\/bridges\/\"><i>ethereum.org<\/i><\/a>]<\/p>\n<h3>Stay in school, kids<\/h3>\n<p>Data Finnovation notes: &#8220;It\u2019s worth stating that part #2 \u2014 the only part of this blog that is technical \u2014 would fly as a homework assignment in any &#8216;Intro to the Theory of Computation&#8217; class.&#8221;<\/p>\n<p>Vitalik Buterin skipped getting a degree in computer science because Peter Thiel <a href=\"https:\/\/en.wikipedia.org\/wiki\/Thiel_Fellowship\">paid him not to go to college.<\/a> This may not have been the greatest idea. The hazard of being an autodidact is that you don&#8217;t know what you don&#8217;t know.<\/p>\n<p>Buterin had a propensity for proposing the profoundly unlikely back when he was still into Bitcoin \u2014 such as calculating Bitcoin hashes faster by using a quantum computer. He didn&#8217;t have a quantum computer \u2014 but he believed a maths crank friend who told him you could <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/buterins-quantum-quest\/\">simulate a quantum computer usably fast on an ordinary computer.<\/a><\/p>\n<p>When <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/the-dao\/\">The DAO was hacked<\/a> in 2016, the Ethereum project proposed a soft fork: they would blacklist transactions whose result interacted with the \u201cdark DAO\u201d the attacker had poured the funds into. This would have been a vector for a fairly obvious denial-of-service attack: flood Ethereum with costly computations that end at the dark DAO.<\/p>\n<p>This approach could only have worked by first solving the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Halting_problem\">halting problem<\/a> \u2014 you would need to be able to determine the outcome of any possible Ethereum program without actually running it and observing the result. [<i><a href=\"https:\/\/hackingdistributed.com\/2016\/06\/28\/ethereum-soft-fork-dos-vector\/\">Hacking Distributed<\/a>, 2016<\/i>]<\/p>\n<p>I don\u2019t have a computer science degree (or any degree) either, but I did take care to run my ideas past some computer science professors before I posted. They stressed that bodging your NP-complete problem is absolutely standard, because in almost all cases, the 99% solution will do. The trouble is, I\u2019m pretty sure there\u2019s a lot of self-service bug bounties in the other 1%.<\/p>\n<h3>The purpose of a system is what it does<\/h3>\n<p>The Ethereum blockchain is clogged to near-unusability. Transaction fees are large and unpredictable. Applications are deployed to Ethereum because it&#8217;s popular \u2014 then they&#8217;re <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2021\/05\/18\/cryptocurrency-in-2021-still-dysfunctional-nonsense-unusable-by-normal-humans\/\">all but unusable by normal humans.<\/a><\/p>\n<p>Ethereum claims to be decentralised, but this is a marketing lie. The Ethereum blockchain burns a country&#8217;s worth of electricity for its proof-of-work mining, but no more than three entities control the majority of the mining. Megatons of CO<sub>2<\/sub> are generated for <em>no useful reason<\/em> except to back legal claims of untouchability. [<i><a href=\"https:\/\/digiconomist.net\/ethereum-energy-consumption\/\">Digiconomist<\/a><\/i>]<\/p>\n<p>Infura, an API provided by ConsenSys, is the only way to use the Ethereum network at any speed. Infura recently <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2022\/03\/04\/news-fca-versus-uk-crypto-infura-sanctions-on-ethereum-bitmex-reed-headed-for-trial-india\/\">blocked a swathe of countries in response to US sanctions pressure<\/a>\u00a0\u2014 and took out a pile of common applications in those countries, including MetaMask and OpenSea.<\/p>\n<p>The present Ethereum system does one job well: it makes a great deal of money for the centralised entities who have operational control of the system. Ethereum&#8217;s cryptocurrency, ether, is almost as easily traded for actual money as Bitcoin is.<\/p>\n<p>Ethereum makes more sense if you first assume it never mattered if the fancy promises ever worked out \u2014 even if Buterin believed they were supposed to.<\/p>\n<p>\u201cMaybe investing billions in dollars &amp; man hours into a white paper from a teenager who had no previous experience in \u2026 well almost everything, wasn\u2019t the best of ideas. Unless the idea was not about whether it could work, and instead how much $ you could extract from the naive.\u201d \u2014 Alan Graham [<i><a href=\"https:\/\/twitter.com\/agraham999\/status\/1510586303993110532\">Twitter<\/a><\/i>]<\/p>\n<p>&nbsp;<\/p>\n<br><br><div align=\"center\"><p><a href=\"https:\/\/www.patreon.com\/bePatron?u=8420236\"><img src=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2021\/10\/become_a_patron_button.svg\" alt=\"Become a Patron!\" title=\"Become a Patron!\" width=217 height=51><\/a><br><p style=\"align:center;\" class=\"patreon-badge\"><i>Your subscriptions keep this site going. <a href=\"https:\/\/www.patreon.com\/bePatron?u=8420236\">Sign up today!<\/a><\/i><\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>Ethereum makes more sense if you first assume it never mattered if the fancy promises ever worked out.<\/p>\n","protected":false},"author":1,"featured_media":22391,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[74,2877,82,1114,264],"class_list":["post-22371","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorised","tag-blockchain","tag-data-finnovation","tag-ethereum","tag-infura","tag-vitalik-buterin"],"jetpack_featured_media_url":"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/1649\/09\/ethereum-hamster.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/22371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/comments?post=22371"}],"version-history":[{"count":44,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/22371\/revisions"}],"predecessor-version":[{"id":25448,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/22371\/revisions\/25448"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/media\/22391"}],"wp:attachment":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/media?parent=22371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/categories?post=22371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/tags?post=22371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}