<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[1.21 Gigawatts]]></title><description><![CDATA[Explaining renewable energy technologies in a simple and fun way. With pretty pictures.]]></description><link>https://121gigawatts.org/</link><image><url>https://121gigawatts.org/favicon.png</url><title>1.21 Gigawatts</title><link>https://121gigawatts.org/</link></image><generator>Ghost 4.39</generator><lastBuildDate>Mon, 20 Apr 2026 10:56:51 GMT</lastBuildDate><atom:link href="https://121gigawatts.org/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Copper Sushi 🍣]]></title><description><![CDATA[A Pretty Map of the European Power Grid]]></description><link>https://121gigawatts.org/copper-sushi-power-flow-european-grid/</link><guid isPermaLink="false">63081faf5feec08d9d961923</guid><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Fri, 19 Aug 2022 18:45:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/08/coppersushi-gif-1.gif" medium="image"/><content:encoded><![CDATA[<h2 id="a-pretty-visualisation-of-the-european-power-grid">A Pretty Visualisation of the European Power Grid</h2><img src="https://121gigawatts.org/content/images/2022/08/coppersushi-gif-1.gif" alt="Copper Sushi &#x1F363;"><p>This is a map of the European electrical transmission network. Each dot is a connection point where all the consumption from nearby settlements connects to the network, as well as all electricity generation from nearby power plants.</p><ul><li>&#x1F952; Green dots mean more generation than consumption, so they <strong>export power to</strong> the network</li><li>&#x1F347; Purple dots mean more consumption than generation, so they <strong>take power from</strong> the network</li><li>&#x25B2; Triangles show <strong>which way</strong> the power is flowing</li><li>&#x1F579; Hovering over the triangles shows <strong>how much power is flowing</strong> through the power lines, and each line&apos;s <strong>total capacity</strong></li></ul><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="height:70vw; min-height: 700px; position: relative;">
		<iframe class="kg-image" src="https://coppersushi.herokuapp.com/" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute; padding-left: 5vw; padding-right: 5vw;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>The numbers shown above are the results of running an optimisation algorithm. Its aim is to find <strong>optimal power flow</strong>. It goes like this:</p><p>I pick a date, and I ask the algorithm to calculate:</p><ul><li> which power plants should produce how much power</li><li>for each 2-hour slot in that day,</li><li>so that the total cost is minimal,</li><li>and all power consumption is covered</li></ul><p>To do that, for each connection point and each time slot, the algorithm gathers all the inputs first:</p><ul><li>&#x1F4BB;&#x1F4A1; Get <strong>total consumption</strong> from the nearby settlements and industry</li><li>&#x1F4B6; Get the <strong>price of generation</strong> per MW for solar, wind, hydro, coal, oil, gas &amp; nuclear</li><li>&#x1F3ED; Get the <strong>total generation capacity</strong> available at each point for the <strong>old-school power plants</strong> (gas, coal, nuclear, etc.)</li><li>&#x2600;&#xFE0F;&#x1F4A8; Calculate how much the <strong>sun</strong> is shining, the <strong>wind</strong> is blowing, and the <strong>rivers</strong> are flowing (from historical data for the date I picked), based on which it can</li><li>&#x26A1;&#xFE0F;Calculate <strong>how much solar, wind and hydro power plants can generate</strong> at most</li><li>&#x1F50C; Get <strong>how much power each power line can transfer</strong> at most</li></ul><p>And then it just starts guessing how much each power plant should produce, while making sure that all of the above adds up right. It keeps guessing and improving its guesses until it finds the minimum cost of generation that satisfies all of these conditions.</p><p>If you then <strong>add up all the power generated</strong> at each point, and <strong>subtract all the power consumed</strong> at each point, you get the numbers which pop up if you hover over the dots.</p><h2 id="whered-you-get-the-data-%F0%9F%A5%B8">Where&apos;d You Get the Data? &#x1F978;</h2><p>The data comes from <code>pypsa-eur</code>, a research paper which is to my knowledge the best summary of the European power grid data that is currently publicly available:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/PyPSA/pypsa-eur"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - PyPSA/pypsa-eur: PyPSA-Eur: An Open Optimisation Model of the European Transmission System</div><div class="kg-bookmark-description">PyPSA-Eur: An Open Optimisation Model of the European Transmission System - GitHub - PyPSA/pypsa-eur: PyPSA-Eur: An Open Optimisation Model of the European Transmission System</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Copper Sushi &#x1F363;"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">PyPSA</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/129b79416a66cc263f49af180ce6e1a6345f1784b3c239829b978f2c27601bf2/PyPSA/pypsa-eur" alt="Copper Sushi &#x1F363;"></div></a></figure><p>A huge thanks to <a href="https://twitter.com/fneum_">Fabian Neumann</a> and everyone else from Professor <a href="https://twitter.com/nworbmot">Tom Brown</a>&apos;s research group behind <code>pypsa-eur</code> - for the great software, great documentation, and for gathering and prepaing all the data.</p><p>The little bit of code that I had to write on top of <code>pypsa-eur</code> to make that pretty-ass map above can be found here:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/zoltanmaric/coppersushi"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - zoltanmaric/coppersushi: Optimal power flow visualisation based on pypsa-eur</div><div class="kg-bookmark-description">Optimal power flow visualisation based on pypsa-eur - GitHub - zoltanmaric/coppersushi: Optimal power flow visualisation based on pypsa-eur</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Copper Sushi &#x1F363;"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">zoltanmaric</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/388df45b4eb4ed80ec56c20ce612b3bb979f10b3db83a08803eed4aa03600ba5/zoltanmaric/coppersushi" alt="Copper Sushi &#x1F363;"></div></a></figure><h2 id="is-this-real-%F0%9F%A6%A6">Is This Real? &#x1F9A6;</h2><p>The math behind it is real, and it uses the same calculations that real grid operators use to keep the lights on. However, the amount of power that each power plant actually produces depends on the price they offer. This price varies wildly from hour to hour, and neither the price nor the power amount is publicly available.</p><p>Instead, <code>pypsa-eur</code> makes assumptions on prices for solar, wind, coal, nuclear, etc. based on historical averages, and then runs an optimisation algorithm to cover all consumption for the least cost of production. In short:</p><blockquote class="kg-blockquote-alt">It&apos;s <strong>the real way of calculating who produces how much</strong>, and <strong>how the power flows</strong> in that case;<br>but it&apos;s calculated based on <strong>data that is not real</strong>.</blockquote><p>For a full discussion of the limitations of the model, have a look at chapter 4 of the original <code>pypsa-eur</code> paper:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://arxiv.org/abs/1806.01613"><div class="kg-bookmark-content"><div class="kg-bookmark-title">PyPSA-Eur: An Open Optimisation Model of the European Transmission System</div><div class="kg-bookmark-description">PyPSA-Eur, the first open model dataset of the European power system at thetransmission network level to cover the full ENTSO-E area, is presented. Itcontains 6001 lines (alternating current lines at and above 220 kV voltagelevel and all high voltage direct current lines), 3657 substations, a new&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://static.arxiv.org/static/browse/0.3.4/images/icons/favicon.ico" alt="Copper Sushi &#x1F363;"><span class="kg-bookmark-author">arXiv.org</span><span class="kg-bookmark-publisher">Jonas H&#xF6;rsch</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://static.arxiv.org/icons/twitter/arxiv-logo-twitter-square.png" alt="Copper Sushi &#x1F363;"></div></a></figure><h2 id="why-does-this-matter-%F0%9F%A4%B7%E2%80%8D%E2%99%80%EF%B8%8F">Why Does This Matter? &#x1F937;&#x200D;&#x2640;&#xFE0F;</h2><p><strong>TL;DR:</strong> we can delete most of the emissions of the developed world today by switching heating &amp; car and truck transport to electrical - if we make sure we generate all electricity with near-zero emissions. Just building more renewable generation won&apos;t solve it though, as you still need to make sure it covers all consumption <strong>everywhere</strong>. This map intends to show why that&apos;s a complicated problem, and why we should also be smart about <strong>where</strong> we build renewable generation so that most of the generated energy can also be <strong>used</strong> and not <strong>thrown away</strong> because the grid can&apos;t handle it.</p><p>I wrote a less condensed explanation of this problem in another post:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://121gigawatts.org/the-copper-plate-must-die/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">The Copper Plate Must Die &#x1F480;</div><div class="kg-bookmark-description">EU energy market rules are counterproductive to grid congestion &amp; don&#x2019;t incentivise optimal use of renewables.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://121gigawatts.org/favicon.png" alt="Copper Sushi &#x1F363;"><span class="kg-bookmark-author">1.21 Gigawatts</span><span class="kg-bookmark-publisher">Zolt&#xE1;n Mari&#x107;</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://121gigawatts.org/content/images/2022/06/title-slide-2.gif" alt="Copper Sushi &#x1F363;"></div></a></figure><h2 id="%F0%9F%91%8B">&#x1F44B;</h2>]]></content:encoded></item><item><title><![CDATA[The Copper Plate Must Die 💀]]></title><description><![CDATA[I have the impression that current European energy spot market rules are counterproductive to grid congestion, and they don't incentivise optimal usage and expansion of renewables.]]></description><link>https://121gigawatts.org/the-copper-plate-must-die/</link><guid isPermaLink="false">62b1c6cb5feec08d9d9616f3</guid><category><![CDATA[VPP]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Tue, 21 Jun 2022 13:51:05 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/06/title-slide-2.gif" medium="image"/><content:encoded><![CDATA[<figure class="kg-card kg-bookmark-card kg-card-hascaption"><a class="kg-bookmark-container" href="https://docs.google.com/presentation/d/1Bz6dHtJIyGmHMEA9vPFoCKslt9kbPFeVxgBUbtJGAnU/edit?usp=sharing"><div class="kg-bookmark-content"><div class="kg-bookmark-title">The Copper Plate Must Die &#x1F480;</div><div class="kg-bookmark-description">DIE THE COPPER PLATE MUST I think there&#x2019;s an opportunity to make a big step towards reaching zero-emissions in Europe, and it doesn&#x2019;t require any new technologies, but a policy change. This is what I would like to show you today.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://ssl.gstatic.com/docs/presentations/images/favicon5.ico" alt="The Copper Plate Must Die &#x1F480;"><span class="kg-bookmark-author">Google Docs</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://lh5.googleusercontent.com/-37lPLTIxs5Noo_oo0YNLA1O6qaaEyAMfFPht1Hp_Y3PycaEJKVDMIOudPhx21Xc3C_Fzhp3PCmgTg=w1200-h630-p" alt="The Copper Plate Must Die &#x1F480;"></div></a><figcaption>The argument I present here was originally a talk I gave at <a href="https://web.archive.org/web/20220426112853/https://www.terrapinn.com/exhibition/spark/agenda.stm">Spark 2022</a> in London on June 22, 2022. You can see the slides from the presentation on the link above.</figcaption></figure><img src="https://121gigawatts.org/content/images/2022/06/title-slide-2.gif" alt="The Copper Plate Must Die &#x1F480;"><p>I&apos;ve been pondering. What if getting Europe to zero emissions as soon as possible <strong>&#x2014;</strong> was <strong><em>a problem I had to solve</em></strong>? What if I were a benevolent dictator and had all the power to solve this problem? What would I do?</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/08/pondering.gif" class="kg-image" alt="The Copper Plate Must Die &#x1F480;" loading="lazy" width="640" height="634"></figure><p>- and I came up with this elaborate plan:</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=6&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>So let&apos;s get to it!</p><h2 id="what-needs-to-be-done"><em><strong>What</strong></em> needs to be done</h2><p>There&#x2019;s pretty much already a consensus in the energy industry on <em>what </em>needs to be done in order to reach zero emissions: we know how to generate electricity without emissions, so let&apos;s just</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/07/electrify-all-the-things.gif" class="kg-image" alt="The Copper Plate Must Die &#x1F480;" loading="lazy" width="576" height="576"></figure><p>Electrifying transport is already well underway, we plan to electrify heating with heat pumps, and then for the rest we plan to use hydrogen, which is also extracted using electricity. If we manage to do that, we will have solved the vast majority of today&apos;s emissions, so long as all the electricity comes from zero-emission generation 24/7. There&#x2019;s our &#x201C;what needs to be done&#x201D; as a well-defined problem:</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=8&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><h2 id="how-to-do-it"><em><strong>How</strong></em> to do it</h2><p>Figuring out how to generate and deliver zero-emission energy 24/7 is also nothing new. There&apos;s plenty of studies about it coming from academia and various think tanks and agencies. They&apos;re called <strong>capacity expansion studies</strong>.</p><p>These studies look at:</p><ul><li>Existing and projected regional demand</li><li>Existing regional renewable generation</li><li>Existing grid infrastructure</li><li>Regional solar and wind potentials, based on weather and land suitability</li></ul><p>Based on which they estimate:</p><ul><li>where we should build more renewable generation and storage</li><li>where we should expand the grid</li></ul><p>Such that it costs the least, but still provides renewable energy 24/7 everywhere. </p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vS7_m2GzWBOBSqJdert9lGnqYJIdMGBoS9igvr19u9rHi_UWfOxojVUqEKzksgcSszrNrJoNh53KBEJ/embed?start=false&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>To do this, they run the data through an optimisation algorithm that may come up with something like this:</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=11&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>The sizes of the pies show how much additional renewable generation or storage we need to install in each region, and the sections of the pie tell us the proportions of the different technologies. For example we see a lot of yellow which is solar along the Mediterranean, and we see a lot of blue along the North and Baltic sea, which is wind, coupled with some pink for hydrogen storage.</p><p>The thickness of the links between the pies show the capacities of the transmission grid. If it&apos;s grey like here in Spain and in central France, that&apos;s the existing grid infrastructure, and if it&apos;s coloured brown or green like in Northern France and Germany, that&apos;s the required AC or DC transmission expansion.</p><p>This particular result is from a study from the Technical University of Berlin, published in March 2022 (<a href="https://www.sciencedirect.com/science/article/pii/S0306261922002938">link</a>). The study presents best practices for capacity expansion calculations that co-optimise investments in generation, storage, and transmission. This is something I want to stress.</p><blockquote class="kg-blockquote-alt">Capacity expansion is a <strong>co-optimisation</strong> of <strong>generation</strong>, <strong>storage</strong> &amp; <strong>transmission</strong>.</blockquote><p>Generation and storage <strong>location </strong>and <strong>capacity <em>strongly influence</em> </strong>how <strong>transmission </strong>should be expanded, and <strong>transmission capacity <em>strongly influences</em> </strong>how <strong>generation </strong>capacity should be expanded and <strong>where it should be placed</strong>.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/08/starsky-and-hutch-ben-stiller.gif" class="kg-image" alt="The Copper Plate Must Die &#x1F480;" loading="lazy" width="640" height="560"></figure><h2 id="do-it">Do it</h2><p>In order to understand how we&#x2019;re doing so far on our path to an optimal zero-emission grid, let me tell you a story of a problem that frequently occurs in Germany.</p><p>Say I have a factory in the South of Germany, and I want to buy 20 MW of capacity for tomorrow between 7 and 8 AM. I go to the energy market, and the most competitive sell bid for that time slot happens to come from a wind farm in the North at 20 EUR/MWh. That&apos;s a very attractive price, so I give the corresponding buy order, and the trade is executed, meaning I now have a binding agreement to consume at 20 MW for an hour tomorrow at 7, and that wind farm in the north has a binding agreement to produce at 20 MW during the same time.</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=16&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>The forecast for tomorrow says it&apos;s going to be very windy in the North, so there&#x2019;s many other wind farms in the North that offer a large volume of energy at very low prices. Conversely, there&apos;s many other factories like mine in the South of Germany as that&apos;s where industry is concentrated. So now there&apos;s a lot of demand in the South matched with a lot of generation in the North. That amounts to tons of gigawatts having to be transferred from North to South through these few transmission lines connecting the North to the South.</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=20&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>The buyers and the sellers on the energy market have to make sure they consume or produce exactly the amounts of energy that they traded, but they don&apos;t have to worry about <strong>how </strong>that energy will be delivered to them. That&apos;s on the grid operators to worry about.</p><p>So the grid operators calculate the power flow according to the dispatch plan, and they see that the highlighted purple line above needs to transfer energy with a throughput of 900 MW, while its capacity is rated at 800 MW, and the other routes are already at capacity. So they perform <strong>redispatch</strong>, which is to say they <strong>curtail </strong>100 MW of wind in the North, and they call up some gas power plant in the South to deliver the energy closer to where it&apos;s consumed.</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=22&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>The <strong>curtailed wind turbines </strong>still get to <strong>keep their payment</strong>, but the <strong>grid operator additionally pays the gas power plant</strong>, and at a premium, since it was dispatched on short notice.</p><blockquote><strong>UPDATE: </strong>To help me and others get a better intuition of how these kinds of grid congestion work, I&apos;ve developed <a href="https://121gigawatts.org/copper-sushi-power-flow-european-grid/">Copper Sushi &#x1F363;</a> - a pretty, interactive map of the European grid. Go play around with it! &#x1F579;&#x1F913;</blockquote><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://121gigawatts.org/copper-sushi-power-flow-european-grid/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Copper Sushi &#x1F363;</div><div class="kg-bookmark-description">A Pretty Map of the European Power Grid</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://121gigawatts.org/favicon.png" alt="The Copper Plate Must Die &#x1F480;"><span class="kg-bookmark-author">1.21 Gigawatts</span><span class="kg-bookmark-publisher">Zolt&#xE1;n Mari&#x107;</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://121gigawatts.org/content/images/2022/08/coppersushi-gif-1.gif" alt="The Copper Plate Must Die &#x1F480;"></div></a></figure><p>Now this is already pretty sad as it is, but the worst part is that it&apos;s the market rules that exacerbate this problem. There&apos;s no penalty or disincentive that would prevent participants from doing it <strong>again and again</strong>.</p><p><strong>This is by design</strong>.</p><p>The idea is that the market shouldn&apos;t have to worry about delivering energy as long as both parties are within the same country. They should just be able to trade freely.</p><blockquote class="kg-blockquote-alt"><em>As if the grid weren&apos;t a grid,</em><br><em>but a <strong>copper plate</strong>.</em></blockquote><p>No congestion, no bottlenecks. As far as market is concerned, energy can be transferred instantly between any two places on the copper plate.</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=24&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>And the fact that there&#x2019;s nothing stopping the market from repeatedly causing the same problem is not the only issue. If we stick to this rule, new generation will keep disregarding impact on congestion, and make things worse. It will keep getting built far from demand, and demand will keep getting built far from generation. This is my biggest worry.</p><blockquote class="kg-blockquote-alt"><em>The current market rules</em><br><strong><em>do not incentivise</em><br><em>co-optimisation</em></strong><br><em>of generation and transmission.</em></blockquote><h2 id="our-current-path-towards-zero-emissions">Our current path towards zero emissions</h2><p>I like to imagine our current path towards zero-emissions as shown in the diagram below. The dashed line on the top is where we are today (in 2022), and the dashed line on the bottom is the zero-emission future we want to get to.</p><p>If we take co-optimisation seriously, the road to get there might look something like the left side. Generation and transmission influencing each other, growing together more or less straight towards our goal.</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vRNSC4NZPzCXnrW3y_G7i20Jr6GyquVIGXZJa_63pTYr6RTsdXiDqe7bN3EaFD4uY-2IB-FmNKa8U1V/embed?start=true&amp;loop=true&amp;delayms=1000&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>Instead, today&apos;s market rules are letting <strong>generation</strong> grow more or less randomly, as shown on the right side, and then we say we&#x2019;ll just catch up to new generation with <strong>more grid expansion</strong>.</p><blockquote class="kg-blockquote-alt"><em>This more expensive, less energy-efficient, and most importantly - <strong>wayyy </strong>slower.</em></blockquote><p>Generation and storage development is mostly performed by the private sector, meaning many <strong>independent parties who move fast</strong>.</p><p><strong>Transmission</strong>, on the other hand, is <strong>built by heavily regulated regional monopolies</strong>. That&apos;s not exactly the magic formula to move fast. That means they&apos;ll likely always lag significantly behind the development of generation and storage. More reason to co-optimise.</p><p>And by the way, that gap that the blue line lags behind the yellow line translates to generation capacity we cannot use in the short run, i.e. <strong>wasted renewable energy </strong>which we&apos;ll have to <strong>cover for with old- school power plants</strong>.</p><h2 id="to-be-fair">To be fair</h2><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/07/Screenshot-2022-06-29-at-16.31.04.png" class="kg-image" alt="The Copper Plate Must Die &#x1F480;" loading="lazy" width="2000" height="1125" srcset="https://121gigawatts.org/content/images/size/w600/2022/07/Screenshot-2022-06-29-at-16.31.04.png 600w, https://121gigawatts.org/content/images/size/w1000/2022/07/Screenshot-2022-06-29-at-16.31.04.png 1000w, https://121gigawatts.org/content/images/size/w1600/2022/07/Screenshot-2022-06-29-at-16.31.04.png 1600w, https://121gigawatts.org/content/images/size/w2400/2022/07/Screenshot-2022-06-29-at-16.31.04.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>The idea of the copper plate comes from a time before renewables, and it&apos;s well-intentioned. It&apos;s based on the thought that people who live far from power plants shouldn&apos;t have to pay more than those who live near. It probably <strong>works well if a grid grows gradually and organically</strong>.</p><p>But today we&apos;re talking about replacing almost all old- school generation with renewable generation and storage. And we want to do it as fast as possible. That&apos;s the <strong>opposite of gradual and organic</strong>. It&apos;s a complete overhaul of the grid!</p><p>Alright, I think I complained enough. Here&#x2019;s what I&#x2019;m proposing:</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTd72DiwXJemSqzbQ6Rze3stPtPoi0YGIbnq-POvUBTMKjjiJ_XZhYE04TuSHGXa1Djbu9YnTIkgrt1/embed?start=false&amp;loop=false&amp;delayms=3000&amp;slide=31&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><blockquote class="kg-blockquote-alt"><em>In the spot market, <strong>it has to be more expensive to buy energy from &quot;far away&quot; than from &quot;close by&quot;</strong>. </em></blockquote><p>Yes, in the short term, this may lead to price volatility. But this is exactly the fix that will give the price signal to co-optimise: More generation closer to excess demand areas; more industry, electrolysis and storage near excess generation areas.</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vQ3oVd7zi_BD7wfPXvGV-pPWJz6qWgPRUb4H-X0eAchf_U5U8NcUIBb1beSd03nCqisdt0jqIh4F7Lp/embed?start=true&amp;loop=true&amp;delayms=1000&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>The social injustice in the short term caused by potential high prices in some regions can be subsidised by the saved redispatch costs. It makes more sense to subsidise people than to subsidise the band-aiding of technical problems that we&apos;re causing ourselves with an outdated market design.</p><h2 id="how-do-we-do-that">How do we do that?</h2><p>The good news is that this already seems to be in consideration. The EU&#x2019;s Agency for the Cooperation of Energy Regulators (ACER) is <a href="https://twitter.com/eu_acer/status/1524025293916327937">considering a reconfiguration of bidding zones</a>. In other words &#x2013; thinking about how to split up the country-wide copper plates into multiple copper saucers.</p><blockquote><em>Following the results of the Locational Marginal Pricing (LMP) analysis carried out by Transmission System Operators (TSOs), the EU Agency for the Cooperation of Energy Regulators (ACER) has initiated the procedure to decide on the TSOs&#x2019; proposal of alternative bidding zone configurations. </em></blockquote><p>National Grid in the UK is conducting a Net Zero Market Reform research, and it&#x2019;s recently <a href="https://twitter.com/NationalGridESO/status/1529028988269641728">said that they&#x2019;re considering moving to local pricing</a>.</p><blockquote><em>Moving from a national electricity price to more local pricing will reduce consumer costs and unlock further investment in renewables. </em></blockquote><p>On the other hand, EPEX Spot, the company running the biggest short-term electricity market in Europe, doesn&#x2019;t really like the idea of splitting up into smaller zones. They&#x2019;ve outlined their concerns <a href="https://www.epexspot.com/en/news/bidding-zone-split-would-necessitate-considerable-amount-time-and-effort-across-power-trading">in a memo in 2016</a>.</p><blockquote><em>Bidding zone split would necessitate considerable amount of time and effort across power trading sector. </em></blockquote><p>I understand that figuring out and implementing the actual solution is a nuanced matter and is anything but simple. I&#x2019;m not saying that I have a ready solution. I am saying <strong>I want to help work on it</strong>. And I think we need to work on it because <strong>the current market design is broken and it&#x2019;s leading us astray</strong>.</p><!--kg-card-begin: html--><figure class="kg-card kg-embed-card kg-width-full" style="width: 100vw; max-width: 100vw">
    <div class="fluid-width-video-container kg-image" style="padding-bottom:56.25%; position: relative;">
		<iframe class="kg-image" src="https://docs.google.com/presentation/d/e/2PACX-1vTphceg72Qy0Erb0Qpuxm9s7OtDHkWHJ7g11hiw03yJtxwe4RIxYfUIuCBFTyDzsOJ_KjbqTkkHR4aN/embed?start=true&amp;loop=false&amp;delayms=3000&amp;rm=minimal" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" width="100% !important" height="100% !important" style="position: absolute;"></iframe>
    </div>
</figure><!--kg-card-end: html--><p>Feel free to comment on this post on <a href="https://twitter.com/zoltanmaric/status/1541276747429208070">Twitter</a> or on <a href="https://www.linkedin.com/posts/zoltanmaric_the-copper-plate-must-die-activity-6947042418194083840-qZ4F?utm_source=linkedin_share&amp;utm_medium=member_desktop_web">LinkedIn</a> &#x1F64C;</p>]]></content:encoded></item><item><title><![CDATA[The "Why" of Virtual Power Plants]]></title><description><![CDATA[The shepherds of the new power grid and why we need them.]]></description><link>https://121gigawatts.org/the-why-of-virtual-power-plants/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b7a</guid><category><![CDATA[VPP]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Wed, 06 May 2020 21:43:28 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/superman-costume-dog-1.gif" medium="image"/><content:encoded><![CDATA[<img src="https://121gigawatts.org/content/images/2022/03/superman-costume-dog-1.gif" alt="The &quot;Why&quot; of Virtual Power Plants"><p>Have I told you about how climate change grinds my gears yet? Well, it does. So let&apos;s do something about it! But where do we start? How about looking at the largest human-made contributors to CO&#x2082; emissions?</p><!--kg-card-begin: html--><figure class="kg-embed-card">
	<iframe src="https://ourworldindata.org/grapher/carbon-dioxide-co2-emissions-by-sector-or-source" style="width: 100%; height: 600px; border: 0px none;"></iframe>
	<figcaption>Source: <a href="https://ourworldindata.org/co2-and-other-greenhouse-gas-emissions#co2-emissions-by-sector">Our World in Data</a></figcaption>
</figure><!--kg-card-end: html--><p>This tells us that in 2014, the largest global contributors were <strong><em>electricity and heat production</em></strong> at almost 50%, followed by <strong><em>transport</em></strong> just above 20%. By the way, that chart is totally interactive, go ahead and click around on it. &#x1FA80;&#x1F913; E.g. you can show the same chart for <em>your</em> particular country if you want.</p><p>Anyway, having electricity production among the highest contributors to CO&#x2082; emissions is kind of <strong><em>good news</em></strong>. It&apos;s good news because we already have the technologies for <strong><em>generating</em></strong> electricity with low emissions all figured out! &#x1F389;</p><p>The other part of that largest contributor &#x2015; heat production, also has a very promising emerging technology: <strong><em>heat pumps</em></strong>. Heat pumps are rad, because they produce more energy in heat than they consume in electricity. E.g. it&apos;s not unusual for a ground source heat pump to produce <strong><em>4 kWh</em></strong> of heat from <strong><em>1 kWh</em></strong> of electricity. (<a href="https://www.energystar.gov/products/energy_star_most_efficient_2020/geothermal_heat_pumps">Source</a>)</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/magic-1.gif" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="413" height="378"><figcaption>Source: <a href="https://giphy.com/gifs/shia-labeouf-12NUbkX6p4xOO4">Giphy</a></figcaption></figure><p>Almost. The missing 3 kWh actually come from the thermal energy of the heat pump&apos;s ground source, which itself is a renewable source. Heat pumps are like renewable energy amplifiers &#x1F525;&#x1F3B8;&#x1F525;</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Goes-to-11.gif" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="500" height="235"><figcaption>Source: <a href="https://giphy.com/gifs/maudit-lol-maudit-11-5MGFEJS7FIxK8">Giphy</a></figcaption></figure><p>Next up, we have transport at 20% of global CO&#x2082; emissions. Let&apos;s first have a look at how that breaks down further into modes of transport. I couldn&apos;t find recent global data for that, so we&apos;ll just look at the EU this time:</p><!--kg-card-begin: html--><figure class="kg-embed-card">
    <iframe src="https://live.amcharts.com/ZkMWR/embed/" frameborder="0" width="100%" height="400px"></iframe>
    <figcaption>Source: <a href="https://www.eea.europa.eu/ds_resolveuid/18935b1c0a4944bda1534165c6dc0a90">European Environment Agency</a></figcaption>
</figure><!--kg-card-end: html--><p>To be fair, these are greenhouse gas (GHG) emissions, not just CO&#x2082; emissions, but since we&apos;re only trying to figure out who&apos;s the biggest polluter, it doesn&apos;t make that much of a difference.</p><p>Here we have a pretty clear winner: <em>road transport</em>, with over 70% of all transport emissions.</p><p>By the way, the transport sector makes up <a href="https://ec.europa.eu/eurostat/statistics-explained/index.php?title=File:Greenhouse_gas_emissions,_analysis_by_source_sector,_EU-28,_1990_and_2017_(Percentage_of_total).png">25% of total greenhouse gas emissions in the EU</a>. That means <strong>road transport <em>alone</em> accounts for 17% of <em>all</em> of the EU&apos;s greenhouse gas emissions</strong> combined!</p><p>Luckily, we&apos;re well under way of figuring out low-emission alternatives for road transport &#x2015; with the automotive industry&apos;s announced shift to electric and/or hydrogen-powered vehicles.</p><p>I say <em>&quot;luckily&quot;</em>, because it would be much more worrying if e.g. aviation had a larger share in total emissions, since we didn&apos;t yet get very far with low-emission energy sources for planes.</p><h2 id="so-what-about-it">So What About It?</h2><p>I&apos;m starting to pick up a theme here. Let&apos;s put the pieces together:</p><ul><li>50% of global CO&#x2082; emissions come from electricity and heat production</li><li>Heat production can be electrified</li><li>17% of EU GHG emissions come from road transport</li><li>Road transport can be electrified</li><li>We&apos;ve got low-emission electricity generation figured out</li></ul><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Kermit-Crisis-Solved.gif" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="498" height="384"><figcaption>Source: <a href="https://tenor.com/view/muppet-family-christmas-muppets-sesame-street-kermit-crisis-gif-15746540">Tenor</a></figcaption></figure><p>Yeah, I wish it were, Kermit &#x1F97A; We may have low-emission, renewable electricity generation figured out, but generation alone is not enough for &#x26A1;<strong>ELECTRICAL ENERGY WORLD DOMINATION</strong>&#x26A1;. The other big piece of the puzzle is <strong><em>getting that electrical energy to all the places it&apos;s needed</em></strong>, also known as <strong><em>infrastructure</em></strong>, also known as the <strong><em>power grid</em></strong>.</p><p>You see, the power grid we have today was for the most part built with the following assumptions:</p><ul><li>Power will be generated at a few large power plants</li><li>The transmission lines will fan out from these few power plants</li><li>The amount of power generated can be controlled</li></ul><p>However, these assumptions are on increasingly shaky ground nowadays. The reason for that is a combination of 3 things.</p><h3 id="1-most-newly-installed-generation-is-renewable">1. Most Newly Installed Generation is Renewable</h3><p>In 2019, 72% of newly installed generation was renewable (that includes hydro, wind, solar, bioenergy, and geothermal - just like <a href="https://www.youtube.com/watch?v=kbW5sxyu9bU#t=8">Captain Planet</a>):</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Renewable-share-of-annual-power-capacity-expansion.png" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="950" height="645" srcset="https://121gigawatts.org/content/images/size/w600/2022/03/Renewable-share-of-annual-power-capacity-expansion.png 600w, https://121gigawatts.org/content/images/2022/03/Renewable-share-of-annual-power-capacity-expansion.png 950w" sizes="(min-width: 720px) 720px"><figcaption>Source: <a href="https://www.irena.org/-/media/Files/IRENA/Agency/Publication/2020/Mar/IRENA_RE_Capacity_Highlights_2020.pdf?la=en&amp;hash=B6BDF8C3306D271327729B9F9C9AF5F1274FE30B">IRENA Renewable Capacity Highlights 2020</a></figcaption></figure><h3 id="2-most-newly-installed-renewable-generation-is-non-dispatchable">2. Most Newly Installed <em>Renewable</em> Generation Is Non-Dispatchable</h3><p>Generation is defined as <em>non-dispatchable</em> when it can&apos;t be turned on or off on demand. Think wind turbines and solar panels. You don&apos;t decide <strong><em>how much</em></strong> energy you&apos;re going to produce, or <strong><em>when</em></strong>. You produce <strong><em>when</em></strong> the wind is blowing or the sun is shining, and you produce <strong><em>no more than</em></strong> the wind is blowing or the sun is shining.</p><p><strong><em>In 2019, newly installed wind and solar capacity accounted for 90% of all newly installed renewable sources.</em></strong></p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Renewable-power-capacity-growth.png" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="993" height="650" srcset="https://121gigawatts.org/content/images/size/w600/2022/03/Renewable-power-capacity-growth.png 600w, https://121gigawatts.org/content/images/2022/03/Renewable-power-capacity-growth.png 993w" sizes="(min-width: 720px) 720px"><figcaption>Source: <a href="https://www.irena.org/-/media/Files/IRENA/Agency/Publication/2020/Mar/IRENA_RE_Capacity_Highlights_2020.pdf?la=en&amp;hash=B6BDF8C3306D271327729B9F9C9AF5F1274FE30B">IRENA Renewable Capacity Highlights 2020</a></figcaption></figure><p>So if 72% of all newly installed generation is renewable, and 90% of all renewable generation is wind and solar, then <strong><em>65% of all newly installed generation is non-dispatchable</em></strong>, and that share is <em>trending upwards</em>.</p><h3 id="3-wind-solar-are-decentralised">3. Wind &amp; Solar Are Decentralised</h3><p>Pardon the buzzword. Remember how the grid was built with the assumption that there will be few big power plants, with transmission lines fanning outward from there? Well, wind and solar are small and all over the place &#x1F937;&#x200D;&#x2642;&#xFE0F;</p><hr><p>On top of all of these, electrifying heating and <a href="https://www.eea.europa.eu/themes/transport/electric-vehicles/electric-vehicles-and-energy">road transport</a> means that we&apos;re bringing significantly<strong><em> more load</em></strong> onto the power grid.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Hamsterwheel-1.gif" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="420" height="422"><figcaption>Source: <a href="https://giphy.com/gifs/slow-down-o9W9ILrxLrHpe">Giphy</a></figcaption></figure><h2 id="the-grid-needs-our-help">The Grid Needs Our Help</h2><p>The combination of the trends above means that the power grid is increasingly faced with the following problems:</p><ul><li>Power is not generated <strong><em>when</em></strong> it&apos;s needed</li><li>Power is not generated <strong><em>where</em></strong> it&apos;s needed</li><li>The power supply is becoming more <strong><em>volatile</em></strong></li></ul><p>All of this is giving headaches to grid operators, because they&apos;re the ones responsible for keeping the grid <a href="https://121gigawatts.org/whats-the-deal-with-grid-frequency">in balance</a>. Their life used to be easier when power generation came from nothing but dispatchable power plants so they could control everything. If only there were a way of taming those erratic renewable energy sources &#x1F914;</p><h3 id="that-s-where-virtual-power-plants-come-in-">That&apos;s Where Virtual Power Plants Come In!</h3><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/superman-costume-dog.gif" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="640" height="358"><figcaption>Source: <a href="https://tenor.com/view/superman-costume-dog-im-here-superhero-superman-gif-14710095">Tenor</a></figcaption></figure><p>Virtual Power Plants are software systems that provide control over a bunch of distributed energy resources like solar panels, wind turbines, batteries, or flexible loads. They&apos;re like the <em>shepherds</em> of the new power grid &#x2015; and pretty advanced ones at that.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/sheep-counting-sheep-1.gif" class="kg-image" alt="The &quot;Why&quot; of Virtual Power Plants" loading="lazy" width="450" height="399"><figcaption>Source: <a href="https://tenor.com/view/sheep-counting-sheep-jump-gif-12785650">Tenor</a></figcaption></figure><p>This is just what grid operators need &#x2015; <strong><em><a href="https://www.iea.org/commentaries/the-who-and-how-of-power-system-flexibility">flexibility</a></em></strong>. As uncertainty in the grid increases with more renewables coming in, so does the need for more sophisticated control of both power <em>generation</em> and <em>consumption</em>. The simplest example of this is a virtual power plant controlling batteries which charge when there&apos;s too much production and discharge when there&apos;s too much demand (which I covered in <a href="https://121gigawatts.org/what-is-a-virtual-power-plant-anyway">this post</a>). However, there&apos;s actually a variety of nuanced problems that grid operators face, and for which they increasingly turn to virtual power plants for help. In the next several posts, I will dive deeper into what those problems are, and how we at sonnen solve them.</p><p>The best part is that the optimal way of solving these problems, particularly using batteries, often happens to be <strong><em>the most sustainable way</em></strong> &#x2015; because batteries essentially attempt to <em>capture</em> excess renewable energy, and feed it back into the grid when there&apos;s a lack of it. Today, a huge share of this excess renewable energy is simply <strong><em>thrown away</em></strong>. &#x1F5D1;&#xFE0F;</p><p>I guess what I am trying to say is this:</p><blockquote>Virtual power plants are crucial for solving the modern problems of the grid, and solving the modern problems of the grid will bring <strong><em>big</em> reductions</strong> in greenhouse gas emissions.</blockquote><p>In addition to that, they&apos;re a lovely engineering problem. &#x1F916;</p><hr><p>Anyway, this is how I explain to myself why what I&apos;m working on is important. With that out of the way, now I can tell you about why it&apos;s fun! Stay tuned! &#x1F913;</p><p>In the mean time, if you have any questions or remarks, let me know in the comments below or on <a href="https://www.linkedin.com/posts/zoltanmaric_the-why-of-virtual-power-plants-activity-6663916882585763840-SeLA">LinkedIn</a> or on <a href="https://twitter.com/zoltanmaric/status/1258152624341364740?s=20">Twitter</a>. &#x1F44B;</p>]]></content:encoded></item><item><title><![CDATA[How Is Blockchain Immutable?]]></title><description><![CDATA[Immutable is just a fancy way of saying a blockchain’s contents cannot be changed. See what happens if Bugs Bunny tries to change the contents of a block.]]></description><link>https://121gigawatts.org/how-is-blockchain-immutable/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b79</guid><category><![CDATA[Blockchain]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Sat, 07 Mar 2020 00:00:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/Bugs-Bunny-Eyebrows.gif" medium="image"/><content:encoded><![CDATA[<img src="https://121gigawatts.org/content/images/2022/03/Bugs-Bunny-Eyebrows.gif" alt="How Is Blockchain Immutable?"><p>In <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-putting-it-all-together">episode 5 of The Building Blocks of Blockchain</a>, we explained in detail how the mechanics of blockchain work. We didn&#x2019;t really show how all of that makes blockchain <strong><strong><em><em>immutable</em></em></strong></strong>, though. Because immutability is one of the crucial features that makes blockchain interesting for application in the energy industry, I thought it worth explaining in more detail.</p><p><em><em>Immutable</em></em> is just a fancy way of saying a blockchain&#x2019;s contents cannot be changed. Let&#x2019;s see what happens if Bugs Bunny attempts to change the contents of a block.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Bugs-Bunny-Eyebrows-1.gif" class="kg-image" alt="How Is Blockchain Immutable?" loading="lazy" width="480" height="360"><figcaption>Source: <a href="https://giphy.com/gifs/looneytunes-smile-9Jcw7ESF7uk7cQwUjO" class="cl di hg hh hi hj" target="_blank" rel="noopener nofollow" style="box-sizing: inherit; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; background-repeat: repeat-x; background-image: url(&quot;data:image/svg+xml;utf8,&lt;svg preserveAspectRatio=\&quot;none\&quot; viewBox=\&quot;0 0 1 1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot;&gt;&lt;line x1=\&quot;0\&quot; y1=\&quot;0\&quot; x2=\&quot;1\&quot; y2=\&quot;1\&quot; stroke=\&quot;rgba(0, 0, 0, 0.84)\&quot; /&gt;&lt;/svg&gt;&quot;); background-size: 1px 1px; background-position: 0px calc(1em + 1px);">Giphy</a></figcaption></figure><p>Let&#x2019;s take the same block we used in the <em><em><a href="https://121gigawatts.org/the-building-blocks-of-blockchain-putting-it-all-together">&#x201C;Putting It All Together&#x201D;</a></em></em> post:</p><!--kg-card-begin: markdown--><pre><code>1. Daffy Duck receives 12.5 Bitcoins
2. Yosemite Sam gives Wile E. Coyote 4 Bitcoins
3. Porky Pig gives Pep&#xE9; Le Pew 3 Bitcoins
4. Bugs Bunny gives Marvin the Martian 1 Bitcoin
5. Wile E. Coyote gives Elmer Fudd 2 Bitcoins
6. Elmer Fudd gives Porky Pig 7 Bitcoins
---
previous_block: 00bc30f8fae8f8b3ca113390fb4cfa16fd01084189fe285805a43c22bd81c739
nonce: 117
hash: 00639a07198476c9436cbbe1836ca8ca23c6a4792f8ebcba68732b56e9b81fae
</code></pre>
<!--kg-card-end: markdown--><p>And let&#x2019;s say this is <strong><strong><em><em>block number 5</em></em></strong></strong> in the blockchain.</p><p>Bugs&#x2019; first idea is to just <strong><strong><em><em>change transaction number 2</em></em></strong></strong> in the block:</p><!--kg-card-begin: markdown--><pre><code>2. Yosemite Sam gives Wile E. Coyote 4 Bitcoins
</code></pre>
<!--kg-card-end: markdown--><p>so that <strong><strong><em><em>he becomes the recipient</em></em></strong></strong> instead:</p><!--kg-card-begin: markdown--><pre><code>2. Yosemite Sam gives Bugs Bunny 4 Bitcoins
</code></pre>
<!--kg-card-end: markdown--><p>He quickly realises this won&#x2019;t work, because Yosemite Sam&#x2019;s <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures">digital signature</a> will not check out any more, and he can&#x2019;t create a valid signature without knowing Sam&#x2019;s private key.</p><p>He then figures he could just <strong><strong><em><em>remove</em></em></strong></strong> the transaction in which he gave Marvin his Bitcoin, essentially stealing it back. Now block number 5 looks like this:</p><!--kg-card-begin: markdown--><pre><code>1. Daffy Duck receives 25 Bitcoins
2. Yosemite Sam gives Wile E. Coyote 4 Bitcoins
3. Porky Pig gives Pep&#xE9; Le Pew 3 Bitcoins
4. Wile E. Coyote gives Elmer Fudd 2 Bitcoins
5. Elmer Fudd gives Porky Pig 7 Bitcoins
---
previous_block: 00bc30f8fae8f8b3ca113390fb4cfa16fd01084189fe285805a43c22bd81c739
nonce: 127
hash: 0091ba2887d8a267c462c8d6f0a538e87188748308e15c644e25e81e479eeaf6
</code></pre>
<!--kg-card-end: markdown--><p>However, removing the transaction <strong><strong><em><em>changes the <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes">hash</a></em></em></strong></strong> of the block:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Hash-change-on-removed-transaction.gif" class="kg-image" alt="How Is Blockchain Immutable?" loading="lazy" width="800" height="796"><figcaption>Bugs Bunny removes a transaction from the block, causing its <strong class="bx hk" style="box-sizing: inherit; font-family: medium-content-sans-serif-font, &quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, &quot;Lucida Sans&quot;, Geneva, Arial, sans-serif; font-weight: 700;">hash</strong> to <strong class="bx hk" style="box-sizing: inherit; font-family: medium-content-sans-serif-font, &quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, &quot;Lucida Sans&quot;, Geneva, Arial, sans-serif; font-weight: 700;">change</strong></figcaption></figure><p>The above calculation was made using <a href="https://keccak-256.cloxy.net/" rel="noopener nofollow">this online hash calculator</a>. The new hash is:</p><!--kg-card-begin: markdown--><pre><code>1f2d89d4cb8ed12233ea4a4c9578b64ff5071dfd2a1213eadf99f2d92e587bae
</code></pre>
<!--kg-card-end: markdown--><p>which no longer matches the <code>hash</code> declared above. What&#x2019;s more, it no longer provides a valid solution to the puzzle, as the new hash does not start with 2 zeroes! That means Bugs Bunny needs to solve <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-putting-it-all-together/#where-s-the-puzzle">the puzzle</a> all over again!</p><p>That&#x2019;s still not enough setback for Bugs Bunny to give up, so he goes about solving the puzzle. It takes him quite a while, but he manages to solve it eventually. He finds that the nonce <code>398</code> results in the following hash for his updated block number 5:</p><!--kg-card-begin: markdown--><pre><code>00be3133fa9810016c39305eb0dffc206ab98871b39fceec1b7d7c35911cb356
</code></pre>
<!--kg-card-end: markdown--><p>Now he has a valid-looking block which he could start spreading around. However, while he was solving the puzzle, there were several new blocks added to the blockchain! The next block, number 6, contains the <strong><strong><em><em>old hash</em></em></strong></strong> of block number 5 in its <code>previous_block</code> field. If Bugs Bunny were to update the <code>previous_block</code> field in block 6, <em><em>its</em></em> hash would change, which means he would need to solve a puzzle again, and then again for block 7, and 8, and each subsequent block.</p><blockquote><em><em><strong><strong>Any change to a block makes the hash of that block and all subsequent blocks invalid.</strong></strong></em></em></blockquote><p><em><em>Just call it a day, Bugs.</em></em></p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Bugs-Bunny-Shrug.gif" class="kg-image" alt="How Is Blockchain Immutable?" loading="lazy" width="480" height="480"><figcaption>Source: <a href="https://giphy.com/gifs/looneytunes-confused-bye-58FDuiRsLPfmpd1U6X" class="cl di hg hh hi hj" target="_blank" rel="noopener nofollow" style="box-sizing: inherit; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; background-repeat: repeat-x; background-image: url(&quot;data:image/svg+xml;utf8,&lt;svg preserveAspectRatio=\&quot;none\&quot; viewBox=\&quot;0 0 1 1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot;&gt;&lt;line x1=\&quot;0\&quot; y1=\&quot;0\&quot; x2=\&quot;1\&quot; y2=\&quot;1\&quot; stroke=\&quot;rgba(0, 0, 0, 0.84)\&quot; /&gt;&lt;/svg&gt;&quot;); background-size: 1px 1px; background-position: 0px calc(1em + 1px);">Giphy</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[The Building Blocks of Blockchain: Putting It All Together]]></title><description><![CDATA[We’ve learned how hashes, signatures, ledgers, and mining works. Now we can put the blocks together into the big picture for that “Aha!” moment I owe you.]]></description><link>https://121gigawatts.org/the-building-blocks-of-blockchain-putting-it-all-together/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b78</guid><category><![CDATA[Blockchain]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Sat, 07 Mar 2020 00:00:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/Yosemite-Sam-Dancing.gif" medium="image"/><content:encoded><![CDATA[<blockquote>This is the 5th post in the series &#x201C;The Building Blocks of Blockchain.&#x201D; You can find the index and the introductory post of the series <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-introduction">here</a>.</blockquote><img src="https://121gigawatts.org/content/images/2022/03/Yosemite-Sam-Dancing.gif" alt="The Building Blocks of Blockchain: Putting It All Together"><p>Alright! We&#x2019;ve learned <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes">how hashes work</a>, <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures">how digital signatures work</a>, and <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-distributed-ledgers-mining">how distributed ledgers and mining works</a>. We&#x2019;ve learned how each of them works <em><em>conceptually</em></em> and <em><em>in isolation</em></em>. They are the basic building blocks we need to understand <em><em>well </em></em>&#x2014; in order to understand blockchain well. Now we&#x2019;re ready to put the blocks together and build the big picture so you can finally experience that &#x201C;Aha!&#x201D; moment I owe you.</p><p>So let&#x2019;s get to it!</p><hr><p>In the <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-distributed-ledgers-mining">last episode</a>, the relationship between Bugs Bunny and Marvin the Martian was somewhere along these lines:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Angry-Marvin.gif" class="kg-image" alt="The Building Blocks of Blockchain: Putting It All Together" loading="lazy" width="480" height="360"><figcaption>Source: <a href="https://www.youtube.com/watch?v=xdq9B7OZ01s" class="bw cu gr iu gt gu" target="_blank" rel="noopener nofollow" style="box-sizing: inherit; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; background-repeat: repeat-x; background-size: 1px 1px; background-position: 0px calc(1em + 1px); background-image: url(&quot;data:image/svg+xml;utf8,&lt;svg preserveAspectRatio=\&quot;none\&quot; viewBox=\&quot;0 0 1 1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot;&gt;&lt;line x1=\&quot;0\&quot; y1=\&quot;0\&quot; x2=\&quot;1\&quot; y2=\&quot;1\&quot; stroke=\&quot;rgba(0, 0, 0, 0.84)\&quot; /&gt;&lt;/svg&gt;&quot;);">YouTube</a></figcaption></figure><p>And guess what? Bugs <strong><strong><em><em>still</em></em></strong></strong> owes Marvin that Bitcoin! Unlike last time though, now Bugs Bunny has one to spare, so all he has to do is submit a transaction to Marvin&#x2019;s address. Let&#x2019;s look at how he does that.</p><h2 id="submitting-a-transaction">Submitting a Transaction</h2><p>The usual way for users to exchange Bitcoins is by using a wallet. A wallet is an app on your phone or computer which holds your private key, and which you use to submit transactions. In the earlier <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures/">post on digital signatures</a>, we mentioned how a wallet is used to generate a key pair which we need to produce digital signatures.</p><p>In much the same way, Bugs Bunny uses the wallet on his phone to submit the following transaction:</p><!--kg-card-begin: markdown--><pre><code>Amount: 1 Bitcoin
Recipient: (Marvin) bc1q428wf72dmujnz58l57tm3n76gyhkxad7y5rrqh
Signature: MEUCIQDnFAMFHCJjkxGu+dvFZqxzmvN7uMVf5Y1wSinebiTJ6wIgCFoN2Ak04YgGnRVM12uy7wXsoo45xM8MChNwAov46TY=
</code></pre>
<!--kg-card-end: markdown--><p>That strange string of characters in the recipient field is Marvin&#x2019;s Bitcoin address. This is an identifier in blockchain which works just like a bank account number. The <code>Signature</code> field contains a digital signature produced with Bugs Bunny&#x2019;s private key. This proves that the transaction came from Bugs Bunny, as described in the <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures/">digital signatures building block</a>.</p><p>In the rest of this post, we&#x2019;ll keep using the more friendly-looking transaction notation from our previous post:</p><!--kg-card-begin: markdown--><pre><code>Bugs Bunny gives Marvin the Martian 1 Bitcoin
</code></pre>
<!--kg-card-end: markdown--><p>I just thought it&#x2019;s worthwhile reminding ourselves that each of these transactions contains a digital signature.</p><p>Once created, the wallet submits this transaction to one of the miners.</p><h1 id="the-anatomy-of-a-block">The Anatomy of a Block</h1><p>As we described in the <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-distributed-ledgers-mining/">previous post</a>, miners are the ones that write transactions into a blockchain. They don&#x2019;t write them into the blockchain one by one, but in batches. Each batch of transactions is organised into<strong><strong><em><em> </em></em></strong></strong>a<strong><strong><em><em> block</em></em></strong></strong>, so miners write <em><em>blocks</em></em> of transactions into the blockchain. Let&#x2019;s see what these blocks look like and how they get added to the blockchain.</p><p>Daffy Duck is still a miner in our blockchain network, and he just received Bugs&#x2019; transaction. He now has 5 verified transactions submitted to him, which he wants to put in a block and add that block to the blockchain. Here&#x2019;s what this block might look like:</p><!--kg-card-begin: markdown--><pre><code>1. Daffy Duck receives 12.5 Bitcoins
2. Yosemite Sam gives Wile E. Coyote 4 Bitcoins
3. Porky Pig gives Pep&#xE9; Le Pew 3 Bitcoins
4. Bugs Bunny gives Marvin the Martian 1 Bitcoin
5. Wile E. Coyote gives Elmer Fudd 2 Bitcoins
6. Elmer Fudd gives Porky Pig 7 Bitcoins
---
previous_block: 00bc30f8fae8f8b3ca113390fb4cfa16fd01084189fe285805a43c22bd81c739
</code></pre>
<!--kg-card-end: markdown--><h2 id="where-do-bitcoins-come-from">Where Do Bitcoins Come From?</h2><p>That first transaction in that block above looks weird.</p><blockquote><em><em>&#x201C;Daffy Duck <strong><strong>receives</strong></strong> 12.5 Bitcoins.&#x201D;</em></em></blockquote><p><em><em>Receives</em></em>&#x2026; <strong><strong><em><em>from whom</em></em></strong></strong>? From <em><em>no one</em></em>. The first transaction in any block is the so-called <strong><strong><em><em>coinbase transaction</em></em></strong></strong>, and it&#x2019;s a transaction that <strong><strong><em><em>creates Bitcoins out of thin air</em></em></strong></strong>. In fact, this is<strong><strong><em><em> the one and only way how Bitcoins are created</em></em></strong></strong>. Apart from creating Bitcoins, the other purpose of the coinbase transaction is to provide an <strong><strong><em><em>incentive</em></em></strong></strong> for miners to mine, i.e. an incentive to verify transactions they receive and write them into the ledger. It&#x2019;s essentially <em><em>the miners&#x2019; paycheck</em></em>.</p><p>The amount that miners receive in the coinbase transaction is called the <strong><strong><em><em>block reward</em></em></strong></strong>, and it is defined in Bitcoin&#x2019;s protocol. It started with 50 Bitcoins in 2008, and it halves every 4 years. At the time of writing this post, the block reward is 12.5 Bitcoins, and it&#x2019;s poised to halve to 6.25 Bitcoins this year (in 2020).</p><p>There&#x2019;s another thing we haven&#x2019;t seen before, but appeared in our sample block above: the <code>previous_block</code> field. This field contains <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes">the hash</a> of the last block in the blockchain. Each block contains the hash of the block that came before it, which ensures the <strong><strong><em><em>blocks are sequential</em></em></strong></strong>, and <strong><strong><em><em>prevents changes to the contents</em></em></strong></strong> of the blocks in the blockchain. In other words, this field is what makes the blockchain a <em><em>chain</em></em>.</p><p>Something&#x2019;s still missing, though. We learned in the <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-distributed-ledgers-mining">post on distributed ledgers</a> that Daffy needs to solve <strong><strong><em><em>a puzzle</em></em></strong></strong> first in order to add the block to the blockchain. Where does that fit in to the story?</p><h2 id="where-s-the-puzzle">Where&#x2019;s the Puzzle?</h2><p>The puzzle that miners have to solve is actually ingeniously simple. Check it out:</p><blockquote><em><em>The <strong><strong>hash</strong></strong> of the block has to <strong><strong>start</strong></strong> with a certain number of <strong><strong>zeroes</strong></strong>.</em></em></blockquote><p>Let&#x2019;s see what that means. First, let&#x2019;s compute the hash of our block as it is now. For this, I just used <a href="https://keccak-256.cloxy.net/" rel="noopener nofollow">this online tool for computing hashes</a>.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Calculating-the-hash-of-a-block.gif" class="kg-image" alt="The Building Blocks of Blockchain: Putting It All Together" loading="lazy" width="600" height="552"><figcaption>Calculating the hash of a block</figcaption></figure><p>It uses <a href="https://en.wikipedia.org/wiki/SHA-3" rel="noopener nofollow">Keccak-256</a>, the same hash function that both Bitcoin and Ethereum use. The resulting hash is</p><!--kg-card-begin: markdown--><pre><code>cea391ea414e9d02dece0db721c0c35de3e50153f13b30160fd7b9260599b771
</code></pre>
<!--kg-card-end: markdown--><p>This hash starts with a <code>c</code>, which is definitely not a certain number of zeroes. There&#x2019;s a separate rule that determines what that certain number of zeroes is, i.e. how many zeroes the hash has to start with, but for our example, let&#x2019;s assume that our current puzzle requires the hash to start with <strong><strong><em><em>2 zeroes</em></em></strong></strong>. How can we make the hash of our block be different, though? The hash is the hash &#x2014; there&#x2019;s no <strong><strong><em><em>changing</em></em></strong></strong> it.</p><p>For exactly this purpose, Bitcoin&#x2019;s blocks contain another field, the <code>nonce</code>. That means a block actually looks more like this:</p><!--kg-card-begin: markdown--><p><code>1. Daffy Duck receives 12.5 Bitcoins</code><br>
<code>2. Yosemite Sam gives Wile E. Coyote 4 Bitcoins</code><br>
<code>3. Porky Pig gives Pep&#xE9; Le Pew 3 Bitcoins</code><br>
<code>4. Bugs Bunny gives Marvin the Martian 1 Bitcoin</code><br>
<code>5. Wile E. Coyote gives Elmer Fudd 2 Bitcoins</code><br>
<code>6. Elmer Fudd gives Porky Pig 7 Bitcoins</code><br>
<code>---</code><br>
<code>previous_block:</code><br>
<code>00bc30f8fae8f8b3ca113390fb4cfa16fd01084189fe285805a43c22bd81c739</code><br>
<strong><code>nonce: 0</code></strong></p>
<!--kg-card-end: markdown--><p>The <strong><strong><em><em>nonce</em></em></strong></strong> is a number which the miner can set freely in order to change the resulting hash, i.e. to make the hash of the block start with the required number of zeroes. It is essentially the solution of the puzzle.</p><p>Now that we&#x2019;ve introduced the nonce, we can express the puzzle more accurately:</p><blockquote><em><em>Find <strong><strong>a nonce</strong></strong>, such that the hash of the block starts with a certain number of zeroes.</em></em></blockquote><p>Again, for our example, we&#x2019;ll assume that the target is <strong><strong><em><em>2 zeroes</em></em></strong></strong>. So let&#x2019;s have at it! We add the new field, set the nonce to 0 (the lowest possible value) and use <a href="https://keccak-256.cloxy.net/" rel="noopener nofollow">that online tool</a> again to compute the hash:</p><!--kg-card-begin: markdown--><pre><code>89b3e49dc09b0028d3d0ce48ab30314438fd5a08a759302c3d12a6fecd781094
</code></pre>
<!--kg-card-end: markdown--><p>Still no cigar. Daffy has to keep trying different numbers for the nonce, until the resulting hash starts with 2 zeroes. Here are some of his attempts:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2020/04/Calculating-a-Hash-2.gif" class="kg-image" alt="The Building Blocks of Blockchain: Putting It All Together" loading="lazy"><figcaption>Notice how the hash changes as we change the value of the <strong class="bi kd" style="box-sizing: inherit; font-family: medium-content-sans-serif-font, &quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, &quot;Lucida Sans&quot;, Geneva, Arial, sans-serif; font-weight: 700;">nonce</strong></figcaption></figure><!--kg-card-begin: markdown--><pre><code>1:  e464f509fed70efa387ef32dd4172e1205900377094780d2ba6fe9f7c7523afc
2:  938c428a450b550c16e686ebf097e9811978b921beb4b84da7a90f5095d4fb13
3:  2d57d47654c2da7d0f37234c4e88bc7f4f0ec0e01624e7c91df533238a83973c
27: b8ef539375af495738e0bccc6f96f02ddfd34a409b8631ca5abae7e870bf1a02
</code></pre>
<!--kg-card-end: markdown--><p>After trying for quite a while, Daffy found that the nonce <code>117</code> results in the following hash:</p><!--kg-card-begin: markdown--><pre><code>00639a07198476c9436cbbe1836ca8ca23c6a4792f8ebcba68732b56e9b81fae
</code></pre>
<!--kg-card-end: markdown--><p>Bingo! The hash starts with 2 zeroes, so he&#x2019;s solved the puzzle!</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Puzzle-solving-dog.gif" class="kg-image" alt="The Building Blocks of Blockchain: Putting It All Together" loading="lazy" width="370" height="319"><figcaption>Source: <a href="https://giphy.com/gifs/funny-dog-math-UKkes2qN2T70s" class="bw cu gr iu gt gu" target="_blank" rel="noopener nofollow" style="box-sizing: inherit; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; background-repeat: repeat-x; background-size: 1px 1px; background-position: 0px calc(1em + 1px); background-image: url(&quot;data:image/svg+xml;utf8,&lt;svg preserveAspectRatio=\&quot;none\&quot; viewBox=\&quot;0 0 1 1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot;&gt;&lt;line x1=\&quot;0\&quot; y1=\&quot;0\&quot; x2=\&quot;1\&quot; y2=\&quot;1\&quot; stroke=\&quot;rgba(0, 0, 0, 0.84)\&quot; /&gt;&lt;/svg&gt;&quot;);">Giphy</a></figcaption></figure><blockquote><em><em>As you may remember from <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes">the post on hashes</a>, we said that cryptographic hash functions have an <a href="https://en.wikipedia.org/wiki/Avalanche_effect" rel="noopener nofollow"><strong><strong>avalanche effect</strong></strong></a>, i.e. that changing even a single digit in the input data results in a completely different hash. In Daffy&#x2019;s attempts with different nonces above, you can see the avalanche effect in action.</em></em></blockquote><h2 id="time-to-gossip">Time to Gossip</h2><p>Having solved the puzzle, Daffy Duck now has a valid block that he can tack onto the blockchain. He&#x2019;s said to have <strong><strong><em><em>mined a new block</em></em></strong></strong>. This is what his new block looks like:</p><p></p><!--kg-card-begin: markdown--><p><code>1. Daffy Duck receives 12.5 Bitcoins</code><br>
<code>2. Yosemite Sam gives Wile E. Coyote 4 Bitcoins</code><br>
<code>3. Porky Pig gives Pep&#xE9; Le Pew 3 Bitcoins</code><br>
<code>4. Bugs Bunny gives Marvin the Martian 1 Bitcoin</code><br>
<code>5. Wile E. Coyote gives Elmer Fudd 2 Bitcoins</code><br>
<code>6. Elmer Fudd gives Porky Pig 7 Bitcoins</code><br>
<code>---</code><br>
<code>previous_block:</code><br>
<code>00bc30f8fae8f8b3ca113390fb4cfa16fd01084189fe285805a43c22bd81c739</code><br>
<strong><code>nonce: 117</code></strong><br>
<strong><code>hash: 00639a07198476c9436cbbe1836ca8ca23c6a4792f8ebcba68732b56e9b81fae</code></strong></p>
<!--kg-card-end: markdown--><p>Now he needs to let the world know about it. He sends his new block to all the other miners he knows about. They calculate the hash of the new block, see that it starts with 2 zeroes, and therefore accept it as a valid block. These miners then forward it to all the miners <em><em>they</em></em> know about, and soon the block becomes part of the blockchain of all the miners. This process of announcing the new block is called the <a href="https://en.wikipedia.org/wiki/Gossip_protocol" rel="noopener nofollow">gossip protocol</a>. I&#x2019;m sure you can see why &#x1F92D;</p><p>Of course, Marvin has also been following the blockchain closely, so it&#x2019;s not long before he finds out Bugs&#x2019; transaction came through.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Cheering-Marvin.gif" class="kg-image" alt="The Building Blocks of Blockchain: Putting It All Together" loading="lazy" width="400" height="225"><figcaption>Source: <a href="https://www.tumbral.com/tag/Nostalgia%20chick" class="bw cu gr iu gt gu" target="_blank" rel="noopener nofollow" style="box-sizing: inherit; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; background-repeat: repeat-x; background-size: 1px 1px; background-position: 0px calc(1em + 1px); background-image: url(&quot;data:image/svg+xml;utf8,&lt;svg preserveAspectRatio=\&quot;none\&quot; viewBox=\&quot;0 0 1 1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot;&gt;&lt;line x1=\&quot;0\&quot; y1=\&quot;0\&quot; x2=\&quot;1\&quot; y2=\&quot;1\&quot; stroke=\&quot;rgba(0, 0, 0, 0.84)\&quot; /&gt;&lt;/svg&gt;&quot;);">Nostalgia Chick</a></figcaption></figure><h2 id="why-are-we-solving-puzzles-again">Why Are We Solving Puzzles, Again?</h2><p>At any time, there could be thousands of miners online, all competing to add the next block to the blockchain to get their reward. We want to <strong><strong><em><em>make sure that they don&#x2019;t add new blocks at the same time</em></em></strong></strong>, because that would lead to different versions of the ledger. Instead, we&#x2019;re looking for <strong><strong><em><em>a fair way to always pick one random miner</em></em></strong></strong> of all the miners who are online, and only allow that one miner to write the next block. Making them all solve the puzzle <strong><strong><em><em>is the fair way to always pick one miner</em></em></strong></strong>, because the puzzle is engineered so that statistically, every 10 minutes only one miner can find a solution.</p><blockquote><em><em>The puzzle is <strong><strong>the magic ingredient that replaces a central party</strong></strong> that would decide who gets to write into the blockchain. The puzzle is what makes blockchain<strong><strong> decentralised</strong></strong>.</em></em></blockquote><h2 id="one-solution-every-10-minutes-no-matter-how-many-miners">One Solution Every 10 Minutes, No Matter How Many Miners?</h2><p>That sounds suspicious, doesn&#x2019;t it? How can it be that there&#x2019;s always only 1 solution every 10 minutes, even if the number of miners increases? Shouldn&#x2019;t it take <em><em>less</em></em> time to find a solution if the number of miners <em><em>rises</em></em>? You&#x2019;re absolutely right. It <em><em>should</em></em>, and it <em><em>does</em></em>. But there&#x2019;s a simple way Bitcoin solves this.</p><p>In our earlier example, we said that Daffy had to find a hash which starts with 2 zeroes. The number of zeroes the hash has to start with is called the <strong><strong><em><em>difficulty</em></em></strong></strong>, and it&#x2019;s updated every 2 weeks. It&#x2019;s called the <em><em>difficulty</em></em>, because the more zeroes the hash is required to start with, the more <em><em>difficult</em></em> it is to find the right nonce, i.e. to solve the puzzle.</p><p>Every 2 weeks, the average time between blocks is calculated. If it&#x2019;s less than 10 minutes, the difficulty is increased accordingly. If it&#x2019;s more than 10 minutes, the difficulty is decreased. As I&#x2019;m writing this, the hash of the <a href="https://www.blockchain.com/btc/block/00000000000000000010fd56793e405827b237c6040f79df5faaa1717d9a2409" rel="noopener nofollow">most recent block</a> starts with <strong><strong><em><em>18 zeroes</em></em></strong></strong>, and its nonce is <code>1,284,630,554</code>.</p><h2 id="how-did-bugs-bunny-know-which-miner-to-submit-the-transaction-to">How Did Bugs Bunny Know Which Miner to Submit the Transaction To?</h2><p>In our example, Bugs Bunny sent his transaction to Daffy Duck, and Daffy <em><em>conveniently</em></em> mined the next block, including Bugs&#x2019; transaction. In reality, there could be thousands of miners online, and only one of them will mine a block every 10 minutes. This means it can take <em><em>quite a while</em></em> before Daffy actually mines the next block. So how is Bugs supposed to pick the right miner to send his transaction to, i.e. <strong><strong><em><em>guess who is going to mine the next block</em></em></strong></strong>?</p><p>Luckily, he doesn&#x2019;t need to. Just as miners use the gossip protocol to announce their newly mined block, they also use it to share newly received transactions. They check if the transaction is valid according to the current state of the ledger, and then they share the transactions with all other miners they know about.</p><h2 id="what-if-there-s-too-many-transactions">What If There&#x2019;s Too Many Transactions?</h2><p>As of February 2020, there are <a href="https://www.blockchain.com/en/charts/n-transactions-per-block?timespan=1year&amp;daysAverageString=1" rel="noopener nofollow">around 2000 transactions</a> in a Bitcoin block on average. If there&#x2019;s 1 new block every 10 minutes, that means Bitcoin can execute about 3.6 transactions per second. That gives Bugs Bunny a mischievous idea: he&#x2019;ll create another Bitcoin address for himself, and submit millions of transactions just passing 1 Bitcoin between his 2 addresses. This will make the miners dance to Bugs&#x2019; tune,</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Yosemite-Sam-Dancing-1.gif" class="kg-image" alt="The Building Blocks of Blockchain: Putting It All Together" loading="lazy" width="480" height="360"><figcaption>Source: <a href="https://giphy.com/gifs/looneytunes-dancing-party-looney-tunes-L0snCScL0LMBor5sE0" class="bw cu gr iu gt gu" target="_blank" rel="noopener nofollow" style="box-sizing: inherit; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; background-repeat: repeat-x; background-size: 1px 1px; background-position: 0px calc(1em + 1px); background-image: url(&quot;data:image/svg+xml;utf8,&lt;svg preserveAspectRatio=\&quot;none\&quot; viewBox=\&quot;0 0 1 1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot;&gt;&lt;line x1=\&quot;0\&quot; y1=\&quot;0\&quot; x2=\&quot;1\&quot; y2=\&quot;1\&quot; stroke=\&quot;rgba(0, 0, 0, 0.84)\&quot; /&gt;&lt;/svg&gt;&quot;);">Giphy</a></figcaption></figure><p>while all other transactions will be stuck in line waiting for Bugs&#x2019; transactions to clear. What a <em><em>rascal</em></em>.</p><p>As you may have guessed, Bitcoin has a remedy for such mischievous behaviour:</p><blockquote><em><em>Transactions are not free.</em></em></blockquote><p>Transactions actually include a fee, so that transaction that Bugs Bunny sent to Marvin the Martian looked more like this:</p><!--kg-card-begin: markdown--><pre><code>Withdraw 1.01 Bitcoins from Bugs Bunny, deposit 1 Bitcoin to Marvin
</code></pre>
<!--kg-card-end: markdown--><p>That missing 0.01 Bitcoin is awarded to the miner who eventually mines this transaction. If the <em><em>block reward</em></em> is a miner&#x2019;s paycheck, <strong><strong><em><em>the transaction fee is</em></em></strong></strong> <strong><strong><em><em>the miner&#x2019;s tip</em></em></strong></strong>. Without a high enough tip, miners will just ignore the transaction and move on with their lives. The amount of the fee is not part of the Bitcoin protocol &#x2014; it&#x2019;s at the discretion of each miner to decide what they will accept as a sufficient fee to include a transaction in their next block. This basically means transaction fees create <a href="https://bitinfocharts.com/comparison/transactionfees-transactions-btc.html" rel="noopener nofollow">a market of their own</a>.</p><p>Having learned this, Bugs Bunny now has 2 options: either he submits his transactions without a fee, resulting in the miners ignoring them; or he includes a fee, which makes his plan look more like this:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Burning-Money.gif" class="kg-image" alt="The Building Blocks of Blockchain: Putting It All Together" loading="lazy" width="500" height="360"><figcaption>Source: <a href="https://giphy.com/gifs/looney-tunes-gem-money-to-burn-lS1XSGltYjIHu" class="bw cu gr iu gt gu" target="_blank" rel="noopener nofollow" style="box-sizing: inherit; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; background-repeat: repeat-x; background-size: 1px 1px; background-position: 0px calc(1em + 1px); background-image: url(&quot;data:image/svg+xml;utf8,&lt;svg preserveAspectRatio=\&quot;none\&quot; viewBox=\&quot;0 0 1 1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot;&gt;&lt;line x1=\&quot;0\&quot; y1=\&quot;0\&quot; x2=\&quot;1\&quot; y2=\&quot;1\&quot; stroke=\&quot;rgba(0, 0, 0, 0.84)\&quot; /&gt;&lt;/svg&gt;&quot;);">Giphy</a></figcaption></figure><h2 id="congratulations-">Congratulations!</h2><p>There we have it! You should now have a fairly deep understanding of how blockchain works, all based on the practical details of how Bitcoin &#x2014; the first blockchain &#x2014; works.</p><p>One often-repeated feature of blockchain is its immutability, i.e. that its contents cannot be changed. This is a key feature that makes blockchain attractive for the energy industry. In case you&#x2019;re interested in learning how what we learned here makes blockchain immutable, you can find out in <a href="https://121gigawatts.org/how-is-blockchain-immutable/">this 3-minute post</a> I wrote.</p><p>If you found any of this confusing or unclear, please let me know in the comments below, or on <a href="https://www.linkedin.com/posts/zoltanmaric_the-building-blocks-of-blockchain-putting-activity-6642144886801870848-N1_s">LinkedIn</a>, or on <a href="https://twitter.com/zoltanmaric/status/1236984041397723136?s=20">Twitter</a>.</p><p>Even though we still haven&#x2019;t talked about the arguably most exciting part of blockchain &#x2014; <strong><strong><em><em>smart contracts</em></em></strong></strong>, I thought this would be an appropriate moment for me to thank you, and for you to thank yourself, since you&#x2019;ve just learned the complete story of blockchain as Bitcoin defined it. Smart contracts were only introduced 6 years after Bitcoin&#x2019;s release &#x2014; with Ethereum.</p><p>In the next and final episode of the <em><em>Building Blocks</em></em> series, we will talk about how smart contracts tie into what we learned about blockchain so far, and what the energy industry had in mind with them.</p><p>I would like to take this opportunity to praise the outstanding Coursera course &#x201C;<a href="https://www.coursera.org/learn/cryptocurrency" rel="noopener nofollow">Bitcoin and Cryptocurrency Technologies</a>&#x201D; given by Princeton University. I completed this course in 2017, and this was the one resource that gave me my first in-depth understanding of blockchain.</p><hr><p>All copyrighted material used under Fair Use for educational purposes.</p>]]></content:encoded></item><item><title><![CDATA[The Building Blocks of Blockchain: Distributed Ledgers & Mining]]></title><description><![CDATA[A Looney Approach to How Blockchain Conceptually Works]]></description><link>https://121gigawatts.org/the-building-blocks-of-blockchain-distributed-ledgers-mining/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b77</guid><category><![CDATA[Blockchain]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Mon, 10 Feb 2020 00:00:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/Wile-E-Coyote-pondering.gif" medium="image"/><content:encoded><![CDATA[<blockquote>This is the 4th post in the series &#x201C;The Building Blocks of Blockchain&#x201D;. You can find the introductory post of the series <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-introduction">here</a>.</blockquote><img src="https://121gigawatts.org/content/images/2022/03/Wile-E-Coyote-pondering.gif" alt="The Building Blocks of Blockchain: Distributed Ledgers &amp; Mining"><p>The first blockchain ever made is the blockchain behind Bitcoin. The purpose of creating Bitcoin was creating a completely digital, decentralized currency system. We&#x2019;ll talk about what &#x201C;decentralized&#x201D; means shortly&#x2014; what I want to emphasize now, is that <strong><strong>blockchain was invented to implement a currency system</strong></strong>. It&#x2019;s a simple goal, and in this post I want to explain how blockchain achieves this goal. Once you understand that, you will understand the most important part of how blockchain works.</p><h2 id="a-book-of-transactions">A Book of Transactions</h2><p>Bitcoin uses a blockchain to store information about how much money everyone has, and how they&#x2019;re transferring their &#x201C;money&#x201D; between each other. To put it differently, Bitcoin&#x2019;s blockchain is a <strong><strong><em><em>database</em></em></strong></strong> containing information on balances and transactions. It&#x2019;s basically <strong><strong><em><em>a book of transactions</em></em></strong></strong>, also called <strong><strong><em><em>a ledger</em></em></strong></strong>. I&#x2019;m not even exaggerating too much when I tell you that this is what a blockchain <strong><strong><em><em>looks like:</em></em></strong></strong></p><!--kg-card-begin: markdown--><p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code></p>
<!--kg-card-end: markdown--><p>It&#x2019;s what you would expect <em><em>any</em></em> ledger to look like, right? Each line is a transaction with an amount, a sender, and a recipient. The first line is a bit of an exception, in that it has no sender. Instead, it declares the <strong><strong><em><em>creation</em></em></strong></strong> of 25 Bitcoins and awarding them to Sylvester. I&#x2019;ll describe how Bitcoins are created in the next post. For now, let&#x2019;s focus on balances and transactions.</p><p><strong><strong><em><em>The ledger is the source of truth.</em></em></strong></strong> You only have Bitcoin if the ledger says you have Bitcoin, and if you want to give someone Bitcoin, you can only do that by adding a transaction that says so into the ledger. From our example ledger above, we can clearly tell that Sylvester has 15 Bitcoins, Porky Pig has 3 Bitcoins, Wile E. Coyote has 1 Bitcoin, and I&#x2019;m sure you can figure out for yourself how many Bitcoins Yosemite Sam has.</p><p>So that&#x2019;s our currency system. We can tell everyone&#x2019;s current balance by summing up all the transactions in the ledger, and participants can exchange the currency by submitting new transactions into the ledger. But how does that actually happen? <strong><strong><em><em>Where</em></em></strong></strong> is the ledger, and <strong><strong><em><em>who</em></em></strong></strong> writes the new transactions into it?</p><p>The simple solution to that question would be &#x2014; an almighty accountant. In other words, a single participant that safeguards the ledger and is the only one allowed to write new transactions into it.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Sylvester-the-cat-scheming.gif" class="kg-image" alt="The Building Blocks of Blockchain: Distributed Ledgers &amp; Mining" loading="lazy" width="640" height="360"></figure><p>As you can see, in our story, Sylvester is the almighty accountant. If Yosemite Sam wants to give Bugs Bunny a Bitcoin, all Sam needs to do is tell Sylvester that he is giving 1 Bitcoin to Bugs. Sylvester checks the ledger and sees that Sam has 6 Bitcoins available, meaning the new transaction is valid, so Sylvester records the new transaction in the ledger. Now the ledger looks like this:</p><!--kg-card-begin: markdown--><p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code><br>
<strong><code>5. Yosemite Sam gives Bugs Bunny 1 Bitcoin</code></strong></p>
<!--kg-card-end: markdown--><p>This is a completely legit solution, and I&#x2019;m sure you&#x2019;ve met such almighty accountants before &#x2014; Visa, PayPal, <em><em>your bank&#x2026; </em></em>They&#x2019;re all parties whom you <strong><strong><em><em>trust</em></em></strong></strong> and who have the exclusive right to carry out transactions in their respective payment systems. E.g. when you want to send some money to your friend via PayPal, you <strong><strong><em><em>tell</em></em></strong></strong> <strong><strong><em><em>PayPal</em></em></strong></strong> you&#x2019;re doing so, and PayPal records this transaction in their ledger. This is what we call a <strong><strong><em><em>centralised</em></em></strong></strong> payment system, because it relies on a <strong><strong><em><em>trusted central party</em></em></strong></strong> for managing the ledger.</p><p>But in 2008, along came this dude called Satoshi Nakamoto, who said &#x201C;hold my beer&#x201D; and then published a white paper called &#x201C;<a href="https://bitcoin.org/en/bitcoin-paper" rel="noopener nofollow">Bitcoin: A Peer-to-Peer Electronic Cash System</a>&#x201D; that described how you can make digital payments work<strong><strong><em><em> without a trusted central party</em></em></strong></strong>. By the way, it turns out that Satoshi is not even a real person, and so to this day <a href="https://web.archive.org/web/20180615010015/http://www.businessinsider.com/bitcoin-history-cryptocurrency-satoshi-nakamoto-2017-12" rel="noopener nofollow">we have no idea</a> who came up with Bitcoin &#x1F937;</p><h2 id="a-distributed-ledger">A Distributed Ledger</h2><p>Bitcoin enables digital payments without a central party by using a <em><em>distributed ledger</em></em>. But <strong><strong><em><em>what is a distributed ledger?</em></em></strong></strong> The basic idea is that anyone can download a copy of the ledger, and, instead of an almighty accountant, <strong><strong><em><em>anyone can write new transactions into the ledger</em></em></strong></strong>.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Surprised-Daffy.gif" class="kg-image" alt="The Building Blocks of Blockchain: Distributed Ledgers &amp; Mining" loading="lazy" width="480" height="360"></figure><blockquote><em><em>Wait, what? How can that work?!</em></em></blockquote><p>Well let&#x2019;s have a look-see! Say Daffy Duck decided to download a copy of the ledger. At this point, both Daffy Duck and Sylvester hold identical copies of the ledger. Daffy Duck then announces that <strong><strong><em><em>he </em></em></strong></strong>is now also a trusted accountant, and transactions can also be submitted to him to enter into the ledger.</p><p>Meanwhile, Bugs Bunny owes both Elmer Fudd and Marvin the Martian 1 Bitcoin. He hears the news that there are now 2 trusted accountants, so he decides to be a <em><em>wise guy</em></em> about it. He tells Sylvester that he&#x2019;s giving 1 Bitcoin <strong><strong>to</strong></strong> <strong><strong>Marvin the Martian</strong></strong>, and he tells Daffy Duck that he is giving 1 Bitcoin <strong><strong>to</strong></strong> <strong><strong>Elmer Fudd</strong></strong>. Now the ledgers look like this:</p><!--kg-card-begin: markdown--><h3 id="sylvestersledger">Sylvester&apos;s Ledger</h3>
<p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code><br>
<code>5. Yosemite Sam gives Bugs Bunny 1 Bitcoin</code><br>
<strong><code>6. Bugs Bunny gives Marvin the Martian 1 Bitcoin</code></strong></p>
<h3 id="daffyducksledger">Daffy Duck&apos;s Ledger</h3>
<p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code><br>
<code>5. Yosemite Sam gives Bugs Bunny 1 Bitcoin</code><br>
<strong><code>6. Bugs Bunny gives Elmer Fudd 1 Bitcoin</code></strong></p>
<!--kg-card-end: markdown--><blockquote><em><em>Sufferin&#x2019; succotash, Daffy! It looks like Bugs committed a <strong><strong>double spend</strong></strong>!</em></em></blockquote><p>Sylvester discovers that his and Daffy&#x2019;s ledger no longer match, and what&#x2019;s worse, Bugs Bunny seems to have given his <strong><strong><em><em>only</em></em></strong></strong> Bitcoin to <strong><strong><em><em>two</em></em></strong></strong> different people! They quickly realise that their currency system is not going to work this way, so they decide to hire an <strong><strong><em><em>expert</em></em></strong></strong>.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Wile-E-Coyote-Expert.gif" class="kg-image" alt="The Building Blocks of Blockchain: Distributed Ledgers &amp; Mining" loading="lazy" width="498" height="372"></figure><p>Remember we said <strong><strong><em><em>anyone should be able to write into the ledger</em></em></strong></strong>? This means we can&#x2019;t hope that Sylvester and Daffy are going to be the only 2 accountants for good. Soon there could be <strong><strong><em><em>tens</em></em></strong></strong>, maybe <strong><strong><em><em>hundreds</em></em></strong></strong> of accountants, and they should all be able to write into the ledger. How can Wile E. make them<strong><strong><em><em> all maintain an identical copy of the ledger</em></em></strong></strong>?</p><p>He suspects the key will be to make sure <strong><strong><em><em>only</em></em></strong></strong> <strong><strong><em><em>one accountant at a time</em></em></strong></strong> <strong><strong><em><em>writes</em></em></strong></strong> a transaction into the ledger. But how can he make sure <strong><strong><em><em>only one accountant at a time writes</em></em></strong></strong> a transaction into the ledger, even as <strong><strong><em><em>new accountants can join any time</em></em></strong></strong>? Wile E. has to ponder on this one.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Wile-E-Coyote-pondering-1.gif" class="kg-image" alt="The Building Blocks of Blockchain: Distributed Ledgers &amp; Mining" loading="lazy" width="480" height="360"></figure><h2 id="puzzles-">Puzzles!</h2><p>That&#x2019;s it! Wile E. comes up with an <strong><strong><em><em>ingenious</em></em></strong></strong> rule:</p><blockquote><em><em>Before an accountant can write a new transaction into the ledger, they have to <strong><strong>solve</strong></strong> <strong><strong>a puzzle!</strong></strong></em></em></blockquote><p>The puzzle will be so complicated, that even as all the accountants try <em><em>hard</em></em> to solve it, <strong><strong><em><em>all of them at the same time</em></em></strong></strong>, it will take about <strong><strong><em><em>10 minutes</em></em></strong></strong> before <strong><strong><em><em>one of them</em></em></strong></strong> manages to solve it. The accountant that solves the puzzle gets to write a transaction into the ledger.</p><p>She then shares the transaction she just added, along with the solution to the puzzle, to all the other accountants. They verify that the solution is correct, and therefore accept the new transaction and add it to their copy of the ledger.</p><p>The puzzle an accountant has to solve is based on <strong><strong><em><em>the last transaction</em></em></strong></strong> in the ledger and <strong><strong><em><em>the new transaction</em></em></strong></strong> the accountant intends to add. Since the last transaction now changed, they all have to solve a new puzzle, and it takes them 10 minutes again to solve it, as the process repeats.</p><blockquote><em><em>The purpose of the puzzle is to <strong><strong>randomly</strong></strong> <strong><strong>pick one accountant as the one who writes the next transaction into the ledger</strong></strong>. This prevents creating different versions of the ledger, <strong><strong>without giving anyone full control</strong></strong> over the entire ledger.</em></em></blockquote><h2 id="bugs-bunny-the-wise-guy-part-2">Bugs Bunny the Wise Guy, Part 2</h2><p>Wile E. Coyote explains his new rules to Sylvester and Daffy, but they don&#x2019;t really quite get them, so they figure they&#x2019;ll probably understand them better if they just try them. As a first step though, they decide to remove Bugs Bunny&#x2019;s phony double-spend transactions. Now their ledgers are identical, and they look like this:</p><!--kg-card-begin: markdown--><h3 id="sylvestersledger">Sylvester&apos;s Ledger</h3>
<p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code><br>
<code>5. Yosemite Sam gives Bugs Bunny 1 Bitcoin</code></p>
<h3 id="daffyducksledger">Daffy Duck&apos;s Ledger</h3>
<p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code><br>
<code>5. Yosemite Sam gives Bugs Bunny 1 Bitcoin</code></p>
<!--kg-card-end: markdown--><p>Meanwhile, Bugs Bunny is feeling cheeky, so he decides to just pull the same stunt again: he tells Sylvester he&#x2019;s giving <strong><strong>Marvin the Martian</strong></strong> 1 Bitcoin, and he tells Daffy Duck he&#x2019;s giving <strong><strong>Elmer Fudd </strong></strong>1 Bitcoin.</p><p>This time though, Daffy and Sylvester don&#x2019;t add the transactions into their ledgers immediately, because they have to solve the puzzle first. So they go about doing that.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Daffy-and-Sylvester-Pondering.gif" class="kg-image" alt="The Building Blocks of Blockchain: Distributed Ledgers &amp; Mining" loading="lazy" width="700" height="256"></figure><p>As it happens, Daffy is the one who solves the puzzle first, so he adds the transaction he has to his ledger:</p><!--kg-card-begin: markdown--><h3 id="daffysledger">Daffy&apos;s Ledger</h3>
<p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code><br>
<code>5. Yosemite Sam gives Bugs Bunny 1 Bitcoin</code><br>
<strong><code>6. Bugs Bunny gives Elmer Fudd 1 Bitcoin</code></strong></p>
<!--kg-card-end: markdown--><p>He then shares this new transaction with Sylvester, also telling him the solution to his puzzle. Sylvester verifies the solution to Daffy&#x2019;s puzzle and thus accepts the new transaction and adds it to his own ledger. Now Sylvester&#x2019;s ledger looks like this:</p><!--kg-card-begin: markdown--><h3 id="sylvestersledger">Sylvester&apos;s Ledger</h3>
<p><code>1. Sylvester creates 25 Bitcoins</code><br>
<code>2. Sylvester gives Yosemite Sam 10 Bitcoins</code><br>
<code>3. Yosemite Sam gives Porky Pig 4 Bitcoins</code><br>
<code>4. Porky Pig gives Wile E. Coyote 1 Bitcoin</code><br>
<code>5. Yosemite Sam gives Bugs Bunny 1 Bitcoin</code><br>
<strong><code>6. Bugs Bunny gives Elmer Fudd 1 Bitcoin</code></strong></p>
<p><strong>Pending Transactions:</strong><br>
<strong><code>** Bugs Bunny gives Marvin the Martian 1 Bitcoin</code></strong></p>
<!--kg-card-end: markdown--><p>Sylvester now sees that, according to the new state of the ledger, Bugs Bunny doesn&#x2019;t have any Bitcoin left, so he just <strong><strong><em><em>rejects</em></em></strong></strong> the pending transaction that was supposed to give Bugs&#x2019; Bitcoin to Marvin the Martian.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Angry-Marvin-1.gif" class="kg-image" alt="The Building Blocks of Blockchain: Distributed Ledgers &amp; Mining" loading="lazy" width="480" height="360"></figure><p>But hey, at least Wile E. Coyote&#x2019;s rules now have a clear way of deciding <strong><strong><em><em>who gets to write into the ledger</em></em></strong></strong> <strong><strong><em><em>next</em></em></strong></strong>, and thus make the ledger <strong><strong><em><em>secure against double spending!</em></em></strong></strong></p><h2 id="what-s-all-this-about-again">What&#x2019;s All This About, Again?</h2><p>You may get the impression that this analogy has become a bit too looney, but in fact, all of what you&#x2019;ve just read is very <em><em>very</em></em> close to how Bitcoin actually works! The process of solving puzzles that I&#x2019;m describing is really the process of <a href="https://en.bitcoin.it/wiki/Mining" rel="noopener nofollow"><strong><strong><em><em>mining</em></em></strong></strong></a>, and the <strong><strong><em><em>accountants are</em></em> <em><em>miners</em></em></strong></strong>. Bitcoin miners really are competing with each other to solve <a href="https://www.vpnmentor.com/blog/hash-puzzle-bitcoin/" rel="noopener nofollow">hash puzzles</a>.</p><p>What I hoped to get across from this story, is an intuitive understanding of the problem Bitcoin is trying to solve, and how it tries to solve it:</p><ul><li>Bitcoin intends to implement a ledger that cannot be controlled by a single party, but is controlled by many, in a fair way.</li><li><strong><strong><em><em>Control</em></em></strong></strong> <strong><strong><em><em>by many</em></em></strong></strong> is achieved by always giving control to a <strong><strong><em><em>single participant</em></em></strong></strong> for a <strong><strong><em><em>limited time</em></em></strong></strong>.</li><li><strong><strong><em><em>Fairness</em></em></strong></strong> is achieved by each participant gaining control for a limited time based on <strong><strong><em><em>chance </em></em></strong></strong>(being lucky enough to be the one who solves the next puzzle).</li></ul><p>In the <a href="https://medium.com/@backoftheenvelope/the-building-blocks-of-blockchain-putting-it-all-together-940601c509e9?source=friends_link&amp;sk=c2b1a09a376472777db5785058045381" rel="noopener">next post</a>, we&#x2019;ll cover in detail how all of this actually looks in Bitcoin &#x2014; including how these hash puzzles work, how transactions are organised into blocks, how blocks are chained together, and how Bitcoins are created. We can finally put all the building blocks together and build the big picture to have our well-deserved &#x201C;Aha!&#x201D; moment. What a time to be alive!</p><blockquote><em><em><strong><strong>Next building block: <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-putting-it-all-together/">Putting It All Together</a></strong></strong></em></em></blockquote><hr><p>Was that interesting and understandable? Did I share some horrible misinformation? Do you disagree with me? Do you have any questions? <strong><strong>Please let me know</strong></strong> in the comments or on <a href="https://www.linkedin.com/posts/zoltanmaric_the-building-blocks-of-blockchain-distributed-activity-6632659779988803584-CBqL" rel="noopener nofollow">LinkedIn</a>, or on <a href="https://twitter.com/zoltanmaric/status/1226895106353123333?s=20" rel="noopener nofollow">Twitter</a> :)</p><p>If you haven&#x2019;t yet, you can read the introductory post on what it is I even do <a href="https://121gigawatts.org/what-is-a-virtual-power-plant-anyway">here</a>.</p><hr><h2 id="image-credits">Image Credits</h2><p><a href="https://giphy.com/gifs/looneytunes-cat-looney-tunes-sylvester-603cLZVdYomSgIBhB0" rel="noopener nofollow">Sylvester writing</a>, <a href="https://giphy.com/gifs/looneytunes-cartoon-looney-tunes-7TnyEw1YpXaxBtVLBe" rel="noopener nofollow">Daffy surprised</a>, <a href="https://tenor.com/view/bugs-bunny-wile-ecoyote-coyote-genius-introduction-gif-4912179" rel="noopener nofollow">Wile E. business card</a>, <a href="https://giphy.com/gifs/looneytunes-oyPTTOQMtuzthM5xKX" rel="noopener nofollow">Wile E. pondering</a>, <a href="https://giphy.com/gifs/nervous-looney-tunes-worried-rHzSn4U4BPemY" rel="noopener nofollow">Daffy pondering</a>, <a href="https://giphy.com/gifs/looneytunes-scared-bored-2uwZ4xi75JhxZYeyQB" rel="noopener nofollow">Sylvester pondering</a>, <a href="https://giphy.com/gifs/looneytunes-cartoon-looney-tunes-NTDh6ioJhvKlL2qBGW" rel="noopener nofollow">Marvin angry</a>. All copyrighted material used under Fair Use for educational purposes.</p>]]></content:encoded></item><item><title><![CDATA[The Building Blocks of Blockchain: Digital Signatures]]></title><description><![CDATA[In this episode, a Meerkat puts the integrity of digital signatures to the test.]]></description><link>https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b76</guid><category><![CDATA[Blockchain]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Fri, 15 Nov 2019 15:00:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/Timberdoodle.jpg" medium="image"/><content:encoded><![CDATA[<blockquote><em><em><em>This is the 3rd post in the series &#x201C;The Building Blocks of Blockchain&#x201D;. You can find the introductory post of the series <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-introduction">here</a>.</em></em></em></blockquote><hr><img src="https://121gigawatts.org/content/images/2022/03/Timberdoodle.jpg" alt="The Building Blocks of Blockchain: Digital Signatures"><p>On a heavy oak stool, there lay a small scroll. She carefully unrolled the scroll, as two keys slipped out from inside it. One of them was copper, the other one golden. She noticed a strange scripture on the scroll:</p><blockquote>That which gold petrifies, none but copper shall undo.</blockquote><p>&#x201C;What&#x2019;s this?&#x201D; she asked. &#x201C;It&#x2019;s an <em><em>enchanted key pair</em></em>.&#x201D;, he replied. &#x201C;<em><em>Enchanted?</em></em>&#x201D; she asked, as her eyes lit up with thrill. &#x201C;Try it! Take the golden key and lock that chest over there.&#x201D; Timberdoodle turned around and saw a small wooden chest, full of brass gears, nuts, and bolts. There was a rusty padlock hanging on its staple. She shut the chest and locked the padlock on it with the golden key.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://121gigawatts.org/content/images/2022/03/Timberdoodle-1.jpg" class="kg-image" alt="The Building Blocks of Blockchain: Digital Signatures" loading="lazy" width="1920" height="1115" srcset="https://121gigawatts.org/content/images/size/w600/2022/03/Timberdoodle-1.jpg 600w, https://121gigawatts.org/content/images/size/w1000/2022/03/Timberdoodle-1.jpg 1000w, https://121gigawatts.org/content/images/size/w1600/2022/03/Timberdoodle-1.jpg 1600w, https://121gigawatts.org/content/images/2022/03/Timberdoodle-1.jpg 1920w"></figure><p>A piercing cracking sound enveloped them, as the chest suddenly turned into stone. She quickly tried to unlock the padlock in panic, but the golden key wouldn&#x2019;t turn. &#x201C;I can&#x2019;t open it!&#x201D; she panicked. &#x201C;Relax.&#x201D; Hokumpoke comforted her &#x2014; &#x201C;Remember what the scroll said.&#x201D;</p><p>Timberdoodle pondered for a second, and then picked up the copper key. She put it in the padlock and turned it to the left. The padlock clicked open, and the chest stood agape in a flash, just as wooden as before.</p><hr><p>I&#x2019;d like you to give yourself a moment to really <strong><strong>visualise</strong></strong> this little scene of Timberdoodle and her two keys.</p><p>Good!</p><p>Timberdoodle herself was rather confused by the event, and she didn&#x2019;t quite get why anyone would want to make such a silly pair of keys. She decided to go home and sleep on it.</p><p>While she&#x2019;s asleep, I&#x2019;d like to tell you a story from the other end of the forest.</p><h2 id="contracts-are-weird">Contracts Are Weird</h2><p>At least I always thought so. You have a big pile of papers saying all kinds of things you&#x2019;re supposed to agree to. If you scribble your name on the <strong><strong><em><em>last page</em></em></strong></strong> of the pile, you&#x2019;ve <strong><strong><em><em>signed</em></em></strong></strong> the contract. Anyone who holds this pile of papers now has <strong><strong><em><em>proof </em></em></strong></strong>that you have agreed to <strong><strong><em><em>everything</em></em></strong></strong> that&#x2019;s written on it.</p><p>What I always found weird about them, was that it seemed so easy to <em><em>game</em></em> the system. I could easily swap out one of the pages in the contract to add a clause saying that you owe me a lifelong supply of peanuts. I wouldn&#x2019;t even have to touch your signature. But it wouldn&#x2019;t be <em><em>that </em></em>hard to fake your signature either. It&#x2019;s <strong><strong><em><em>illegal</em></em></strong></strong><em><em> </em></em>to do either of those things, but it&#x2019;s <strong><strong><em><em>not impossible</em></em></strong></strong>. If someone did do that to you, you would have to pursue legal action, which is such a drag, and the process takes ages.</p><p>Now, when it comes to cryptocurrencies, their purpose is to carry out transactions. But what&#x2019;s in a transaction? Not much more than this:</p><ul><li>Amount</li><li>Recipient</li><li>Signature of the sender</li></ul><p>It&#x2019;s basically a contract saying that the <strong><strong>sender</strong></strong> is giving the <strong><strong>recipient</strong></strong> a certain <strong><strong>amount</strong></strong> of money. Since thousands of these transactions have to be carried out every second, it should be quite obvious that making it <strong><strong><em><em>possible but illegal</em></em></strong></strong> to change the transaction data or to fake the signature <strong><strong>just won&#x2019;t cut it</strong></strong>. It has to be <strong><strong>impossible</strong></strong>.</p><p>Fortunately for us, <strong><strong><em><em>digital</em></em></strong></strong> signatures don&#x2019;t quite work like paper signatures. <em><em>Like</em></em> paper signatures, they <strong><strong>guarantee the contents</strong></strong> of what is signed and they <strong><strong>guarantee the identity</strong></strong> of the party signing it. <em><em>Unlike</em></em> paper signatures, they make it <strong><strong>impossible to change contents</strong></strong>, and <strong><strong>impossible to falsify identity</strong></strong>.</p><h2 id="timberdoodle-s-enchanted-key-pair">Timberdoodle&#x2019;s Enchanted Key Pair</h2><p>The magical ingredient that makes digital signatures possible are so-called <strong><strong><em><em>asymmetric key pairs</em></em></strong></strong>. They work just like Timberdoodle&#x2019;s enchanted key pair. They&#x2019;re called <strong><strong><em><em>asymmetric</em></em></strong></strong> because each of them only works <strong><strong>one way</strong></strong>. The <strong><strong>golden</strong></strong> key can <strong><strong><em><em>only lock</em></em></strong></strong> the chest, and the <strong><strong>copper</strong></strong> key can <strong><strong><em><em>only unlock</em></em></strong></strong> the chest.</p><p>In reality, these keys are just very very large numbers. The <strong><strong>golden</strong></strong> key, i.e. the one that&#x2019;s used for <strong><strong>locking</strong></strong>, is called the <strong><strong>private key</strong></strong>; and the <strong><strong>copper</strong></strong> key, i.e. the one that&#x2019;s used for <strong><strong>unlocking</strong></strong>, is called the <strong><strong>public key</strong></strong>. <strong><strong>Locking</strong></strong> in this sense means <strong><strong>encrypting</strong></strong> a message, and <strong><strong>unlocking</strong></strong> means <strong><strong>decrypting</strong></strong> it.</p><ul><li>Golden key = <strong><strong>private key</strong></strong>, a large number used for <strong><strong>encrypting</strong></strong> messages</li><li>Copper key = <strong><strong>public key</strong></strong>, a large number used for <strong><strong>decrypting</strong></strong> messages</li><li>Locking/unlocking = encrypting/decrypting a message</li></ul><p>Here&#x2019;s an example of such a key pair, to give you an idea about what &#x201C;very very large number&#x201D; means:</p><!--kg-card-begin: markdown--><pre><code>Private key:
93155050515612370983163764633558747339007116928401713662183993588125059212302
Public key:
65044426400941893018565888471404011024052903416091989803275131610548528439975929483145666179707753254797354298707623581314170512855135822986652814617423560
</code></pre>
<!--kg-card-end: markdown--><p><em><em>Yes</em></em>, each of those two is just one large number, and <em><em>yes</em></em>, they&#x2019;re so big they don&#x2019;t fit in one row. It&#x2019;s very easy for a computer to generate such a pair of keys, but once they&#x2019;re generated, it&#x2019;s practically<strong><strong> impossible to figure out the private key based on the public key</strong></strong>.</p><p>A message encrypted with a private key can only be decrypted with <strong><strong>its corresponding </strong></strong>public key <strong><strong>that was generated with it</strong></strong>, and no other. The reverse is also true &#x2014; if you can decrypt a message with a public key, you are certain that it was encrypted with <strong><strong>its corresponding</strong></strong> private key. <strong><strong>This is the secret sauce of digital signatures</strong></strong>, so I&#x2019;ll repeat it.</p><blockquote><em><em>If you can decrypt a message with a public key, you are certain that the message came from the person who has the corresponding private key.</em></em></blockquote><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Will-Ferrel-Thinking.gif" class="kg-image" alt="The Building Blocks of Blockchain: Digital Signatures" loading="lazy" width="600" height="338"></figure><p>Let me help you visualise that for a second. Let&#x2019;s say Hokumpoke decides to keep the golden key, and Timberdoodle takes the copper key home with her. A couple of days later, Meerkat the mail man delivers a locked chest to Timberdoodle. She unlocks the chest with the copper key and finds a message inside. Because she was <strong><strong>able to open the chest with the copper key</strong></strong>, Timberdoodle is now <strong><strong>sure that the message came from Hokumpoke</strong></strong>, since only he has the golden key.</p><p>The message reads:</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Greedy-Meerkat.gif" class="kg-image" alt="The Building Blocks of Blockchain: Digital Signatures" loading="lazy" width="568" height="318"></figure><p>So Timberdoodle decides to hide her grapes.</p><h2 id="how-does-this-work-in-a-blockchain">How Does This Work in a Blockchain?</h2><p>If you&#x2019;ve ever traded cryptocurrency, it probably all started with you having to create an account using a <a href="https://blockgeeks.com/guides/cryptocurrency-wallet-guide/" rel="noopener nofollow">wallet app</a>. What the wallet app actually does when creating an account, is &#x2014; you guessed it &#x2014;it generates a new private and public key. <strong><strong><em><em>The</em></em></strong></strong> <strong><strong><em><em>private key is never shown, and never sent.</em></em></strong></strong> Using the wallet app usually requires a password. This password is used to encrypt your private key before it&#x2019;s stored on your hard drive, to prevent others from getting your private key if they steal your laptop. The wallet then shows you your new address. An address is like a bank account number in cryptocurrencies. In effect, it&#x2019;s just a truncated variation of your public key. You then possibly shared this address with a friend of yours to send you some of that cryptocurrency.</p><p>To <strong><strong><em><em>send </em></em></strong></strong>you some cryptocurrency really just means that they submitted a <strong><strong><em><em>signed </em></em></strong></strong>transaction to be added to the blockchain. Remember what a transaction looked like:</p><ul><li>Amount</li><li>Address of the recipient</li><li>Signature info of the sender</li></ul><p>The signature information of the sender consists of the signature and the sender&#x2019;s public key. And now for the million dollar question.</p><h2 id="what-is-the-signature-of-the-sender">What is the Signature of the Sender?</h2><p>To create the signature, the wallet app performs the following 2 steps:</p><h2 id="generating-a-signature">Generating a Signature</h2><ol><li>Compute the <strong><strong><em><em><a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes/">hash</a> </em></em></strong></strong>of the transaction data (amount and recipient address)</li><li><strong><strong><em><em>Encrypt that hash</em></em></strong></strong> using the <strong><strong><em><em>private key</em></em></strong></strong> of the sender</li></ol><p>This <strong><strong><em><em>encrypted hash</em></em></strong></strong> of the transaction is in effect <strong><strong><em><em>the digital signature</em></em></strong></strong> of the transaction. For a quick refresher on how hashes work, I recommend reading my <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes">previous post</a>. The following is an actual example on some sample data. It&#x2019;s just there to help you visualise the steps, there&#x2019;s no need to understand any of the values themselves.</p><!--kg-card-begin: markdown--><pre><code>Amount: 0.001 ETH
Address: 0x48e233335976fb09c99c04b6232b3e5619deeefd
---
Hash of transaction data above: 0xe1b01aa0e707e0a7dfcf1122dee01ce02a8dc581ad4f5320711a177f76830207

Signature (above hash encrypted using the sender&apos;s private key):
MEUCIQDnFAMFHCJjkxGu+dvFZqxzmvN7uMVf5Y1wSinebiTJ6wIgCFoN2Ak04YgGnRVM12uy7wXsoo45xM8MChNwAov46TY=

Sender&apos;s public key:
0x0454f9a87062a097d7d171032d394ef1ef1d05232bd31226bc4abda15bfd18427613b20b9038b02994b7c851b4433703ec0e7046ee201f1c2b740af20f28cb1410
</code></pre>
<!--kg-card-end: markdown--><p>So how can someone check if this signature is <strong><strong><em><em>legit</em></em></strong></strong>?</p><h2 id="validating-a-signature">Validating a Signature</h2><ol><li>Compute the <strong><strong><em><em>hash</em></em></strong></strong> of the transaction data (amount and recipient)</li><li><strong><strong><em><em>Decrypt the signature</em></em></strong></strong> using the <strong><strong><em><em>public key</em></em></strong></strong> of the sender</li><li>Check if the <strong><strong><em><em>decrypted signature </em></em></strong></strong>from step 2 <strong><strong><em><em>is equal to the computed <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes/">hash</a></em></em></strong></strong> of the transaction from step 1</li></ol><p>If the comparison in step 3 checks out, the signature is valid.</p><!--kg-card-begin: markdown--><pre><code>Amount: 0.001 ETH
Address: 0x48e233335976fb09c99c04b6232b3e5619deeefd
---
Computed Hash of transaction data above:
0xe1b01aa0e707e0a7dfcf1122dee01ce02a8dc581ad4f5320711a177f76830207

Signature:
MEUCIQDnFAMFHCJjkxGu+dvFZqxzmvN7uMVf5Y1wSinebiTJ6wIgCFoN2Ak04YgGnRVM12uy7wXsoo45xM8MChNwAov46TY=

Decrypted signature (using the sender&apos;s public key):
0xe1b01aa0e707e0a7dfcf1122dee01ce02a8dc581ad4f5320711a177f76830207
</code></pre>
<!--kg-card-end: markdown--><p>The decrypted signature above is equal to the computed hash, so this signature is valid.</p><h2 id="meerkat-the-mail-man-meddles">Meerkat the Mail Man Meddles</h2><p>This probably doesn&#x2019;t look like much of a signature to you yet. To understand why it really <em><em>is</em></em> a signature, let&#x2019;s see if it makes it <strong><strong><em><em>impossible to change the contents</em></em></strong></strong>, and<strong><strong><em><em> impossible to falsify identity</em></em></strong></strong>. Let&#x2019;s ask Meerkat the mail man to help us with that by trying to meddle with our transactions.</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Curious-Meerkat.gif" class="kg-image" alt="The Building Blocks of Blockchain: Digital Signatures" loading="lazy" width="500" height="269"></figure><h3 id="what-if-meerkat-changes-the-transaction-data">What if Meerkat changes the transaction data?</h3><p>If Meerkat changes e.g. the address of the recipient in the transaction, the hash computed in step 1 of the validation will be different from what we get in step 2, so the validation will fail. <strong><strong><em><em>Meerkat is busted.</em></em></strong></strong></p><h3 id="what-if-meerkat-changes-the-signature-data">What if Meerkat changes the signature data?</h3><p>If Meerkat just randomly messes with the signature data, step 2 of validation will just fail, because it will not be possible to decrypt the signature at all. <strong><strong><em><em>Meerkat is busted.</em></em></strong></strong></p><h3 id="what-if-meerkat-changes-the-data-and-generates-a-new-signature">What if Meerkat changes the data AND generates a new signature?</h3><p>Meerkat will only be able to generate a new signature using a private key. He doesn&#x2019;t have the original sender&#x2019;s private key. The only private key he may have is his own private key. If he generates a new signature with his own private key, Meerkat is practically making himself the sender of the transaction. This means it would be <strong><strong><em><em>Meerkat&#x2019;s</em></em></strong></strong> money that would get transferred. Meerkat just &#x201C;falsified&#x201D; a transaction by sending us his own money. <strong><strong><em><em>Nice going, Meerkat.</em></em></strong></strong></p><h3 id="what-if-meerkat-forges-the-sender-s-signature">What if Meerkat forges the sender&#x2019;s signature?</h3><p>It is impossible to generate a valid signature without knowing the original sender&#x2019;s private key. <strong><strong><em><em>Meerkat gives up on this idea.</em></em></strong></strong></p><h3 id="what-if-meerkat-steals-the-sender-s-private-key">What if Meerkat steals the sender&#x2019;s private key?</h3><p>That&#x2019;s a pickle. The sender&#x2019;s funds are as good as gone. Meerkat now has access to all of the sender&#x2019;s money. This is why people <a href="https://www.wired.com/story/how-to-keep-bitcoin-safe-and-secure/" rel="noopener nofollow">go to great lengths to keep their private key safe</a>.</p><hr><p>There we have it. A fundamental building block for <strong><strong><em><em>security</em></em></strong></strong> in blockchain. It boils down to the following 3 points:</p><ul><li>A sender proves a message came from them by signing the message using the private key</li><li>The proof lies in the fact that only the sender can possibly know the private key</li><li>Anyone who knows the public key of the sender can validate the sender&#x2019;s digital signature</li></ul><p>I should note 2 more important points regarding digital signatures.</p><ol><li>Just like hashes, <strong><strong><em><em>digital signatures are not a mechanism of encryption</em></em></strong></strong>. A digital signature is sent <strong><strong><em><em>alongside</em></em></strong></strong><em><em> </em></em>the data that is signed, but that data is <strong><strong><em><em>not encrypted</em></em></strong></strong>. You can choose to encrypt the data, but that&#x2019;s done separately. In Bitcoin and Ethereum, none of the transaction data is encrypted.</li><li>Digital signatures are absolutely <strong><strong><em><em>ubiquitous</em></em></strong></strong>, even outside of blockchain. See that padlock in the address bar of your browser as you&#x2019;re reading this? That says that your computer received digitally signed information that the page you&#x2019;re reading really came from Medium.<br>You know when you touch your credit card on one of those payment devices in a store? There&#x2019;s actually a tiny computer on your card that uses the private key stored in the card to digitally sign the transaction.</li></ol><h2 id="is-this-relevant-for-the-energy-industry">Is This Relevant for the Energy Industry?</h2><p>Digital signatures are <strong><strong><em><em>absolutely groundbreaking</em></em></strong></strong> for the future of the energy industry. One big use case that I&#x2019;m personally particularly thrilled about is <strong><strong><em><em>making</em></em></strong></strong> <strong><strong><em><em>the origin of renewable energy traceable</em></em></strong></strong>.T he big enabler for this will be<strong><strong><em><em> smart meters which are able to digitally sign their measurements</em></em></strong></strong>. The idea is that these smart meters would be connected to sources of renewable energy like e.g. solar panels on a rooftop. <strong><strong><em><em>By knowing which public keys belong to smart meters connected to renewable sources, we can prove that a piece of energy came from a renewable source</em></em></strong></strong>.</p><p>This is a big topic which deserves a post of its own, and I&#x2019;ll make sure to write one once I&#x2019;m done with the building blocks series. The good news though, is that <a href="https://www.bsi.bund.de/EN/Topics/Certification/certified_products/SmartMetering_Systems/Smart_Metering_Systems_node.html" rel="noopener nofollow">Germany is already in the process</a> of rolling out smart meters <strong><strong><em><em>which can produce digital signatures</em></em></strong></strong>. What a time to be alive! &#x1F64C;</p><blockquote><em><em><strong><strong>Next building block: <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-distributed-ledgers-mining/">Distributed Ledgers &amp; Mining</a></strong></strong></em></em></blockquote><hr><p>Was that interesting and understandable? Did I share some horrible misinformation? Do you disagree with me? Do you have any questions? <strong><strong>Please let me know</strong></strong> in the comments or on <a href="https://www.linkedin.com/posts/zoltanmaric_the-building-blocks-of-blockchain-digital-activity-6601015227871961088-UsfB" rel="noopener nofollow">LinkedIn</a>, or on <a href="https://twitter.com/zoltanmaric/status/1195281519591526400?s=20" rel="noopener nofollow">Twitter</a> :)</p><h2 id="image-credits">Image Credits</h2><p><a href="https://dribbble.com/shots/8209544-fairy-tale" rel="noopener nofollow">The illustration for the Tale of the Enchanted Key Pair</a> was made by <a href="https://dribbble.com/Tarzyan" rel="noopener nofollow">Roza</a> for this post. You may reuse it under a <a href="https://en.wikipedia.org/wiki/Creative_Commons" rel="noopener nofollow">Creative Commons (CC) license</a>, so please link to this post if you do.</p><p><a href="https://giphy.com/gifs/nba-celebrity-kPtv3UIPrv36cjxqLs" rel="noopener nofollow">Will Ferrel thinking</a>, <a href="https://giphy.com/gifs/meerkat-greedy-iH15XZeqSADCM" rel="noopener nofollow">Greedy meerkat</a>, <a href="https://giphy.com/gifs/headlikeanorange-meerkat-bbc-the-meerkats-6pUBXVTai18Iw" rel="noopener nofollow">Pop-up meerkat</a></p>]]></content:encoded></item><item><title><![CDATA[The Building Blocks of Blockchain: Cryptographic Hashes]]></title><description><![CDATA[Hashes are what makes a blockchain a block-chain, and not a block-list, and they’re fundamental to all of the other building blocks of blockchain.]]></description><link>https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b75</guid><category><![CDATA[Blockchain]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Fri, 04 Oct 2019 00:00:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/Hex-witch.gif" medium="image"/><content:encoded><![CDATA[<blockquote><em><em>This is the 2nd post in the series &#x201C;The Building Blocks of Blockchain&#x201D;. If you haven&#x2019;t yet, I encourage you to read the <strong><strong><a href="https://121gigawatts.org/the-building-blocks-of-blockchain-introduction">introductory post</a></strong></strong> of the series first.</em></em></blockquote><img src="https://121gigawatts.org/content/images/2022/03/Hex-witch.gif" alt="The Building Blocks of Blockchain: Cryptographic Hashes"><p>Hashes are certainly a core part of blockchain jargon. People talk about transaction hashes, block hashes, hash rate, hash power, even <a href="https://translate.google.com/#view=home&amp;op=translate&amp;sl=auto&amp;tl=hr&amp;text=hash" rel="noopener nofollow">hash paprika&#x161;</a>! And even though the name &#x2014; <em><em>hash</em></em> &#x2014; describes pretty accurately how they&#x2019;re made, it may not be that clear what their purpose is, or how they fulfil that purpose. I&#x2019;ve decided to cover hashes as the first building block of blockchain because <strong><strong><em><em>a)</em></em></strong></strong> they&#x2019;re what makes a blockchain a block-<strong><strong>chain</strong></strong>, and not a block-<strong><strong>list</strong></strong>; <strong><strong><em><em>b)</em></em></strong></strong> because they&#x2019;re fundamental to all of the other building blocks I will cover.</p><h2 id="what-do-i-need-hashes-for">What Do I Need Hashes For?</h2><p>The simplest use of hashes is being able to check whether somebody changed some piece of data that you didn&#x2019;t want to be changed.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Goldilocks-Porridge.gif" class="kg-image" alt="The Building Blocks of Blockchain: Cryptographic Hashes" loading="lazy" width="480" height="270"><figcaption>Source: <a href="https://www.youtube.com/watch?v=qOJ_A5tgBKM" rel="noopener nofollow">Gigglebox</a></figcaption></figure><p>You probably heard people saying that blockchains are <em><em>immutable</em></em>. This is just a fancy way of saying they can&#x2019;t be changed. <strong><strong><em><em>Hashes </em></em>are what blockchains use to ensure their data can&#x2019;t be changed.</strong></strong> I will explain how exactly that works in this post.</p><p>On top of that, hashes are also the basis of <strong><strong>blockchain mining</strong></strong>. Mining is a pretty huge topic, which is why it will get its very own post in this series. I just wanted to mention it though, to get you amped-up for understanding hashes &#x1F62C;. For now, though, let&#x2019;s focus on getting a comfortable understanding of <strong><strong>what hashes are and how they work</strong></strong>.</p><h2 id="hashing-potatoes">Hashing Potatoes</h2><p>The verb <strong><strong><em><em>&#x201C;to hash&#x201D; </em></em></strong></strong>in itself is not a computer science term at all. It actually means &#x201C;to chop up&#x201D; in plain English. That&#x2019;s also where <a href="https://en.wikipedia.org/wiki/Hash_browns" rel="noopener nofollow">hash-browns</a> got their name from &#x2014; they&#x2019;re made of chopped-up potatoes, pressed back together into a patty!</p><p>In much the same way &#x2014; what we call <strong><strong><em><em>a hash </em></em></strong></strong>in the context of blockchain, is simply <strong><strong>chopped up data</strong></strong>!</p><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Toothy-confused-girl.gif" class="kg-image" alt="The Building Blocks of Blockchain: Cryptographic Hashes" loading="lazy" width="630" height="354"></figure><p>I knew you would be looking at me like that. Anyway, I just wanted to tell you what the word <em><em>means</em></em>, and why that&#x2019;s relevant. Now we can break it down step by step, and figure out what the heck I just said up there.</p><h2 id="what-is-data">What <em>Is</em> Data?</h2><p>I mentioned &#x201C;some input data&#x201D; a few times now, but it may not be clear what that means. It is really any piece of information. It may be some text, it may be an image, or it may be transaction information. When it comes to computers, they really don&#x2019;t care. Whatever the data you want to work with, under the hood, it&#x2019;s always stored as a <strong><strong>sequence of numbers</strong></strong>.</p><p>A simple example of this is text. For text, your computer can represent each character as a single number. E.g. the text &#x201C;<em><em>The Frog Prince</em></em>&#x201D; <a href="https://www.braingle.com/brainteasers/codes/ascii.php#form" rel="noopener nofollow">can be represented</a> as the following sequence of numbers:</p><!--kg-card-begin: markdown--><pre><code>84 104 101 32 70 114 111 103 32 80 114 105 110 99 101
T   h   e     F   r   o   g     P   r   i   n  c   e
</code></pre>
<!--kg-card-end: markdown--><p>Similarly, a picture can be represented with a number for each of its pixels, and a transaction with 2 account numbers and an amount. In the end, it always boils down to a sequence of numbers like the one above.</p><h2 id="how-do-you-chop-up-data">How Do You &#x201C;Chop Up&#x201D; Data?</h2><p>Now that we know that &#x2014; in a computer &#x2014; data is just a sequence of numbers, it will be easier to understand what we mean by chopping it up. The process of chopping up data, i.e. hashing, is done by a hash function. But <strong><strong>what <em><em>is </em></em>a hash function?</strong></strong></p><p>Think of it as a <strong><strong>cooking recipe</strong></strong> for making hash-browns. The ingredients are the input data, <strong><strong>the dish you&#x2019;re making is the hash</strong></strong>, and <strong><strong>the recipe is the way how you chop up</strong></strong> and stick together the ingredients to make that hash.</p><p>In addition, this recipe has to fulfil the following properties:</p><ul><li>It can <strong><strong>take data of any length as input</strong></strong></li><li>Its <strong><strong>output </strong></strong>(the hash)<strong><strong> is always the same length</strong></strong>, regardless of the length of input</li><li><strong><strong>The same input always produces the same output</strong></strong></li><li>It&#x2019;s one-way, i.e. <strong><strong>you can&#x2019;t recreate the input from the hash by reversing the recipe</strong></strong></li></ul><p>Alright, let&#x2019;s see an example of such a hash recipe right now:</p><ol><li>Divide the input data into groups of 4 numbers</li><li>Add the numbers together group-wise</li><li>If any of the resulting numbers is 256 or larger, subtract 256 from it until it&#x2019;s less than 256</li></ol><p>We&#x2019;ll call this <strong><strong><em><em>the</em></em></strong></strong> <strong><strong><em><em>Goldilocks</em></em></strong></strong> <strong><strong><em><em>hash recipe</em></em></strong></strong>. Let&#x2019;s see how it works on our example text&#x2014; &#x201C;<em><em>The Frog Prince</em></em>&#x201D; &#x2014; from the previous section.</p><p>Steps 1 &amp; 2 &#x2014;divide the data into groups of 4 numbers and add them together group-wise:</p><!--kg-card-begin: markdown--><pre><code>   84 104 101  32
+  70 114 111 103
+  32  80 114 105
+ 110  99 101
-----------------
= 296 397 427 240
</code></pre>
<!--kg-card-end: markdown--><p>Step 3 &#x2014; if any of the resulting numbers is 256 or larger, subtract 256 from it until it&#x2019;s less than 256:</p><!--kg-card-begin: markdown--><pre><code>  296 397 427 240
- 256 256 256
-----------------
=  40 141 171 240
</code></pre>
<!--kg-card-end: markdown--><p>Bam! There we have it &#x2014; our first hash &#x1F389;: <code>40 141 171 240</code>. This really is the basic principle of how hash functions commonly used today work. They may get a bit weirder on the operations they perform on the numbers, but in essence, they divide the data into groups, they do arithmetic, shuffle their order, shuffle their digits, and out comes a new sequence of numbers.</p><h2 id="has-someone-been-eating-your-porridge">Has Someone Been Eating Your Porridge?</h2><p>Alright, we now know how to compute the hash of some data, but we haven&#x2019;t yet shown <strong><strong>how hashes tell us whether some data changed</strong></strong>. This is best shown on an example.</p><p>Imagine someone sends you a message, and in addition, they tell you that the <em><em>Goldilocks</em></em> hash of the message is <code>40 141 171 240</code>(the same hash we computed above). When you receive the message, it reads &#x201C;<em><em>The Frog </em></em><strong><strong><em><em>Quince</em></em></strong></strong>&#x201D;:</p><!--kg-card-begin: markdown--><pre><code>84 104 101 32 70 114 111 103 32 81 117 105 110 99 101
T   h   e     F   r   o   g     Q   u   i   n  c   e
</code></pre>
<!--kg-card-end: markdown--><p>That message sounds suspicious to you. In order to figure out whether this was really the message that was sent to you, you decide to compute its <em><em>Goldilocks</em></em> hash and compare the <strong><strong>computed hash</strong></strong> to the <strong><strong>hash you received</strong></strong>.</p><!--kg-card-begin: markdown--><pre><code>   84 104 101  32
+  70 114 111 103
+  32  81 117 105
+ 110  99 101
-----------------
= 296 398 430 240
- 256 256 256
-----------------
=  40 142 174 240
</code></pre>
<!--kg-card-end: markdown--><p>The hash you <em><em>computed</em></em> is <code>40 <strong><strong>142 174</strong></strong> 240</code>, which does not match the received <code>40 <strong><strong>141 171</strong></strong> 240</code>, so you conclude that someone has fiddled around with your message!</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Kitty-caught-red-handed.gif" class="kg-image" alt="The Building Blocks of Blockchain: Cryptographic Hashes" loading="lazy" width="400" height="228"><figcaption>Source: <a href="https://giphy.com/gifs/caught-ZkLTrpbnN9GtG" rel="noopener nofollow">Giphy</a></figcaption></figure><h2 id="how-do-you-know-someone-didn-t-change-the-hash-too">How Do You Know Someone Didn&#x2019;t Change The Hash Too?</h2><p>Aha! Excellent question. What if somebody changes both the message <em><em>and</em></em> the hash you use for verifying the data? To prevent changing the hash, <strong><strong>the sender will usually <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures/">digitally sign</a> the hash</strong></strong>. If somebody changes the hash, the signature will not check out. There&#x2019;s no way of changing the signature because only the original sender can generate a valid signature.</p><p>We&#x2019;ll cover digital signatures in the <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures/">next post</a>. The only thing you need to know now is that they are a way of mathematically proving that a message came from a particular sender.</p><h2 id="why-do-goldilocks-hashes-look-different-than-the-hashes-i-ve-seen-before">Why Do Goldilocks Hashes Look Different Than The Hashes I&#x2019;ve Seen Before?</h2><p>That&#x2019;s a good point. If you&#x2019;ve seen <a href="https://etherscan.io/tx/0xef1dc3dff274350c76a724bcf4f98eddc60b41e3070c31e69dceeb6fa4e7e227" rel="noopener nofollow">actual hashes on blockchains</a> before, you may remember they always start with <code>0x</code> and look something like this:</p><!--kg-card-begin: markdown--><pre><code>0xec620a4b0422641eabc024686c608903aa43299f621619d94242f039a556b08f
</code></pre>
<!--kg-card-end: markdown--><p>So why does our <em><em>Goldilocks</em></em> hash look like <code>40 141 171 240</code>? Well, they&#x2019;re really not <em><em>that </em></em>different. It&#x2019;s just a convention for hashes to write each number in your sequence not as a &#x201C;normal&#x201D; <em><em>decimal</em></em> number, but as a <em><em>hexadecimal </em></em>number<em><em>. </em></em>This is really just another way of writing numbers. I won&#x2019;t get into how it works now &#x2014; instead, I&#x2019;ll resort to <a href="https://www.binaryhexconverter.com/decimal-to-hex-converter" rel="noopener nofollow">witchcraft</a> to convert the numbers in our example hash into hexadecimal notation:</p><!--kg-card-begin: markdown--><pre><code>40 141 171 240
</code></pre>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><img src="https://121gigawatts.org/content/images/2022/03/Hex-witch-1.gif" class="kg-image" alt="The Building Blocks of Blockchain: Cryptographic Hashes" loading="lazy" width="478" height="360"></figure><!--kg-card-begin: markdown--><pre><code>28 8d ab f0
</code></pre>
<!--kg-card-end: markdown--><p>This means <code>40</code> is <code>28</code> in hexadecimal notation, <code>141</code> is <code>8d</code> in hexadecimal notation, and so on. We can now just paste all the numbers together, add a <code>0x</code> at the beginning, and there you have it &#x2014; our <em><em>Goldilocks</em></em> hash <code>40 141 171 240</code> is really <code>0x288dabf0</code> in hexadecimal notation. By the way, the <code>0x</code> at the beginning is used as a sign to indicate that this is hexadecimal notation.</p><hr><p>Before I wrap up, I should note one more thing: our made-up <em><em>Goldilocks</em></em> hash recipe is a legit hash function, but <strong><strong>it is <em><em>not</em></em> a <em><em>cryptographic </em></em>hash function</strong></strong>. Cryptographic hash functions<strong><strong> </strong></strong>additionally have to meet the following conditions, which make them secure for usage in cryptography and blockchain:</p><ul><li><strong><strong>Irreversible</strong></strong>: Given a hash, it should be infeasible to make up a message that results in that hash</li><li><strong><strong>Unique</strong></strong>: It should be infeasible to find 2 different messages that result in the same hash</li><li><strong><strong>Avalanche Effect</strong></strong>: A small change in the input message should result in a completely different hash</li></ul><p>Cryptographic hash functions achieve all of this with a way of computing hashes that&#x2019;s a bit more involved than our <em><em>Goldilocks</em></em> recipe. Nevertheless, all the other principles of how hashes work that I&#x2019;ve described here also apply to cryptographic hash functions.</p><p>Note also that <strong><strong>hashes are not encrypted messages</strong></strong>. This is a common misconception. <strong><strong>An encrypted message can be decrypted</strong></strong> using a secret key, i.e. <strong><strong>encryption is two-way</strong></strong>. Cryptographic hashes, on the other hand, are <strong><strong>one-way</strong></strong>, i.e. <strong><strong>there&#x2019;s no way you can figure out the input if you only have a hash</strong></strong>.</p><h2 id="-thanks-for-reading-this-far-">&#x1F389; Thanks for Reading This Far &#x1F389;</h2><p>I hope this story gives you a good idea of <strong><strong>how hashes work</strong></strong>. In contrast, I expect that the bit about <strong><strong>what hashes are for</strong></strong> will fall into place better in the upcoming posts as we learn how they&#x2019;re <em><em>applied</em></em> in blockchain. In the meantime, give yourself time to let this settle in, and please let me know if I left something unclear.</p><blockquote><em><em><strong><strong>Next building block: <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures/">Digital Signatures</a></strong></strong></em></em></blockquote><hr><p>I find the challenges of modern energy generation and power grids fascinating, and I feel galvanized to help solve them as quickly as possible. This is why I will try to clarify these challenges in a series of blog posts, along with our ideas and attempts at tackling them.</p><p>Am I doing a good job? Was that interesting and understandable? Did I share some horrible misinformation? Do you disagree with me? Do you have any questions? <strong><strong>Please let me know</strong></strong> in the comments or on <a href="https://www.linkedin.com/posts/zoltanmaric_the-building-blocks-of-blockchain-cryptographic-activity-6585827543939588098-bCwq" rel="noopener nofollow">LinkedIn</a>, or on <a href="https://twitter.com/zoltanmaric/status/1180436089347215360?s=19" rel="noopener nofollow">Twitter</a> :)</p><p>If you haven&#x2019;t yet, you can read the introductory post on what it is I even do <a href="https://121gigawatts.org/whats-the-deal-with-grid-frequency/">here</a>.</p>]]></content:encoded></item><item><title><![CDATA[The Building Blocks of Blockchain: Introduction]]></title><description><![CDATA[“Can you explain how blockchain works?” Sure I can! In a series of posts with loads of GIFs!]]></description><link>https://121gigawatts.org/the-building-blocks-of-blockchain-introduction/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b74</guid><category><![CDATA[Blockchain]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Tue, 17 Sep 2019 00:00:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/Ron-Burgundy-Great-Story.gif" medium="image"/><content:encoded><![CDATA[<img src="https://121gigawatts.org/content/images/2022/03/Ron-Burgundy-Great-Story.gif" alt="The Building Blocks of Blockchain: Introduction"><p>Because of my job title, I often get asked &#x201C;Can you explain how blockchain works?&#x201D;, or &#x201C;What&#x2019;s the purpose of blockchain in the energy sector?&#x201D; When this happens, I feel overwhelmed with thoughts.</p><blockquote><em><em>&#x201C;Well, you see, the big thing about it is that it&#x2019;s a <strong><strong>distributed ledger</strong></strong>, and every change in the data is <strong><strong>cryptographically signed</strong></strong>, and it natively supports <strong><strong>transaction of value</strong></strong> and protects against <strong><strong>double spending</strong></strong> without a <strong><strong>central party</strong></strong>, and you can <strong><strong>prove</strong></strong> how each piece of data is processed, and &#x2026;&#x201D;</em></em></blockquote><p>Then I usually get the following reaction:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Ron-Burgundy-Great-Story-1.gif" class="kg-image" alt="The Building Blocks of Blockchain: Introduction" loading="lazy" width="400" height="400"><figcaption>Source: <a href="https://giphy.com/gifs/day-friend-mom-BOMBumnGk0l7W" rel="noopener nofollow">Giphy</a></figcaption></figure><p>But it&#x2019;s really been bugging me. Why do I <em><em>suck</em></em> so much at explaining it? Why is it so <em><em>hard</em></em>?</p><p>After giving it quite some thought, I&#x2019;ve come to the conclusion that I should embrace the fact that it <em><em>is</em></em> hard, and give blockchain the credit it <em><em>deserves. </em></em>Blockchain is not a technology that can be explained in 5 minutes. It&#x2019;s not even <em><em>one </em></em>technology for that matter! It&#x2019;s actually a collection of well-established cryptographic technologies. However, although all of these technologies existed <em><em>before</em></em> the invention of blockchain, they&#x2019;re not exactly <em><em>common knowledge</em></em> for people outside of computer science. In fact, some of them are quite obscure even for people <em><em>in </em></em>computer science<em><em>.</em></em></p><p>In order to understand blockchain on a level deeper than Ron above, it&#x2019;s essential to understand the technologies that it comprises, and how they are <em><em>applied</em></em> to form the blockchain. It&#x2019;s how these technologies are <em><em>combined</em></em> that makes blockchain such a seismic and pure genius breakthrough.</p><h2 id="the-building-blocks-of-blockchain">The Building Blocks Of Blockchain</h2><p>This post is in fact an announcement for a series of posts I intend to write in the following weeks. Each of these posts will explain a single topic (a building block) in an approachable way, topped off by a final post explaining how the blocks fit together into the big picture.</p><p>What are the building blocks, then? I&#x2019;m glad you asked! I believe you can have a sufficiently deep understanding of blockchain and what it could be used for if you understand the following 5 topics:</p><ul><li><strong><strong><a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes/">Proving That Some Data Hasn&#x2019;t Changed: Cryptographic Hashes</a></strong></strong></li><li><strong><strong><a href="https://121gigawatts.org/the-building-blocks-of-blockchain-digital-signatures/">Proving That Some Data Came from Me: Digital Signatures</a></strong></strong></li><li><strong><strong><a href="https://121gigawatts.org/the-building-blocks-of-blockchain-distributed-ledgers-mining/">Distributed Ledgers &amp; Mining</a></strong></strong></li><li><strong><strong><a href="https://121gigawatts.org/the-building-blocks-of-blockchain-putting-it-all-together/">Putting it all Together</a></strong></strong></li><li><strong><strong>What Are Smart Contracts and What Are They Good For?</strong></strong></li></ul><p>Each of these topics will be covered in a dedicated post in the series, which is why I won&#x2019;t get into explaining them further here.</p><h2 id="why-should-i-care">Why Should I Care?</h2><p>There is one simple reason, and one not-so-simple reason that may not apply to all readers.</p><p>The simple reason is &#x2014; because you read this far. Blockchain is surrounded by so much hype, and it&#x2019;s such an intriguing topic. Still, it&#x2019;s hard to really <em><em>get</em></em> it, regardless of how many explainer videos you watched about it. Yes, <strong><strong>I&#x2019;ll dare to promise I&#x2019;ll explain blockchain in a way that makes you finally <em><em>get it</em></em></strong></strong>, as long as you promise me that you will openly complain and <strong><strong>let me know if I did a poor job and there&#x2019;s still something unclear</strong></strong>.</p><p>The other reason is that a lot of people see great hope in blockchain for the energy industry. There are many different ideas and approaches, but the one idea that resonated with me, was the one proposed by Michael Merz in his book &#x201C;<a href="https://blockchain-b2b-book.com/en/" rel="noopener nofollow">Blockchain for B2B Integration</a>&#x201D;. In the book, Michael argues that because the rapid rise of renewable energy drove energy prices and transaction sizes down, the <strong><strong>cost</strong></strong> of transactions is becoming a significant factor. If we want to embrace the fact that the grid is moving toward many small distributed energy resources, we will soon need to handle huge numbers of very small transactions. If these transactions are to be financially viable, <strong><strong>we need a platform that can support transaction costs which are lower than a Euro cent</strong></strong>. This is one of the big problems the energy industry hopes blockchain will help solve.</p><p>These are the ideas I want to drive home so that if you happen to read through to the end of the series, you feel more like this:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Daj-rakijicu.gif" class="kg-image" alt="The Building Blocks of Blockchain: Introduction" loading="lazy" width="245" height="256"><figcaption>Source: <a href="https://giphy.com/gifs/stoner-sees-isopropyl-xSM46ernAUN3y" rel="noopener nofollow">Giphy</a></figcaption></figure><p>See you there!</p><blockquote><em><em>Dive right in with the first building block: <a href="https://121gigawatts.org/the-building-blocks-of-blockchain-cryptographic-hashes/">cryptographic hashes</a>.</em></em></blockquote><hr><p>I find the challenges of modern energy generation and power grids fascinating, and I feel galvanized to help solve them as quickly as possible. This is why I will try to clarify these challenges in a series of blog posts, along with our ideas and attempts at tackling them.</p><p>Am I doing a good job? Was that interesting and understandable? Did I share some horrible misinformation? Do you disagree with me? Do you have any questions? <strong><strong>Please let me know</strong></strong> in the comments or on <a href="https://www.linkedin.com/posts/zoltanmaric_the-building-blocks-of-blockchain-introduction-activity-6579494165627838464-XAdY" rel="noopener nofollow">LinkedIn</a>, or on <a href="https://twitter.com/zoltanmaric/status/1174994180965355521?s=20" rel="noopener nofollow">Twitter</a> :)</p><p>If you haven&#x2019;t yet, you can read the introductory post on what it is I even do <a href="https://121gigawatts.org/what-is-a-virtual-power-plant-anyway">here</a>.</p>]]></content:encoded></item><item><title><![CDATA[What’s the Deal with Grid Frequency?]]></title><description><![CDATA[What is the “grid frequency” a frequency of? Like a lot of things in power grids, this topic is not exactly rocket science — in fact, it’s quite simple.]]></description><link>https://121gigawatts.org/whats-the-deal-with-grid-frequency/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b73</guid><category><![CDATA[VPP]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Mon, 26 Aug 2019 17:42:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/tesla-tower-1.gif" medium="image"/><content:encoded><![CDATA[<img src="https://121gigawatts.org/content/images/2022/03/tesla-tower-1.gif" alt="What&#x2019;s the Deal with Grid Frequency?"><p>In the <a href="https://121gigawatts.org/what-is-a-virtual-power-plant-anyway">introductory post of this series</a>, I talked about virtual power plants and how they help stabilise the grid. When there is too much power in the grid, they pull power from it; and when there&#x2019;s a lack of power in the grid, they feed in power. How do they know whether there&#x2019;s too much or not enough power in the grid? They know it by measuring the <strong><strong><em><em>frequency </em></em></strong></strong>of the grid. <strong><strong>But what does that even mean?</strong></strong> What is the &#x201C;grid frequency&#x201D; a frequency of? Like a lot of things in power grids, this topic is not exactly rocket science &#x2014; in fact, it&#x2019;s quite simple. In this post, I hope to explain it in a way that makes you think so too.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/tesla-tower.gif" class="kg-image" alt="What&#x2019;s the Deal with Grid Frequency?" loading="lazy" width="480" height="480"><figcaption>source: <a href="https://giphy.com/gifs/discoveryeurope-3ohjV3734KgiqC3FEA" rel="noopener nofollow">Giphy</a></figcaption></figure><p>Before we dive in, here&#x2019;s a little heads up, though. In the next two paragraphs, I&#x2019;m going to have to talk about nasty terms like <strong><strong><em><em>voltage</em></em> </strong></strong>and<strong><strong> <em><em>alternating current</em></em></strong></strong>. Ugh. We&#x2019;ll get through them in no time, though, and then I promise it&#x2019;ll be all be back to fun and games. Let&#x2019;s get to it then!</p><hr><h2 id="the-flow-of-electrons">The Flow of Electrons</h2><p>When you plug a device into a socket and turn it on, electrons from the power outlet start flowing through your device. Your device<em><em> works</em></em> by converting the <em><em>flow</em></em> of electrons into other types of energy like light, heat, moving something, etc. This is the first important thing to note &#x2014; your vacuum cleaner <strong><strong>doesn&#x2019;t eat up electrons</strong></strong> that come from your socket, it just <strong><strong>uses the energy those <em><em>flowing </em></em>electrons have</strong></strong> to spin a fan. It&#x2019;s just like a watermill using the <em><em>flow</em></em> of water to turn.</p><p>Now, unlike a stream under a watermill, those electrons don&#x2019;t need to flow in one direction the whole time for us to be able to make use of them. They can also &#x201C;flow&#x201D; back and forth. Some devices like a nice, constant flow in the same direction &#x2014; called <em><em>direct current, DC</em></em>; while others prefer a back and forth flow &#x2014; called <em><em>alternating current, AC. </em></em>It is called <em><em>alternating</em></em> because it <em><em>alternates the </em></em><strong><strong><em><em>direction</em></em></strong></strong><em><em> of the current </em></em>of electrons. As an example &#x2014; your computer and other small electronics usually work on DC, while devices containing motors, like your washing machine, usually work on AC.</p><p>It is fairly easy to convert between AC and DC (which is why you can have both kinds of devices in your household), but for our quest to understand what grid frequency is, it is important to note that in the power grid, electrons are flowing back and forth, meaning it is an AC grid. This was in fact no easy decision, but it is the result of a series of decisive events called <em><em>The War of the Currents </em></em>(<a href="https://en.wikipedia.org/wiki/War_of_the_currents" rel="noopener nofollow">no kidding</a>)<em><em>. </em></em>I would like to take this opportunity to commend the 19th century reporters for coming up with such a rad name.</p><h2 id="back-and-forth">Back and Forth</h2><p>One of the reasons why AC won <em><em>The War of the Currents</em></em> was that devices for generating large amounts of AC power (AC generators) were fairly simple in design. Let&#x2019;s take a look at how they work.</p><p>Most conventional power plants use steam, water, or wind to rotate a turbine. The turbine then either rotates a magnet inside some copper coils, causing the electrons in the coils to move around; or it rotates coils inside a magnetic field, again causing the electrons in the coils to move around (pictured below). In both cases, changing the direction of the poles of the magnet with respect to the coil causes the stream of electrons flowing inside the coil to change direction, i.e. produces <em><em>alternating</em></em> current.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Electrons-back-and-forth-original.gif" class="kg-image" alt="What&#x2019;s the Deal with Grid Frequency?" loading="lazy" width="480" height="368"><figcaption>Generator pushing electrons back and forth (source: <a href="http://www.pengky.cn/dianjixilie011/kjdhz012.html" rel="noopener nofollow">pengky.cn</a>)</figcaption></figure><p>What&#x2019;s actually changing in the generator is the voltage &#x2014; alternating between positive and negative. But <em><em>voltage</em></em> is such an alien word &#x2014;humans don&#x2019;t really experience the effect of voltage in everyday life (and let&#x2019;s keep it that way), as we do with other physical quantities like force, heat, energy and so on. Luckily, voltage has two alter egos that are much more descriptive &#x2014; <strong><strong>electrical pressure </strong></strong>and <strong><strong>electrical tension</strong></strong>.<strong><strong> </strong></strong>What these alter egos are trying to tell us is that we can actually imagine voltage as the <strong><strong>difference in pressure between two ends of a wire</strong></strong>.<strong><strong> </strong></strong>This difference in pressure causes electrons to flow, just like the difference in air pressure causes wind to blow.</p><p>As for the AC generator, I like to imagine it as if the turbine was controlling a piston, and the piston was pushing and pulling the electrons in a pipe. When the piston is pushing into the pipe, it&#x2019;s increasing the pressure on that end of the pipe, causing the electrons to flow away from it. When it&#x2019;s pulling back, it&#x2019;s creating tension on its end of the pipe, causing the electrons to flow towards it.</p><h2 id="i-thought-i-came-here-to-read-about-frequency">I thought I Came Here to Read About <em><strong><em>Frequency</em></strong></em></h2><p>I think we can finally answer the question &#x201C;What is the <em><em>grid frequency</em></em> a frequency of?&#x201D; It is the frequency of voltage cycles in the grid, i.e. of the voltage going from the highest to its lowest, and back to its highest point. In other words, it is the frequency of the electrons flowing back and forth. In Europe, the grid frequency is 50 Hz, meaning the electrons in the power lines go back and forth 50 times in one second, or the voltage goes from 325V down to -325V and back to 325V 50 times in a second in your power outlet. Most importantly, <strong><strong>this frequency is directly dependent on and synchronised with the rate of turning of the turbines</strong></strong> (their revolutions per minute) <strong><strong>in all the power plants</strong></strong>.</p><h2 id="how-does-that-relate-to-the-balance-of-production-consumption">How Does that Relate to the Balance of Production &amp; Consumption?</h2><p>When you turn on a device, the flow of electrons in it provides the device with energy, but this represents a resistance (or load) on their flow, i.e. a load on the grid. As you keep increasing the load, it&#x2019;s going to be harder and harder for the turbines in the power plants to keep pushing and pulling the electrons, i.e. harder to keep spinning at the same rate, and they&#x2019;ll start slowing down (less revolutions per minute), thus <strong><strong>making the frequency drop</strong></strong>.</p><p>It&#x2019;s like riding a bike. I&#x2019;m going to have to go full hipster, and ask you to imagine riding a <a href="https://en.wikipedia.org/wiki/Fixed-gear_bicycle" rel="noopener nofollow">fixie</a> at a constant speed on a flat road. Since you&#x2019;re riding at a constant speed, you are turning your pedals at a constant frequency.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Level-bicycle.gif" class="kg-image" alt="What&#x2019;s the Deal with Grid Frequency?" loading="lazy" width="540" height="405"><figcaption>The face power plants make at 50 Hz (&#xA9; <a href="https://www.horriblehorris.com/single-post/2018/03/10/Gettin-Ridin" rel="noopener nofollow">Horrible Horris</a>, used with permission)</figcaption></figure><p>This is how all the power plants feel when our consumption is exactly as they planned, and they&#x2019;re purring away happily <strong><strong>at 50 Hz</strong></strong>.</p><p>Next, the road starts to go uphill, making it harder for you to maintain your speed, and you start pedalling slower, i.e. you reduce the frequency of your pedalling.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Uphill-bicycle.gif" class="kg-image" alt="What&#x2019;s the Deal with Grid Frequency?" loading="lazy" width="400" height="300"><figcaption>Too much load on the grid (&#xA9; <a href="https://dirkjan.co/" rel="noopener nofollow">Dirk Jan Haarsma</a>, used with permission)</figcaption></figure><p>When consumption (load) on the grid rises above planned levels, the power plants feel like they are now cycling uphill, causing their turbines to spin slower &#x2014;<strong><strong> below 50 Hz</strong></strong>.</p><p>You now reach the top of the hill, and start going downhill, causing your fixie to accelerate and your pedals to turn faster than you&#x2019;d like them to.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Downhill-bicycle.gif" class="kg-image" alt="What&#x2019;s the Deal with Grid Frequency?" loading="lazy" width="540" height="405"><figcaption>Too little load makes your pedals spin fast (&#xA9; <a href="https://www.horriblehorris.com/single-post/2018/03/10/Gettin-Ridin" rel="noopener nofollow">Horrible Horris</a>, used with permission)</figcaption></figure><p>When there&#x2019;s less load than planned in the grid, the power plants are producing with too much power, causing their turbines to spin faster (as if they were cycling downhill) and the frequency to rise &#x2014; <strong><strong>above 50 Hz</strong></strong>.</p><h2 id="errm-why-are-you-telling-me-this-again">Errm&#x2026; Why are you telling me this, again?</h2><p>Because <em><em>virtual power plants</em></em>! When the grid frequency is too high &#x2014; meaning there&#x2019;s too little load on the grid &#x2014; the sonnen VPP increases the load by charging the sonnen batteries in customers&#x2019; homes from the grid. When the frequency drops &#x2014; meaning there&#x2019;s too much load or conversely too little production &#x2014; the VPP discharges power from the batteries into the grid, thus <em><em>increasing production. </em></em>I explained how virtual power plants work in more detail in <a href="https://121gigawatts.org/what-is-a-virtual-power-plant-anyway">this post</a>.</p><hr><p>I find the challenges of modern energy generation and power grids fascinating, and I feel galvanized to help solve them as quickly as possible. This is why I will try to clarify these challenges in a series of blog posts, along with our ideas and attempts at tackling them.</p><p>Am I doing a good job? Was that interesting and understandable? Did I share some horrible misinformation? Do you disagree with me? Do you have any questions? <strong><strong>Please let me know</strong></strong> in the comments or on <a href="https://www.linkedin.com/posts/zoltanmaric_whats-the-deal-with-grid-frequency-activity-6572250500769603584-fdwN" rel="noopener nofollow">LinkedIn</a>, or on <a href="https://twitter.com/zoltanmaric" rel="noopener nofollow">Twitter</a> :)</p>]]></content:encoded></item><item><title><![CDATA[What Is a "Virtual Power Plant" Anyway?]]></title><description><![CDATA[When I first saw the job ad for sonnen, I was speechless. Whoa. Home batteries. Blockchain. Virtual power plant. What the heck is a virtual power plant?]]></description><link>https://121gigawatts.org/what-is-a-virtual-power-plant-anyway/</link><guid isPermaLink="false">622fc06d1b0ace88872d8b72</guid><category><![CDATA[VPP]]></category><dc:creator><![CDATA[Zoltán Marić]]></dc:creator><pubDate>Mon, 12 Aug 2019 00:00:00 GMT</pubDate><media:content url="https://121gigawatts.org/content/images/2022/03/Lame-VR-Gang.gif" medium="image"/><content:encoded><![CDATA[<img src="https://121gigawatts.org/content/images/2022/03/Lame-VR-Gang.gif" alt="What Is a &quot;Virtual Power Plant&quot; Anyway?"><p>When I first saw the <a href="https://stackoverflow.com/jobs/153708/blockchain-entwickler-m-w-f%C3%BCr-ein-virtuelles-sonnen-gmbh" rel="noopener nofollow">job ad for sonnen</a> back in September 2017, I was speechless. Whoa. Home batteries. <strong><strong><em><em>Blockchain.</em></em></strong></strong> Virtual power plant. In Berlin! What the heck is a <em><em>virtual power plant</em></em>? I love it.</p><p>Well, needless to say, I immediately started preparing to apply for the position, and in a couple of months, I got it indeed.</p><p>However, it really took me quite a while to understand why <strong><strong>a</strong></strong> <strong><strong>bunch of batteries working together</strong></strong> trying to stabilise the power grid was called a &#x201C;virtual power plant&#x201D;. And what is it about a power grid that needs to be <strong><strong>stabilised</strong></strong>?</p><hr><h1 id="what-is-a-power-plant">What is a <strong>power plant?</strong></h1><p>A power plant is one of those factory-looking things that generates electricity, right? One of these:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://121gigawatts.org/content/images/2022/03/Battersea_Power_Station_from_the_river.jpg" class="kg-image" alt="What Is a &quot;Virtual Power Plant&quot; Anyway?" loading="lazy" width="1280" height="853" srcset="https://121gigawatts.org/content/images/size/w600/2022/03/Battersea_Power_Station_from_the_river.jpg 600w, https://121gigawatts.org/content/images/size/w1000/2022/03/Battersea_Power_Station_from_the_river.jpg 1000w, https://121gigawatts.org/content/images/2022/03/Battersea_Power_Station_from_the_river.jpg 1280w" sizes="(min-width: 720px) 720px"><figcaption>Battersea Power Station, <a href="https://commons.wikimedia.org/wiki/File:Battersea_Power_Station_from_the_river.jpg" rel="noopener nofollow">Alberto Pascual</a> [<a href="https://creativecommons.org/licenses/by-sa/3.0" rel="noopener nofollow">CC BY-SA 3.0</a>]</figcaption></figure><p><em><em>Lovely</em></em>. Very Pink Floyd. So how can a bunch of batteries be a power plant? They don&#x2019;t <em><em>generate</em></em> electricity &#x2014; they <em><em>store </em></em>electricity. That&#x2019;s not what a power plant does!</p><p>Technically, that <em><em>is </em></em>correct, however, the catch is that <strong><strong>generating electricity is not <em><em>all </em></em>a power plant does</strong></strong>.<strong><strong> </strong></strong>Its responsibility is also to <strong><strong>generate electricity at a strictly defined rate</strong></strong>. In other words, a power plant also has to control how fast it is producing energy, i.e. how much energy it is producing over time. This <em><em>rate</em></em>, or <em><em>&#x201C;speed&#x201D; </em></em>of producing energy is called <strong><strong>power</strong></strong>, and it&#x2019;s usually measured in <strong><strong>megawatts</strong></strong> for power plants.</p><p>Here are some quick numbers to help you get some perspective:</p><ul><li>A power plant producing at 300 MW will have produced 300 MWh of <strong><strong>energy</strong></strong> in an hour (duh)</li><li>In 2014, an average household in the EU was consuming <strong><strong>3600 kWh in a year </strong></strong>(source: <a href="https://wec-indicators.enerdata.net/household-electricity-use.html#/household-electricity-use.html" rel="noopener nofollow">EnerData</a>)</li></ul><h1 id="why-does-a-power-grid-need-to-be-stabilised">Why does a power grid need to be stabilised?</h1><p>Here&#x2019;s something I had been completely <em><em>clueless</em></em> about, before I started working in the energy industry: <strong><strong>How can it be that I can just decide to start my washing machine</strong></strong> or a hair dryer at any time, <strong><strong>and no one cares</strong></strong>, i.e. the power outlet just <em><em>covers</em></em> it. Like <strong><strong>where does that extra energy suddenly come from</strong></strong>? <em><em>Surely</em></em> <strong><strong>that far-away power plant didn&#x2019;t increase its production</strong></strong> just to cover that extra energy consumption <em><em>I</em></em> just caused.</p><p>Well, <strong><strong>it kinda did</strong></strong>.</p><p>In order for a power grid to operate properly, <strong><strong>consumption has to equal production at all times</strong></strong>, within a very small margin. But how does a power plant <em><em>know </em></em>that consumption increased or decreased? Conveniently, there&#x2019;s actually a very simple measure that tells exactly this &#x2014; the <strong><strong>grid frequency</strong></strong>.</p><p>In Europe, <strong><strong>the grid frequency equals 50 Hz when production exactly matches consumption</strong></strong>. If it&#x2019;s above 50 Hz, production is higher than consumption, and if it&#x2019;s below 50 Hz &#x2026; you get the picture.</p><p>Certain types of power plants reserve a part of their capacity for the ability to decrease or increase their production as the frequency increases or decreases, thus <em><em>stabilising the grid</em></em>. This reserve capacity is called frequency containment reserve (FCR). If you would like to understand in more detail how grid frequency works, perhaps my post <em><em>&#x201C;<a href="https://121gigawatts.org/whats-the-deal-with-grid-frequency/">What&#x2019;s the Deal with Grid Frequency?</a>&#x201D;</em></em> can help you with that.</p><h1 id="will-you-please-tell-us-what-a-virtual-power-plant-is-already">Will you <em>please</em> tell us what a Virtual Power Plant is already?</h1><p>Why yes! Generally speaking, a virtual power plant is a group of grid assets and a piece of software that can control their production or load. It could consist of generating assets, like small biogas power plants and wind farms; or load assets, like an aluminium furnace. The VPP software controls power generation and load of its assets as required by the grid.</p><p>This is exactly it &#x2014;while power plants reserve a part of their generation capacity in order to be able to increase or decrease production, <strong><strong>the sonnen Virtual Power Plant achieves the same effect</strong></strong> with a swarm of household batteries. <strong><strong>It feeds power from the batteries into the grid when there&#x2019;s excess demand, or pulls power from the grid and stores them into the batteries when there&#x2019;s excess supply</strong></strong>.</p><h1 id="ok-what-s-the-big-deal-about-that">OK, what&#x2019;s the big deal about that?</h1><p>More and more energy is coming from solar and wind. Unlike in the case of conventional power plants, generation from wind and solar cannot be <em><em>increased</em></em> to meet demand, and it can only be <strong><strong><em><em>curtailed</em></em></strong></strong> (i.e. <strong><strong>shut off</strong></strong>) to decrease excess production, meaning <strong><strong>part of the renewable energy that <em><em>could</em></em> <em><em>have</em></em> been produced is <em><em>wasted</em></em></strong></strong>, because there wasn&#x2019;t enough demand to consume it.</p><p>In addition, <strong><strong>because solar and wind energy is so volatile, the grid frequency also becomes more volatile</strong></strong>, requiring more e.g. gas plants to perform frequency containment.</p><p>Contrast that idea with using batteries for frequency containment, where the same <strong><strong>excess renewable energy </strong></strong>that was stored when there was excess production <strong><strong>can be released back into the grid at a later time, when there&#x2019;s lack of (renewable) production.</strong></strong></p><p>sonnen recently released a pretty video on this exact topic, you may like it:</p><figure class="kg-card kg-embed-card"><iframe width="480" height="270" src="https://www.youtube.com/embed/fDMV_HY3zmw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure><hr><p>I find the challenges of modern energy generation and power grids fascinating, and I feel galvanized to help solve them as quickly as possible. This is why I will try to clarify these challenges in a series of blog posts, along with our ideas and attempts at tackling them.</p><p>Am I doing a good job? Was that interesting and understandable? Did I share some horrible misinformation? Do you disagree with me? Do you have any questions? <strong><strong>Please let me know</strong></strong> in the comments or on <a href="https://www.linkedin.com/posts/zoltanmaric_what-is-a-virtual-power-plant-anyway-activity-6566769572135874560-9VHi" rel="noopener nofollow">LinkedIn</a>, or on <a href="https://twitter.com/zoltanmaric/status/1161007233989337088?s=20" rel="noopener nofollow">Twitter</a> :)</p>]]></content:encoded></item></channel></rss>