I'm a mathematician who wants long articles with lots of equations. Here's a blog post explaining cryptoccurency using equations:
https://www.coindesk.com/markets/2014/10/19/the-math-behind-the-bitcoin-protocol/
The Math Behind the Bitcoin Protocol
2014-10-19
Eric Rykwalder
<div><div><div><p>One reason bitcoin can be confusing for beginners is that the technology behind it redefines the concept of ownership.</p></div><div><p>To own something in the traditional sense, be it a house or a sum of money, means either having personal custody of the thing or granting custody to a trusted entity such as a bank.</p></div><div><p></p><h3>Bitcoin Protocol</h3><p></p></div><div><p>With bitcoin the case is different. Bitcoins themselves are not stored either centrally or locally and so no one entity is their custodian. They exist as records on a distributed ledger called the block chain, copies of which are shared by a volunteer network of connected computers. To “own” a bitcoin simply means having the ability to transfer control of it to someone else by creating a record of the transfer in the block chain. What grants this ability? Access to an <a href="http://en.wikipedia.org/wiki/Elliptic_Curve_DSA">ECDSA</a> private and public key pair. What does that mean and how does that secure bitcoin?</p></div><div><p>Let’s have a look under the hood.</p></div><div><p><b><b>ECDSA</b></b> is short for Elliptic Curve Digital Signature Algorithm. It’s a process that uses an <a href="http://en.wikipedia.org/wiki/Elliptic_curve">elliptic curve</a> and a <a href="http://en.wikipedia.org/wiki/Finite_field">finite field</a> to “sign” data in such a way that third parties can verify the authenticity of the signature while the signer retains the exclusive ability to create the signature. With bitcoin, the data that is signed is the transaction that transfers ownership.</p></div><div><p>ECDSA has separate procedures for signing and verification. Each procedure is an algorithm composed of a few arithmetic operations. The signing algorithm makes use of the private key, and the verification process makes use of the public key. We will show an example of this later.</p></div><div><p>But first, a crash course on elliptic curves and finite fields.</p></div><div><p></p><h3>Elliptic curves</h3><p></p></div><div><p>An elliptic curve is represented algebraically as an equation of the form:</p></div><div><p>For <i>a = 0</i> and <i>b = 7</i> (the version used by bitcoin), it looks like this:</p></div><div><figure><figcaption><p>math behind bitcoin</p></figcaption></figure></div><div><p>Elliptic curves have useful properties. For example, a non-vertical line intersecting two non-tangent points on the curve will always intersect a third point on the curve. A further property is that a non-vertical line tangent to the curve at one point will intersect precisely one other point on the curve.</p></div><div><p>We can use these properties to define two operations: point addition and point doubling.</p></div><div><p><b><b>Point addition</b></b>, <i>P + Q = R,</i> is defined as the reflection through the x-axis of the third intersecting point <i>R’</i> on a line that includes <i>P</i> and <i>Q</i>. It’s easiest to understand this using a diagram:</p></div><div><figure><figcaption><p>math behind bitcoin</p></figcaption></figure></div><div><p>Similarly,<b><b> point doubling</b></b>, <i>P + P = R</i> is defined by finding the line tangent to the point to be doubled, <i>P</i>, and taking reflection through the x-axis of the intersecting point <i>R’</i> on the curve to get <i>R</i>. Here’s an example of what that would look like:</p></div><div><figure><figcaption><p>point doubling</p></figcaption></figure></div><div><p>Together, these two operations are used for <b><b>scalar multiplication</b></b>, <i>R = a P,</i> defined by adding the point <i>P</i> to itself <i>a</i> times. For example:</p></div><div><p>R = P + (P + (P + (P + (P + (P + P)))))</p></div><div><p>The process of scalar multiplication is normally simplified by using a combination of point addition and point doubling operations. For example:</p></div><div><p>Here, <i>7P</i> has been broken down into two point doubling steps and two point addition steps.</p></div><div><p></p><h3>Finite fields</h3><p></p></div><div><p>A finite field, in the context of ECDSA, can be thought of as a predefined range of positive numbers within which every calculation must fall. Any number outside this range “wraps around” so as to fall within the range.</p></div><div><p>The simplest way to think about this is calculating remainders, as represented by the modulus (mod) operator. For example, 9/7 gives 1 with a remainder of 2:</p></div><div><p>Here our finite field is modulo 7, and all mod operations over this field yield a result falling within a range from 0 to 6.</p></div><div><p></p><h3>Putting it together</h3><p></p></div><div><p>ECDSA uses elliptic curves in the context of a finite field, which greatly changes their appearance but not their underlying equations or special properties. The same equation plotted above, in a finite field of modulo 67, looks like this:</p></div><div><figure><figcaption><p>math behind bitcoin</p></figcaption></figure></div><div><p>It’s now a set of points, in which all the <i>x</i> and <i>y</i> values are integers between 0 and 66. Note that the “curve” still retains its horizontal symmetry.</p></div><div><p>Point addition and doubling are now slightly different visually. Lines drawn on this graph will wrap around the horizontal and vertical directions, just like in a game of Asteroids, maintaining the same slope. So adding points (2, 22) and (6, 25) looks like this:</p></div><div><figure><figcaption><p>math behind bitcoin</p></figcaption></figure></div><div><p>The third intersecting point is (47, 39) and its reflection point is (47, 28).</p></div><div><p></p><h3>Back to ECDSA and bitcoin</h3><p></p></div><div><p>A protocol such as bitcoin selects a set of parameters for the elliptic curve and its finite field representation that is fixed for all users of the protocol. The parameters include the <b><b>equation</b></b> used, the <b><b>prime modulo</b></b> of the field, and a <b><b>base point</b></b> that falls on the curve. The <b><b>order</b></b> of the base point, which is not independently selected but is a function of the other parameters, can be thought of graphically as the number of times the point can be added to itself until its slope is infinite, or a vertical line. The base point is selected such that the order is a large prime number.</p></div><div><p>Bitcoin uses very large numbers for its base point, prime modulo, and order. In fact, all practical applications of ECDSA use enormous values. The security of the algorithm relies on these values being large, and therefore impractical to brute force or reverse engineer.</p></div><div><p>Elliptic curve equation: y2 = x3 + 7</p></div><div><p>Prime modulo = 2256 – 232 – 29 – 28 – 27 – 26 – 24 - 1 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F</p></div><div><p>Base point = 04 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798 483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8</p></div><div><p>Order = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141</p></div><div><p>Who chose these numbers, and why? A great deal of <a href="http://perso.univ-rennes1.fr/sylvain.duquesne/master/standards/sec2_final.pdf">research</a>, and a fair amount of <a href="http://it.slashdot.org/story/13/09/11/1224252/are-the-nist-standard-elliptic-curves-back-doored?utm_source=rss1.0mainlinkanon&amp;utm_medium=feed">intrigue</a>, surrounds the selection of appropriate parameters. After all, a large, seemingly random number could hide a backdoor method of reconstructing the private key. In brief, this particular realization goes by the name of secp256k1 and is part of a family of elliptic curve solutions over finite fields proposed for use in cryptography.</p></div><div><p></p><h3>Private keys and public keys</h3><p></p></div><div><p>With these formalities out of the way, we are now in a position to understand private and public keys and how they are related. Here it is in a nutshell: In ECDSA, the private key is an unpredictably chosen number between 1 and the order. The public key is derived from the private key by scalar multiplication of the base point a number of times equal to the value of the private key. Expressed as an equation:</p></div><div><p>public key = private key * base point</p></div><div><p>This shows that the maximum possible number of private keys (and thus bitcoin addresses) is equal to the order.</p></div><div><p>In a continuous field we could plot the tangent line and pinpoint the public key on the graph, but there are some <a href="http://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication">equations</a> that accomplish the same thing in the context of finite fields. Point addition of <i>p + q</i> to find <i>r</i> is defined component-wise as follows:</p></div><div><p>c = (qy - py) / (qx - px)</p></div><div><p>And point doubling of to find <i>r </i>is as follows:</p></div><div><p>In practice, computation of the public key is broken down into a number of point doubling and point addition operations starting from the base point.</p></div><div><p>Let’s run a back of the envelope example using small numbers, to get an intuition about how the keys are constructed and used in signing and verifying. The parameters we will use are:</p></div><div><p>Equation: y2 = x3 + 7 (which is to say, a = 0 and b = 7)</p></div><div><p>First, let’s find the public key. Since we have selected the simplest possible private key with value = 2, it will require only a single point doubling operation from the base point. The calculation looks like this:</p></div><div><p>c = (3 * 22 + 0) / (2 * 22) mod 67</p></div><div><p>c = (3 * 4) / (44) mod 67</p></div><div><p>Here we have to pause for a bit of sleight-of-hand: how do we perform division in the context of a finite field, where the result must always be an integer? We have to multiply by the inverse, which space does not permit us to define here (we refer you to <a href="http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse">here</a> and <a href="http://cdn.intechopen.com/pdfs-wm/29704.pdf">here</a> if interested). In the case at hand, you will have to trust us for the moment that:</p></div><div><p>rx = (492 - 2 * 2) mod 67</p></div><div><p>ry = (49 * (2 - 52) - 22) mod 67</p></div><div><p>ry = (49 * (-50) - 22) mod 67</p></div><div><p>Our public key thus corresponds to the point (52, 7). All that work for a private key of 2!</p></div><div><p>This operation - going from private to public key - is computationally easy in comparison to trying to work backwards to deduce the private key from the public key, which while theoretically possible is computationally infeasible due to the large parameters used in actual elliptic cryptography.</p></div><div><p>Therefore, going from the private key to the public key is by design a one-way trip.</p></div><div><p>As with the private key, the public key is normally represented by a hexadecimal string. But wait, how do we get from a point on a plane, described by two numbers, to a single number? In an uncompressed public key the two 256-bit numbers representing the <i>x</i> and <i>y </i>coordinates are just stuck together in one long string. We can also take advantage of the symmetry of the elliptic curve to produce a compressed public key, by keeping just the <i>x </i>value and noting which half of the curve the point is on. From this partial information we can recover both coordinates.</p></div><div><p></p><h3>Signing data with the private key</h3><p></p></div><div><p>Now that we have a private and public key pair, let’s sign some data!</p></div><div><p>The data can be of any length. The usual first step is to hash the data to generate a number containing the same number of bits (256) as the order of the curve. Here, for the sake of simplicity, we’ll skip the hashing step and just sign the raw data <i>z</i>. We’ll call <i>G</i> the base point, the order, and <i>d</i> the private key. The recipe for signing is as follows:</p></div><div><ol><li><p>Choose some integer k between 1 and n - 1.</p></li><li><p>Calculate the point (x, y) = k * G, using scalar multiplication.</p></li><li><p>Find r = x mod n. If r = 0, return to step 1.</p></li><li><p>Find s = (z + r * d) / k mod n. If s = 0, return to step 1.</p></li><li><p>The signature is the pair (r, s)</p></li></ol></div><div><p>As a reminder, in step 4, if the numbers result in a fraction (which in real life they almost always will), the numerator should be multiplied by the inverse of the denominator. In step 1, it is important that <i>k</i> not be repeated in different signatures and that it not be guessable by a third party. That is, <i>k</i> should either be random or generated by deterministic means that are kept secret from third parties. Otherwise it would be possible to extract the private key from step 4, since , <i>z</i>, <i>r</i>, <i>k</i> and are all known. You can read about a past exploit of this type <a href="http://arstechnica.com/gaming/2010/12/ps3-hacked-through-poor-implementation-of-cryptography/">here</a>.</p></div><div><p>Let’s pick our data to be the number 17, and follow the recipe. Our variables:</p></div><div><ol><li><p>Pick a random number:</p></li></ol></div><div><p>k = 3 (is this really random? OK you got us, but it will make our example simpler!)</p></div><div><ol> <li>Calculate the point. This is done in the same manner as determining the public key, but for brevity let’s omit the arithmetic for point addition and point doubling.</li></ol></div><div><p>(x, y) = (2, 22) + (52, 7)</p></div><div><ol> <li>Find <i>r</i>:</li></ol></div><div><ol> <li>Find :</li></ol></div><div><p>s = (z + r * d) / k mod n</p></div><div><p>s = (17 + 62 * 2) / 3 mod 79</p></div><div><p>s = (17 + 124) / 3 mod 79</p></div><div><p>Note that above we were able to divide by 3 since the result was an integer. In real-life cases we would use the inverse of <i>k</i> (like before, we have hidden some gory details by computing it elsewhere):</p></div><div><p>s = (z + r * d) / k mod n</p></div><div><p>s = (17 + 62 * 2) / 3 mod 79</p></div><div><p>s = (17 + 124) / 3 mod 79</p></div><div><ol> <li>Our signature is the pair (<i>r</i>, ) = (62, 47).</li></ol></div><div><p>As with the private and public keys, this signature is normally represented by a hexadecimal string.</p></div><div><p></p><h3>Verifying the signature with the public key</h3><p></p></div><div><p>We now have some data and a signature for that data. A third party who has our public key can receive our data and signature, and verify that we are the senders. Let’s see how this works.</p></div><div><p>With <i>Q</i> being the public key and the other variables defined as before, the steps for verifying a signature are as follows:</p></div><div><ol><li><p>Verify that r and s are between 1 and n - 1.</p></li><li><p>Calculate w = s<sup>-1</sup> mod n</p></li><li><p>Calculate u = z * w mod n</p></li><li><p>Calculate v = r * w mod n</p></li><li><p>Calculate the point (x, y) = uG + vQ</p></li><li><p>Verify that r = x mod n. The signature is invalid if it is not.</p></li></ol></div><div><p>Why do these steps work? We are skipping the proof, but you can read the details <a href="http://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Correctness_of_the_algorithm">here</a>. Let’s follow the recipe and see how it works. Our variables, once again:</p></div><div><p>(r, s) = (62, 47) (signature)</p></div><div><ol><li><p>Verify that <em>r</em> and are between 1 and - 1. Check and check.</p></li></ol></div><div><ol> <li>Calculate <i>w</i>:</li></ol></div><div><ol> <li>Calculate <i>u</i>:</li></ol></div><div><ol> <li>Calculate <i>v</i>:</li></ol></div><div><ol> <li>Calculate the point (<i>x</i>, <i>y</i>):</li></ol></div><div><p>Let’s break down the point doubling and addition in <i>uG</i> and <i>vQ</i> separately.</p></div><div><p>uG = 2( 2(G + 2(G + 8G) ) )</p></div><div><p>uG = 2( 2(G + 2(G + 2(4G) ) ) )</p></div><div><p>uG = 2( 2(G + 2(G + 2( 2(2G) ) ) ) )</p></div><div><p>Sit back for a moment to appreciate that by using the grouping trick we reduce 75 successive addition operations to just six operations of point doubling and two operations of point addition. These tricks will come in handy when the numbers get really large.</p></div><div><p>Working our way from the inside out:</p></div><div><p>uG = 2( 2(G + 2(G + 2( 2( 2(2, 22) ) ) ) ) )</p></div><div><p>uG = 2( 2(G + 2(G + 2( 2(52, 7) ) ) ) )</p></div><div><p>uG = 2( 2(G + 2(G + 2(25, 17) ) ) )</p></div><div><p>uG = 2( 2(G + 2( (2, 22) + (21, 42) ) ) )</p></div><div><p>uG = 2( 2(G + 2(13, 44) ) )</p></div><div><p>uG = 2( 2( (2, 22) + (66, 26) ) )</p></div><div><p>(x, y) = (62, 4) + (11, 20)</p></div><div><p>Clearly step 5 is the bulk of the work. For the final step,</p></div><div><ol> <li>Verify that r = x mod n</li></ol></div><div><p></p><h3>Conclusion</h3><p></p></div><div><p>For those of you who saw all the equations and skipped to the bottom, what have we just learned?</p></div><div><p>We have developed some intuition about the deep mathematical relationship that exists between public and private keys. We have seen how even in the simplest examples the math behind signatures and verification quickly gets complicated, and we can appreciate the enormous complexity which must be involved when the parameters involved are 256-bit numbers. We have seen how the clever application of the simplest mathematical procedures can create the one-way “trap door” functions necessary to preserve the information asymmetry which defines ownership of a bitcoin. And we have newfound confidence in the robustness of the system, provided that we carefully safeguard the knowledge of our private keys.</p></div><div><p>In other words, this is why it is commonly said that bitcoin is “backed by math”.</p></div><div><p>If you hung in through the complicated bits, we hope it gave you the confidence to take the next step and try out the math on your own (a <a href="http://ptrow.com/perl/calculator.pl">modular arithmetic calculator</a> makes the finite field math much easier). We found that going through the steps of signing and verifying data by hand provides a deeper understanding of the cryptography that enables bitcoin’s unique form of ownership.</p></div><div><p><i>This article has been republished here with permission from the author. Originally published on <a href="http://blog.chain.com/post/99177371581/bitcoins-killer-apps">Chain.com</a>. The author gives s</i><i>pecial thanks to Steven Phelps for help with this article.</i></p></div><div><p><i><i>Eric Rykwalder is a software engineer and one of <a href="http://chain.com/">Chain.com</a>’s founders. </i></i></p></div></div>||||I|||| * 
 + Crypto Prices
 + CoinDesk Market Index
 + TV & Videos
 + Newsletters
 + Podcasts
 + Consensus Magazine
 + Learn
 + Bitcoin Calculator
 + Consensus
 + Webinars
 + Indices
 + About
 + Markets
 + Finance
 + Technology
 + Web3
 + Policy
 + Sponsored Content
 Upcoming event
 New Pass! Developer Pass ($189)
 * TV & Videos

 TV & Videos

 + First Mover
 + The Hash
 + All About Bitcoin
 + Money Reimagined
 + Community Crypto
 + Consensus 22 Videos
 + View all shows

 Watch On

 + Twitter

 + Facebook

 * Newsletters

 Sign up for our newsletters

 Learn More

 The Airdrop

 Your weekly wrap of Web3 news and trends.

 First Mover

 The latest moves in crypto markets, in context.

 The Node

 The biggest crypto news and ideas of the day.

 State of Crypto

 Probing the intersection of crypto and government.

 Crypto Investing Course

 Be a smarter, safer investor in eight weeks.

 Valid Points

 How Ethereum's evolution impacts crypto markets.

 Crypto Long & Short

 News and analysis for the professional investor.

 Crypto for Advisors

 What financial advisors need to know about crypto.

 Money Reimagined

 The transformation of value in the digital age.

 Enter your Email
 Subscribe

 By signing up, you will receive emails about CoinDesk products and you agree to ourterms & conditionsandprivacy policy.

 * Podcasts

 Podcasts

 + The Hash
 + Markets Daily
 + Money Reimagined
 + The Breakdown, With NLW
 + Carpe Consensus
 * 
 * Consensus

 Consensus

 + Go to Consensus 2023 Site
 + Consensus 2022 Videos
 + Powered By Consensus Content
 * Indices

 Indices

 + Bitcoin Price Index (XBX)
 + Ether Price Index (ETX)
 + Basic Attention Token Price Index (BTX)
 + Bitcoin Cash Price Index (BCX)
 + Cardano Price Index (ADX)
 * Crypto Prices
 * CoinDesk Market Index
 * TV & Videos
 * Newsletters
 * Podcasts
 * Consensus Magazine
 * Learn
 * Bitcoin Calculator
 * Consensus
 * Webinars
 * Indices
 * About
 * Markets
 * Finance
 * Technology
 * Web3
 * Policy
 * Sponsored Content
 Upcoming event
 New Pass! Developer Pass ($189)
 * Markets

 Markets

 + On-Chain Data
 + Token Governance
 + Bitcoin
 + Ether
 + First Mover
 * Finance

 Finance

 + FTX
 + SBF
 + NFTs
 + Coinbase
 + Business
 * Policy

 Policy

 + Regulation
 + Crypto
 + Sanctions
 + SEC
 + Law
 * Technology

 Technology

 + On-Chain Data
 + Token Governance
 + DeFi
 + Blockchains
 + Hacks
 * Web3

 Web3

 + Yuga Labs
 + NFTs
 + Metaverse
 + Dao
 + Gaming
 * Learn

 Learn

 + NFTs
 + Bitcoin
 + Ethereum
 + Cryptocurrency
 + Investing

 Crash Courses

 + Bitcoin 101
 + DeFi 101
 + Ethereum 101
 + NFT 101
 + Price Data 101
 * Consensus Magazine

 Consensus Magazine

 + Crypto 2023
 + Most Influential
 + Tax Week
 + Trading Week
 + IDEAS Week

 Most Recent Issue

 * Sponsored Content

 Sponsored Content

 + Gate.US
 + abra
 + Matrixport
 + SocialGood
 + Tron
 Bitcoin
 $ 23,542.50 + 1.62%
 Ethereum
 $ 1,640.13 + 2.64%
 Binance Coin
 $ 308.09 + 1.73%
 XRP
 $ 0.37619170 -0.62%
 Aptos
 $ 12.58 + 1.09%
 Cardano
 $ 0.36631700 + 1.90%
 Polygon
 $ 1.28 + 1.87%
 Dogecoin
 $ 0.08194722 + 0.92%
 Binance USD
 $ 1.00 -0.05%
 Stellar
 $ 0.08890700 + 1.05%
 Solana
 $ 23.03 + 1.95%
 Crypto.com
 $ 0.08229395 + 4.77%
 Polkadot
 $ 6.67 + 1.52%
 Shiba Inu
 $ 0.00001282 + 2.60%
 Chainlink
 $ 7.45 + 1.18%
 Litecoin
 $ 95.11 + 1.74%
 Uniswap
 $ 6.58 + 1.02%
 Tron
 $ 0.06920228 + 1.12%
 Avalanche
 $ 18.31 + 1.53%
 Wrapped Bitcoin
 $ 23,556.48 + 1.59%
 Cosmos
 $ 12.91 -0.05%
 Quant
 $ 129.85 -1.65%
 Internet Computer
 $ 6.20 + 0.79%
 Lido DAO
 $ 3.07 + 3.98%
 Ethereum Classic
 $ 21.33 + 1.37%
 dYdX
 $ 2.82 -1.93%
 Monero
 $ 151.91 + 1.88%
 Filecoin
 $ 6.86 + 1.16%
 Bitcoin Cash
 $ 136.21 + 2.06%
 Stepn
 $ 0.37591251 + 0.92%
 VeChain
 $ 0.02853979 + 5.79%
 NEAR Protocol
 $ 2.35 + 2.98%
 Hedera
 $ 0.07414809 -1.62%
 Curve DAO Token
 $ 1.02 + 2.70%
 ApeCoin
 $ 5.24 + 3.29%
 Algorand
 $ 0.25563740 + 2.54%
 Decentraland
 $ 0.65741260 + 1.10%
 The Graph
 $ 0.15926039 + 4.75%
 Aave
 $ 82.48 + 2.68%
 NEO
 $ 13.17 + 13.72%
 Fantom
 $ 0.47277585 + 2.24%
 The Sandbox
 $ 0.71303360 + 0.20%
 Flow
 $ 1.21 + 0.57%
 Elrond
 $ 49.45 + 1.97%
 EOS
 $ 1.12 + 1.06%
 Theta
 $ 1.22 -0.13%
 Axie Infinity
 $ 9.97 + 1.27%
 Tezos
 $ 1.21 -0.53%
 Luna Classic
 $ 0.00016284 + 0.54%
 Stacks
 $ 0.77514912 + 0.28%
 Synthetix
 $ 2.67 + 5.95%
 Dash
 $ 74.18 + 4.95%
 Mina
 $ 0.94721538 + 1.45%
 Immutable X
 $ 0.97636030 + 0.29%
 Bitcoin SV
 $ 41.76 + 0.95%
 PancakeSwap
 $ 4.04 + 0.65%
 Maker
 $ 776.11 + 8.48%
 Chiliz
 $ 0.13534661 + 0.63%
 IOTA
 $ 0.25107548 -0.48%
 eCash
 $ 0.00003538 + 1.83%
 BitTorrent
 $ 0.00000072 + 1.41%
 Paxos Dollar
 $ 0.88919696 -11.47%
 Optimism
 $ 2.99 + 5.07%
 Zcash
 $ 44.70 + 0.47%
 Convex Finance
 $ 5.88 + 2.28%
 Zilliqa
 $ 0.03254462 + 2.19%
 Compound
 $ 51.63 + 1.70%
 FTX Token
 $ 1.55 + 4.35%
 THORChain
 $ 1.65 + 2.29%
 Enjin
 $ 0.48329762 + 3.30%
 Basic Attention Token
 $ 0.30837000 + 5.12%
 Loopring
 $ 0.36861537 + 0.61%
 Fetch.ai
 $ 0.43530696 + 1.93%
 PAX Gold
 $ 1,798.31 + 0.23%
 Ethereum Name Service
 $ 16.32 + 5.25%
 NEM
 $ 0.04471203 + 9.77%
 Nexo
 $ 0.71813785 + 1.06%
 Terra 2.0/LUNA
 $ 1.73 + 0.49%
 Celo
 $ 0.79027432 + 1.37%
 Mask Network
 $ 3.82 + 3.80%
 Ravencoin
 $ 0.03160336 + 2.05%
 Kava.io
 $ 0.87171844 + 1.00%
 Woo Network
 $ 0.22364413 + 4.24%
 Decred
 $ 24.26 + 2.89%
 Qtum
 $ 3.48 + 6.34%
 Yearn Finance
 $ 9,690.38 + 1.33%
 Kusama
 $ 38.78 + 1.15%
 Audius
 $ 0.34738097 + 1.12%
 Ankr
 $ 0.04183506 -1.43%
 Oasis Network
 $ 0.06745579 + 0.60%
 Amp
 $ 0.00602811 + 4.01%
 Sushiswap
 $ 1.34 + 0.31%
 Bitcoin Gold
 $ 16.78 + 0.10%
 Gala
 $ 0.04081498 + 1.27%
 Injective Protocol
 $ 3.76 + 8.49%
 TerraUSD
 $ 0.02819351 + 0.06%
 IoTeX
 $ 0.02853462 + 1.58%
 Moonbeam
 $ 0.45948741 + 4.08%
 0x
 $ 0.26479579 + 0.97%
 Waves
 $ 2.57 + 0.99%
 UMA Protocol
 $ 2.20 -0.23%
 Band Protocol
 $ 2.00 -0.66%
 OMG Network
 $ 1.73 + 2.28%
 ICON
 $ 0.25255615 + 1.21%
 Ribbon Finance
 $ 0.22662000 -0.24%
 Celsius
 $ 0.53013703 + 14.45%
 Siacoin
 $ 0.00424854 + 0.18%
 Polymath Network
 $ 0.21027966 + 4.75%
 Skale
 $ 0.04939398 + 1.64%
 NuCypher
 $ 0.15034123 + 4.78%
 Alchemy Pay
 $ 0.03907152 + 1.37%
 Livepeer
 $ 7.69 + 1.93%
 MetisDAO
 $ 34.58 + 3.62%
 Wax
 $ 0.08210806 + 0.78%
 DigiByte
 $ 0.01158970 + 2.14%
 SafePal
 $ 0.53362798 + 1.75%
 Lisk
 $ 1.18 -1.29%
 Nervos Network
 $ 0.00505131 -3.92%
 SXP
 $ 0.33248426 + 4.38%
 Secret
 $ 0.88913115 + 6.82%
 Cartesi
 $ 0.16669052 + 1.80%
 iExec RLC
 $ 1.93 + 0.35%
 Smooth Love Potion
 $ 0.00333844 + 0.87%
 Voyager Token
 $ 0.43511293 -2.50%
 Syscoin
 $ 0.18887940 + 3.40%
 Nano
 $ 0.91534285 + 1.99%
 Numeraire
 $ 19.72 + 3.21%
 Civic
 $ 0.11929601 + 0.61%
 Spell Token
 $ 0.00084155 + 0.67%
 Aragon
 $ 2.76 -3.17%
 Augur
 $ 9.58 + 1.88%
 Keep Network
 $ 0.18754668 + 0.75%
 Chromia
 $ 0.17839374 + 1.50%
 COTI
 $ 0.08921493 + 1.90%
 Ren
 $ 0.09585749 + 3.20%
 Steem
 $ 0.23917722 -0.20%
 Bancor
 $ 0.48009206 + 1.42%
 Vulcan Forged PYR
 $ 3.80 + 4.30%
 XYO Network
 $ 0.00712000 + 1.39%
 MOBOX
 $ 0.55727327 + 2.01%
 WazirX
 $ 0.19457910 + 2.34%
 Joe
 $ 0.25442349 + 1.43%
 Request
 $ 0.11242291 + 1.61%
 Serum
 $ 0.33083910 + 5.55%
 NKN
 $ 0.12383635 + 1.70%
 Ampleforth Governance
 $ 4.44 + 1.33%
 Stormx
 $ 0.00701579 + 0.07%
 Storj
 $ 0.44408959 + 1.02%
 Sun Token
 $ 0.00707322 + 5.28%
 Yield Guild Games
 $ 0.32126155 + 2.80%
 Moonriver
 $ 10.36 + 3.91%
 Orchid
 $ 0.09747951 -0.27%
 Verge
 $ 0.00341402 + 3.60%
 Polkastarter
 $ 0.54108128 + 1.40%
 Alpaca Finance
 $ 0.33205865 + 7.26%
 Quickswap
 $ 107.88 -5.75%
 Index Chain
 $ 0.06360569 + 2.88%
 Raydium
 $ 0.28569046 + 1.91%
 Enzyme
 $ 25.45 -1.19%
 CLV
 $ 0.08225613 -0.18%
 JasmyCoin
 $ 0.00621957 + 1.11%
 Harvest Finance
 $ 41.82 + 0.62%
 district0x
 $ 0.03605808 -3.61%
 Samoyedcoin
 $ 0.00450462 -0.19%
 Kyber Network
 $ 0.89629147 -3.39%
 SuperRare
 $ 0.16267478 -0.26%
 Mirror Protocol
 $ 0.12771173 -0.33%
 Quantstamp
 $ 0.01635000 + 2.00%
 Star Atlas DAO
 $ 0.34773014 -2.50%
 SingularDTV
 $ 0.00040210 0.00%
 Tether
 $ 1.00 -0.04%
 USD Coin
 $ 1.00 -0.04%
 Dai
 $ 1.00 -0.13%
 Crypto Prices CoinDesk Market Index
 Markets

 The Math Behind the Bitcoin Protocol

 Looking under the hood of the bitcoin protocol helps give insight to the mathematical foundations of the digital currency.

 By Eric Rykwalder
 Oct 19, 2014 at 1:08 p.m. UTC
 Updated Sep 11, 2021 at 11:15 a.m. UTC


 Alex Thorn
 Head of Firmwide Research
 Galaxy
 Hear Alex Thorn share his take on "Bitcoin and Inflation: It’s Complicated” at Consensus 2023.
 Secure Your Seat


 Alex Thorn
 Head of Firmwide Research
 Galaxy
 Hear Alex Thorn share his take on "Bitcoin and Inflation: It’s Complicated” at Consensus 2023.
 Secure Your Seat


 Eric Rykwalder


 Alex Thorn
 Head of Firmwide Research
 Galaxy
 Hear Alex Thorn share his take on "Bitcoin and Inflation: It’s Complicated” at Consensus 2023.
 Secure Your Seat


 Alex Thorn
 Head of Firmwide Research
 Galaxy
 Hear Alex Thorn share his take on "Bitcoin and Inflation: It’s Complicated” at Consensus 2023.
 Secure Your Seat


 One reason bitcoin can be confusing for beginners is that the technology behind it redefines the concept of ownership.

 To own something in the traditional sense, be it a house or a sum of money, means either having personal custody of the thing or granting custody to a trusted entity such as a bank.

 Bitcoin Protocol

 With bitcoin the case is different. Bitcoins themselves are not stored either centrally or locally and so no one entity is their custodian. They exist as records on a distributed ledger called the block chain, copies of which are shared by a volunteer network of connected computers. To “own” a bitcoin simply means having the ability to transfer control of it to someone else by creating a record of the transfer in the block chain. What grants this ability? Access to an ECDSA private and public key pair. What does that mean and how does that secure bitcoin?

 Let’s have a look under the hood.

 ECDSA is short for Elliptic Curve Digital Signature Algorithm. It’s a process that uses an elliptic curve and a finite field to “sign” data in such a way that third parties can verify the authenticity of the signature while the signer retains the exclusive ability to create the signature. With bitcoin, the data that is signed is the transaction that transfers ownership.

 ECDSA has separate procedures for signing and verification. Each procedure is an algorithm composed of a few arithmetic operations. The signing algorithm makes use of the private key, and the verification process makes use of the public key. We will show an example of this later.

 But first, a crash course on elliptic curves and finite fields.

 Elliptic curves

 An elliptic curve is represented algebraically as an equation of the form:

 y2 = x3 + ax + b

 For a = 0 and b = 7 (the version used by bitcoin), it looks like this:

 math behind bitcoin

 Elliptic curves have useful properties. For example, a non-vertical line intersecting two non-tangent points on the curve will always intersect a third point on the curve. A further property is that a non-vertical line tangent to the curve at one point will intersect precisely one other point on the curve.

 We can use these properties to define two operations: point addition and point doubling.

 Point addition, P + Q = R, is defined as the reflection through the x-axis of the third intersecting point R’ on a line that includes P and Q. It’s easiest to understand this using a diagram:

 math behind bitcoin

 Similarly, point doubling, P + P = R is defined by finding the line tangent to the point to be doubled, P, and taking reflection through the x-axis of the intersecting point R’ on the curve to get R. Here’s an example of what that would look like:

 point doubling

 Together, these two operations are used for scalar multiplication, R = a P, defined by adding the point P to itself a times. For example:

 R = 7P

 R = P + (P + (P + (P + (P + (P + P)))))

 The process of scalar multiplication is normally simplified by using a combination of point addition and point doubling operations. For example:

 R = 7P

 R = P + 6P

 R = P + 2 (3P)

 R = P + 2 (P + 2P)

 Here, 7P has been broken down into two point doubling steps and two point addition steps.

 Finite fields

 A finite field, in the context of ECDSA, can be thought of as a predefined range of positive numbers within which every calculation must fall. Any number outside this range “wraps around” so as to fall within the range.

 The simplest way to think about this is calculating remainders, as represented by the modulus (mod) operator. For example, 9/7 gives 1 with a remainder of 2:

 9 mod 7 = 2

 Here our finite field is modulo 7, and all mod operations over this field yield a result falling within a range from 0 to 6.

 Putting it together

 ECDSA uses elliptic curves in the context of a finite field, which greatly changes their appearance but not their underlying equations or special properties. The same equation plotted above, in a finite field of modulo 67, looks like this:

 math behind bitcoin

 It’s now a set of points, in which all the x and y values are integers between 0 and 66. Note that the “curve” still retains its horizontal symmetry.

 Point addition and doubling are now slightly different visually. Lines drawn on this graph will wrap around the horizontal and vertical directions, just like in a game of Asteroids, maintaining the same slope. So adding points (2, 22) and (6, 25) looks like this:

 math behind bitcoin

 The third intersecting point is (47, 39) and its reflection point is (47, 28).

 Back to ECDSA and bitcoin

 A protocol such as bitcoin selects a set of parameters for the elliptic curve and its finite field representation that is fixed for all users of the protocol. The parameters include the equation used, the prime modulo of the field, and a base point that falls on the curve. The order of the base point, which is not independently selected but is a function of the other parameters, can be thought of graphically as the number of times the point can be added to itself until its slope is infinite, or a vertical line. The base point is selected such that the order is a large prime number.

 Bitcoin uses very large numbers for its base point, prime modulo, and order. In fact, all practical applications of ECDSA use enormous values. The security of the algorithm relies on these values being large, and therefore impractical to brute force or reverse engineer.

 In the case of bitcoin:

 Elliptic curve equation: y2 = x3 + 7

 Prime modulo = 2256 – 232 – 29 – 28 – 27 – 26 – 24 - 1 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F

 Base point = 04 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798 483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8

 Order = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141

 Who chose these numbers, and why? A great deal of research, and a fair amount of intrigue, surrounds the selection of appropriate parameters. After all, a large, seemingly random number could hide a backdoor method of reconstructing the private key. In brief, this particular realization goes by the name of secp256k1 and is part of a family of elliptic curve solutions over finite fields proposed for use in cryptography.

 Private keys and public keys

 With these formalities out of the way, we are now in a position to understand private and public keys and how they are related. Here it is in a nutshell: In ECDSA, the private key is an unpredictably chosen number between 1 and the order. The public key is derived from the private key by scalar multiplication of the base point a number of times equal to the value of the private key. Expressed as an equation:

 public key = private key * base point

 This shows that the maximum possible number of private keys (and thus bitcoin addresses) is equal to the order.

 In a continuous field we could plot the tangent line and pinpoint the public key on the graph, but there are some equations that accomplish the same thing in the context of finite fields. Point addition of p + q to find r is defined component-wise as follows:

 c = (qy - py) / (qx - px)

 rx = c2 - px - qx

 ry = c (px - rx) - py

 And point doubling of to find r is as follows:

 c = (3px2 + a) / 2py

 rx = c2 - 2px

 ry = c (px - rx) - py

 In practice, computation of the public key is broken down into a number of point doubling and point addition operations starting from the base point.

 Let’s run a back of the envelope example using small numbers, to get an intuition about how the keys are constructed and used in signing and verifying. The parameters we will use are:

 Equation: y2 = x3 + 7 (which is to say, a = 0 and b = 7)

 Prime Modulo: 67

 Base Point: (2, 22)

 Order: 79

 Private key: 2

 First, let’s find the public key. Since we have selected the simplest possible private key with value = 2, it will require only a single point doubling operation from the base point. The calculation looks like this:

 c = (3 * 22 + 0) / (2 * 22) mod 67

 c = (3 * 4) / (44) mod 67

 c = 12 / 44 mod 67

 Here we have to pause for a bit of sleight-of-hand: how do we perform division in the context of a finite field, where the result must always be an integer? We have to multiply by the inverse, which space does not permit us to define here (we refer you to here and here if interested). In the case at hand, you will have to trust us for the moment that:

 44-1 = 32

 Moving right along:

 c = 12 * 32 mod 67

 c = 384 mod 67

 c = 49

 rx = (492 - 2 * 2) mod 67

 rx = (2401 - 4) mod 67

 rx = 2397 mod 67

 rx = 52

 ry = (49 * (2 - 52) - 22) mod 67

 ry = (49 * (-50) - 22) mod 67

 ry = (-2450 - 22) mod 67

 ry = -2472 mod 67

 ry = 7

 Our public key thus corresponds to the point (52, 7). All that work for a private key of 2!

 This operation - going from private to public key - is computationally easy in comparison to trying to work backwards to deduce the private key from the public key, which while theoretically possible is computationally infeasible due to the large parameters used in actual elliptic cryptography.

 Therefore, going from the private key to the public key is by design a one-way trip.

 As with the private key, the public key is normally represented by a hexadecimal string. But wait, how do we get from a point on a plane, described by two numbers, to a single number? In an uncompressed public key the two 256-bit numbers representing the x and y coordinates are just stuck together in one long string. We can also take advantage of the symmetry of the elliptic curve to produce a compressed public key, by keeping just the x value and noting which half of the curve the point is on. From this partial information we can recover both coordinates.

 Signing data with the private key

 Now that we have a private and public key pair, let’s sign some data!

 The data can be of any length. The usual first step is to hash the data to generate a number containing the same number of bits (256) as the order of the curve. Here, for the sake of simplicity, we’ll skip the hashing step and just sign the raw data z. We’ll call G the base point, the order, and d the private key. The recipe for signing is as follows:

 1. Choose some integer k between 1 and n - 1.
 2. Calculate the point (x, y) = k * G, using scalar multiplication.
 3. Find r = x mod n. If r = 0, return to step 1.
 4. Find s = (z + r * d) / k mod n. If s = 0, return to step 1.
 5. The signature is the pair (r, s)

 As a reminder, in step 4, if the numbers result in a fraction (which in real life they almost always will), the numerator should be multiplied by the inverse of the denominator. In step 1, it is important that k not be repeated in different signatures and that it not be guessable by a third party. That is, k should either be random or generated by deterministic means that are kept secret from third parties. Otherwise it would be possible to extract the private key from step 4, since , z, r, k and are all known. You can read about a past exploit of this type here.

 Let’s pick our data to be the number 17, and follow the recipe. Our variables:

 z = 17 (data)

 n = 79 (order)

 G = (2, 22) (base point)

 d = 2 (private key)

 1. Pick a random number:

 k = rand(1, n - 1)

 k = rand(1, 79 - 1)

 k = 3 (is this really random? OK you got us, but it will make our example simpler!)

 1. Calculate the point. This is done in the same manner as determining the public key, but for brevity let’s omit the arithmetic for point addition and point doubling.

 (x, y) = 3G

 (x, y) = G + 2G

 (x, y) = (2, 22) + (52, 7)

 (x, y) = (62, 63)

 x = 62

 y = 63

 1. Find r:

 r = x mod n

 r = 62 mod 79

 r = 62

 1. Find :

 s = (z + r * d) / k mod n

 s = (17 + 62 * 2) / 3 mod 79

 s = (17 + 124) / 3 mod 79

 s = 141 / 3 mod 79

 s = 47 mod 79

 s = 47

 Note that above we were able to divide by 3 since the result was an integer. In real-life cases we would use the inverse of k (like before, we have hidden some gory details by computing it elsewhere):

 s = (z + r * d) / k mod n

 s = (17 + 62 * 2) / 3 mod 79

 s = (17 + 124) / 3 mod 79

 s = 141 / 3 mod 79

 s = 141 * 3-1 mod 79

 s = 141 * 53 mod 79

 s = 7473 mod 79

 s = 47

 1. Our signature is the pair (r, ) = (62, 47).

 As with the private and public keys, this signature is normally represented by a hexadecimal string.

 Verifying the signature with the public key

 We now have some data and a signature for that data. A third party who has our public key can receive our data and signature, and verify that we are the senders. Let’s see how this works.

 With Q being the public key and the other variables defined as before, the steps for verifying a signature are as follows:

 1. Verify that r and s are between 1 and n - 1.
 2. Calculate w = s-1 mod n
 3. Calculate u = z * w mod n
 4. Calculate v = r * w mod n
 5. Calculate the point (x, y) = uG + vQ
 6. Verify that r = x mod n. The signature is invalid if it is not.

 Why do these steps work? We are skipping the proof, but you can read the details here. Let’s follow the recipe and see how it works. Our variables, once again:

 z = 17 (data)

 (r, s) = (62, 47) (signature)

 n = 79 (order)

 G = (2, 22) (base point)

 Q = (52, 7) (public key)

 1. Verify that r and are between 1 and - 1. Check and check.

 r: 1 <= 62 < 79

 s: 1 <= 47 < 79

 1. Calculate w:

 w = s-1 mod n

 w = 47-1 mod 79

 w = 37

 1. Calculate u:

 u = zw mod n

 u = 17 * 37 mod 79

 u = 629 mod 79

 u = 76

 1. Calculate v:

 v = rw mod n

 v = 62 * 37 mod 79

 v = 2294 mod 79

 v = 3

 1. Calculate the point (x, y):

 (x, y) = uG + vQ

 Let’s break down the point doubling and addition in uG and vQ separately.

 uG = 76G

 uG = 2(38G)

 uG = 2( 2(19G) )

 uG = 2( 2(G + 18G) )

 uG = 2( 2(G + 2(9G) ) )

 uG = 2( 2(G + 2(G + 8G) ) )

 uG = 2( 2(G + 2(G + 2(4G) ) ) )

 uG = 2( 2(G + 2(G + 2( 2(2G) ) ) ) )

 Sit back for a moment to appreciate that by using the grouping trick we reduce 75 successive addition operations to just six operations of point doubling and two operations of point addition. These tricks will come in handy when the numbers get really large.

 Working our way from the inside out:

 uG = 2( 2(G + 2(G + 2( 2( 2(2, 22) ) ) ) ) )

 uG = 2( 2(G + 2(G + 2( 2(52, 7) ) ) ) )

 uG = 2( 2(G + 2(G + 2(25, 17) ) ) )

 uG = 2( 2(G + 2( (2, 22) + (21, 42) ) ) )

 uG = 2( 2(G + 2(13, 44) ) )

 uG = 2( 2( (2, 22) + (66, 26) ) )

 uG = 2( 2(38, 26) )

 uG = 2(27, 40)

 uG = (62, 4)

 And now for vQ:

 vQ = 3Q

 vQ = Q + 2Q

 vQ = Q + 2(52, 7)

 vQ = (52, 7) + (25, 17)

 vQ = (11, 20)

 Putting them together:

 (x, y) = uG + vQ

 (x, y) = (62, 4) + (11, 20)

 (x, y) = (62, 63)

 Clearly step 5 is the bulk of the work. For the final step,

 1. Verify that r = x mod n

 r = x mod n

 62 = 62 mod 79

 62 = 62

 Our signature is valid!

 Conclusion

 For those of you who saw all the equations and skipped to the bottom, what have we just learned?

 We have developed some intuition about the deep mathematical relationship that exists between public and private keys. We have seen how even in the simplest examples the math behind signatures and verification quickly gets complicated, and we can appreciate the enormous complexity which must be involved when the parameters involved are 256-bit numbers. We have seen how the clever application of the simplest mathematical procedures can create the one-way “trap door” functions necessary to preserve the information asymmetry which defines ownership of a bitcoin. And we have newfound confidence in the robustness of the system, provided that we carefully safeguard the knowledge of our private keys.

 In other words, this is why it is commonly said that bitcoin is “backed by math”.

 If you hung in through the complicated bits, we hope it gave you the confidence to take the next step and try out the math on your own (a modular arithmetic calculator makes the finite field math much easier). We found that going through the steps of signing and verifying data by hand provides a deeper understanding of the cryptography that enables bitcoin’s unique form of ownership.

 This article has been republished here with permission from the author. Originally published on Chain.com. The author gives special thanks to Steven Phelps for help with this article.

 Eric Rykwalder is a software engineer and one of Chain.com’s founders.

 BTC $ 23,542.50
 1.62%
 ETH $ 1,640.13
 2.64%
 BNB $ 308.09
 1.73%
 XRP $ 0.37619170
 0.62%
 APT $ 12.58
 1.09%
 View All Prices
 Sign up for First Mover, our daily newsletter putting the latest moves in crypto markets in context.
 Email address
 Sign Up
 By signing up, you will receive emails about CoinDesk product updates, events and marketing and you agree to our terms of services and privacy policy .

 DISCLOSURE

 Please note that our privacy policy, terms of use, cookies, and do not sell my personal information has been updated.

 The leader in news and information on cryptocurrency, digital assets and the future of money, CoinDesk is a media outlet that strives for the highest journalistic standards and abides by a strict set of editorial policies. CoinDesk is an independent operating subsidiary of Digital Currency Group, which invests in cryptocurrencies and blockchain startups. As part of their compensation, certain CoinDesk employees, including editorial employees, may receive exposure to DCG equity in the form of stock appreciation rights, which vest over a multi-year period. CoinDesk journalists are not allowed to purchase stock outright in DCG.

 Eric Rykwalder

 Learn more about Consensus 2023, CoinDesk’s longest-running and most influential event that brings together all sides of crypto, blockchain and Web3. Head to consensus.coindesk.com to register and buy your pass now.

 Eric Rykwalder

 Read more about
 Bitcoin Protocol Technology Bitcoin Cryptography Features Technology News Evergreen
 Trending
 1
 Markets
 First Mover Asia: Solana in the Green After Weekend Deep Freeze
 Feb 27, 2023
 2
 CoinDesk Indices
 How the Top 1% Covers Crypto
 Feb 26, 2023
 3
 CoinDesk Indices
 Award-Winning Wealth Advisor Confident about Clients Investing in Crypto
 Feb 26, 2023
 4
 The Breakdown, With NLW
 Central Bankers Triumphantly Declare Fiat to Have Beaten Crypto
 Feb 26, 2023

 About

 AboutMastheadContributorsCareersCompany News

 Stay Updated

 ConsensusNewslettersFollow

 Get In Touch

 Contact UsAdvertiseAccessibility HelpSitemap

 The Fine Print

 Ethics PolicyPrivacyTerms Of UseDo Not Sell My Personal Information

 Please note that our privacy policy, terms of use, cookies, and do not sell my personal information has been updated.

 The leader in news and information on cryptocurrency, digital assets and the future of money, CoinDesk is a media outlet that strives for the highest journalistic standards and abides by a strict set of editorial policies. CoinDesk is an independent operating subsidiary of Digital Currency Group, which invests in cryptocurrencies and blockchain startups. As part of their compensation, certain CoinDesk employees, including editorial employees, may receive exposure to DCG equity in the form of stock appreciation rights, which vest over a multi-year period. CoinDesk journalists are not allowed to purchase stock outright in DCG.

 ©2023 CoinDesk

 English
One reason bitcoin can be confusing for beginners is that the technology behind it redefines the concept of ownership.   To own something in the traditional sense, be it a house or a sum of money, means either having personal custody of the thing or granting custody to a trusted entity such as a bank.     Bitcoin Protocol     With bitcoin the case is different. Bitcoins themselves are not stored either centrally or locally and so no one entity is their custodian. They exist as records on a distributed ledger called the block chain, copies of which are shared by a volunteer network of connected computers. To “own” a bitcoin simply means having the ability to transfer control of it to someone else by creating a record of the transfer in the block chain. What grants this ability? Access to an ECDSA private and public key pair. What does that mean and how does that secure bitcoin?   Let’s have a look under the hood.     ECDSA  is short for Elliptic Curve Digital Signature Algorithm. It’s a process that uses an elliptic curve and a finite field to “sign” data in such a way that third parties can verify the authenticity of the signature while the signer retains the exclusive ability to create the signature. With bitcoin, the data that is signed is the transaction that transfers ownership.   ECDSA has separate procedures for signing and verification. Each procedure is an algorithm composed of a few arithmetic operations. The signing algorithm makes use of the private key, and the verification process makes use of the public key. We will show an example of this later.   But first, a crash course on elliptic curves and finite fields.     Elliptic curves     An elliptic curve is represented algebraically as an equation of the form:   For a = 0 and b = 7 (the version used by bitcoin), it looks like this:     math behind bitcoin     Elliptic curves have useful properties. For example, a non-vertical line intersecting two non-tangent points on the curve will always intersect a third point on the curve. A further property is that a non-vertical line tangent to the curve at one point will intersect precisely one other point on the curve.   We can use these properties to define two operations: point addition and point doubling.     Point addition , P + Q = R, is defined as the reflection through the x-axis of the third intersecting point R’ on a line that includes P and Q. It’s easiest to understand this using a diagram:     math behind bitcoin     Similarly,  point doubling , P + P = R is defined by finding the line tangent to the point to be doubled, P, and taking reflection through the x-axis of the intersecting point R’ on the curve to get R. Here’s an example of what that would look like:     point doubling     Together, these two operations are used for  scalar multiplication , R = a P, defined by adding the point P to itself a times. For example:   R = P + (P + (P + (P + (P + (P + P)))))   The process of scalar multiplication is normally simplified by using a combination of point addition and point doubling operations. For example:   Here, 7P has been broken down into two point doubling steps and two point addition steps.     Finite fields     A finite field, in the context of ECDSA, can be thought of as a predefined range of positive numbers within which every calculation must fall. Any number outside this range “wraps around” so as to fall within the range.   The simplest way to think about this is calculating remainders, as represented by the modulus (mod) operator. For example, 9/7 gives 1 with a remainder of 2:   Here our finite field is modulo 7, and all mod operations over this field yield a result falling within a range from 0 to 6.     Putting it together     ECDSA uses elliptic curves in the context of a finite field, which greatly changes their appearance but not their underlying equations or special properties. The same equation plotted above, in a finite field of modulo 67, looks like this:     math behind bitcoin     It’s now a set of points, in which all the x and y values are integers between 0 and 66. Note that the “curve” still retains its horizontal symmetry.   Point addition and doubling are now slightly different visually. Lines drawn on this graph will wrap around the horizontal and vertical directions, just like in a game of Asteroids, maintaining the same slope. So adding points (2, 22) and (6, 25) looks like this:     math behind bitcoin     The third intersecting point is (47, 39) and its reflection point is (47, 28).     Back to ECDSA and bitcoin     A protocol such as bitcoin selects a set of parameters for the elliptic curve and its finite field representation that is fixed for all users of the protocol. The parameters include the  equation  used, the  prime modulo  of the field, and a  base point  that falls on the curve. The  order  of the base point, which is not independently selected but is a function of the other parameters, can be thought of graphically as the number of times the point can be added to itself until its slope is infinite, or a vertical line. The base point is selected such that the order is a large prime number.   Bitcoin uses very large numbers for its base point, prime modulo, and order. In fact, all practical applications of ECDSA use enormous values. The security of the algorithm relies on these values being large, and therefore impractical to brute force or reverse engineer.   Elliptic curve equation: y2 = x3 + 7   Prime modulo = 2256 – 232 – 29 – 28 – 27 – 26 – 24 - 1 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F   Base point = 04 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798 483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8   Order = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141   Who chose these numbers, and why? A great deal of research, and a fair amount of intrigue, surrounds the selection of appropriate parameters. After all, a large, seemingly random number could hide a backdoor method of reconstructing the private key. In brief, this particular realization goes by the name of secp256k1 and is part of a family of elliptic curve solutions over finite fields proposed for use in cryptography.     Private keys and public keys     With these formalities out of the way, we are now in a position to understand private and public keys and how they are related. Here it is in a nutshell: In ECDSA, the private key is an unpredictably chosen number between 1 and the order. The public key is derived from the private key by scalar multiplication of the base point a number of times equal to the value of the private key. Expressed as an equation:   public key = private key * base point   This shows that the maximum possible number of private keys (and thus bitcoin addresses) is equal to the order.   In a continuous field we could plot the tangent line and pinpoint the public key on the graph, but there are some equations that accomplish the same thing in the context of finite fields. Point addition of p + q to find r is defined component-wise as follows:   c = (qy - py) / (qx - px)   And point doubling of to find r is as follows:   In practice, computation of the public key is broken down into a number of point doubling and point addition operations starting from the base point.   Let’s run a back of the envelope example using small numbers, to get an intuition about how the keys are constructed and used in signing and verifying. The parameters we will use are:   Equation: y2 = x3 + 7 (which is to say, a = 0 and b = 7)   First, let’s find the public key. Since we have selected the simplest possible private key with value = 2, it will require only a single point doubling operation from the base point. The calculation looks like this:   c = (3 * 22 + 0) / (2 * 22) mod 67   c = (3 * 4) / (44) mod 67   Here we have to pause for a bit of sleight-of-hand: how do we perform division in the context of a finite field, where the result must always be an integer? We have to multiply by the inverse, which space does not permit us to define here (we refer you to here and here if interested). In the case at hand, you will have to trust us for the moment that:   rx = (492 - 2 * 2) mod 67   ry = (49 * (2 - 52) - 22) mod 67   ry = (49 * (-50) - 22) mod 67   Our public key thus corresponds to the point (52, 7). All that work for a private key of 2!   This operation - going from private to public key - is computationally easy in comparison to trying to work backwards to deduce the private key from the public key, which while theoretically possible is computationally infeasible due to the large parameters used in actual elliptic cryptography.   Therefore, going from the private key to the public key is by design a one-way trip.   As with the private key, the public key is normally represented by a hexadecimal string. But wait, how do we get from a point on a plane, described by two numbers, to a single number? In an uncompressed public key the two 256-bit numbers representing the x and y coordinates are just stuck together in one long string. We can also take advantage of the symmetry of the elliptic curve to produce a compressed public key, by keeping just the x value and noting which half of the curve the point is on. From this partial information we can recover both coordinates.     Signing data with the private key     Now that we have a private and public key pair, let’s sign some data!   The data can be of any length. The usual first step is to hash the data to generate a number containing the same number of bits (256) as the order of the curve. Here, for the sake of simplicity, we’ll skip the hashing step and just sign the raw data z. We’ll call G the base point, the order, and d the private key. The recipe for signing is as follows:     Choose some integer k between 1 and n - 1.   Calculate the point (x, y) = k * G, using scalar multiplication.   Find r = x mod n. If r = 0, return to step 1.   Find s = (z + r * d) / k mod n. If s = 0, return to step 1.   The signature is the pair (r, s)     As a reminder, in step 4, if the numbers result in a fraction (which in real life they almost always will), the numerator should be multiplied by the inverse of the denominator. In step 1, it is important that k not be repeated in different signatures and that it not be guessable by a third party. That is, k should either be random or generated by deterministic means that are kept secret from third parties. Otherwise it would be possible to extract the private key from step 4, since , z, r, k and are all known. You can read about a past exploit of this type here.   Let’s pick our data to be the number 17, and follow the recipe. Our variables:     Pick a random number:     k = 3 (is this really random? OK you got us, but it will make our example simpler!)    Calculate the point. This is done in the same manner as determining the public key, but for brevity let’s omit the arithmetic for point addition and point doubling.    (x, y) = (2, 22) + (52, 7)    Find r:     Find :    s = (z + r * d) / k mod n   s = (17 + 62 * 2) / 3 mod 79   s = (17 + 124) / 3 mod 79   Note that above we were able to divide by 3 since the result was an integer. In real-life cases we would use the inverse of k (like before, we have hidden some gory details by computing it elsewhere):   s = (z + r * d) / k mod n   s = (17 + 62 * 2) / 3 mod 79   s = (17 + 124) / 3 mod 79    Our signature is the pair (r, ) = (62, 47).    As with the private and public keys, this signature is normally represented by a hexadecimal string.     Verifying the signature with the public key     We now have some data and a signature for that data. A third party who has our public key can receive our data and signature, and verify that we are the senders. Let’s see how this works.   With Q being the public key and the other variables defined as before, the steps for verifying a signature are as follows:     Verify that r and s are between 1 and n - 1.   Calculate w = s-1 mod n   Calculate u = z * w mod n   Calculate v = r * w mod n   Calculate the point (x, y) = uG + vQ   Verify that r = x mod n. The signature is invalid if it is not.     Why do these steps work? We are skipping the proof, but you can read the details here. Let’s follow the recipe and see how it works. Our variables, once again:   (r, s) = (62, 47) (signature)     Verify that r and are between 1 and - 1. Check and check.      Calculate w:     Calculate u:     Calculate v:     Calculate the point (x, y):    Let’s break down the point doubling and addition in uG and vQ separately.   uG = 2( 2(G + 2(G + 8G) ) )   uG = 2( 2(G + 2(G + 2(4G) ) ) )   uG = 2( 2(G + 2(G + 2( 2(2G) ) ) ) )   Sit back for a moment to appreciate that by using the grouping trick we reduce 75 successive addition operations to just six operations of point doubling and two operations of point addition. These tricks will come in handy when the numbers get really large.   Working our way from the inside out:   uG = 2( 2(G + 2(G + 2( 2( 2(2, 22) ) ) ) ) )   uG = 2( 2(G + 2(G + 2( 2(52, 7) ) ) ) )   uG = 2( 2(G + 2(G + 2(25, 17) ) ) )   uG = 2( 2(G + 2( (2, 22) + (21, 42) ) ) )   uG = 2( 2(G + 2(13, 44) ) )   uG = 2( 2( (2, 22) + (66, 26) ) )   (x, y) = (62, 4) + (11, 20)   Clearly step 5 is the bulk of the work. For the final step,    Verify that r = x mod n      Conclusion     For those of you who saw all the equations and skipped to the bottom, what have we just learned?   We have developed some intuition about the deep mathematical relationship that exists between public and private keys. We have seen how even in the simplest examples the math behind signatures and verification quickly gets complicated, and we can appreciate the enormous complexity which must be involved when the parameters involved are 256-bit numbers. We have seen how the clever application of the simplest mathematical procedures can create the one-way “trap door” functions necessary to preserve the information asymmetry which defines ownership of a bitcoin. And we have newfound confidence in the robustness of the system, provided that we carefully safeguard the knowledge of our private keys.   In other words, this is why it is commonly said that bitcoin is “backed by math”.   If you hung in through the complicated bits, we hope it gave you the confidence to take the next step and try out the math on your own (a modular arithmetic calculator makes the finite field math much easier). We found that going through the steps of signing and verifying data by hand provides a deeper understanding of the cryptography that enables bitcoin’s unique form of ownership.    This article has been republished here with permission from the author. Originally published on Chain.com. The author gives s pecial thanks to Steven Phelps for help with this article.      Eric Rykwalder is a software engineer and one of Chain.com’s founders.
The Math Behind the Bitcoin Protocol
https://www.coindesk.com/markets/2014/10/19/the-math-behind-the-bitcoin-protocol/
https://medium.com/swlh/the-mathematics-of-bitcoin-89e7ab59edc
The Mathematics of Bitcoin — The Blockchain
2020-05-26
Toby Chitty
<div><div><article><div><p></p><h2>Part 1 &amp; 2 of a series looking behind the scenes of the worlds most popular cryptocurrency</h2><p></p><figure><figcaption>Photo by <a href="https://unsplash.com/@harrisonkugler?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Harrison Kugler</a> on <a href="https://unsplash.com/s/photos/crypto?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h2>1— What is a cryptocurrency?</h2><p>Cryptocurrencies are <strong>digital-based currencies</strong> that use cryptographic techniques to regulate the generation of currency and verify the transfer of funds; <strong>without the</strong>…</p></div></article></div>||||I|||| Published in

 The Startup

 Toby Chitty
 Follow

 May 25, 2020

 ·
 10 min read
 ·

 Member-only

 The Mathematics of Bitcoin — The Blockchain

 Part 1 & 2 of a series looking behind the scenes of the worlds most popular cryptocurrency

 Photo by Harrison Kugler on Unsplash

 1— What is a cryptocurrency?

 Cryptocurrencies are digital-based currencies that use cryptographic techniques to regulate the generation of currency and verify the transfer of funds; without the…

 --

 --

 2

 More from The Startup

 Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +760K followers.

 Read more from The Startup

 AboutHelpTermsPrivacy

 Get the Medium app

 Get unlimited access

 Toby Chitty

 119 Followers

 Software Developer

 Follow

 Help

 Status

 Writers

 Blog

 Careers

 Privacy

 Terms

 About

 Text to speech

Part 1 &amp; 2 of a series looking behind the scenes of the worlds most popular cryptocurrency    Photo by Harrison Kugler on Unsplash   1— What is a cryptocurrency? Cryptocurrencies are digital-based currencies that use cryptographic techniques to regulate the generation of currency and verify the transfer of funds; without the…
The Mathematics of Bitcoin — The Blockchain
https://medium.com/swlh/the-mathematics-of-bitcoin-89e7ab59edc
https://medium.com/swlh/bitcoin-halving-everything-you-need-to-know-4573dc5b528e
Bitcoin Halving — Everything You Need to Know
2019-09-06
Rekt Capital
<div><div><article><div><p>The amount of Bitcoin that gets created every 10 minutes gets cut in half every four years.</p><p>This is known as the <strong>Bitcoin Halving</strong>. The next Halving will be Bitcoin’s third and will take place in May 2020. This is when the current block reward of 12.5 Bitcoin every 10 minutes will be cut in half to 6.25 Bitcoin.</p><p>Seeing as the maximum supply cap for Bitcoin is 21 million, halving the block reward means that it will take longer for all Bitcoin to enter circulation.</p></div></article></div>||||I|||| Published in

 The Startup

 Rekt Capital
 Follow

 Sep 6, 2019

 ·
 12 min read
 ·

 Member-only

 Bitcoin Halving — Everything You Need to Know

 The amount of Bitcoin that gets created every 10 minutes gets cut in half every four years.

 This is known as the Bitcoin Halving. The next Halving will be Bitcoin’s third and will take place in May 2020. This is when the current block reward of 12.5 Bitcoin every 10 minutes will be cut in half to 6.25 Bitcoin.

 Seeing as the maximum supply cap for Bitcoin is 21 million, halving the block reward means that it will take longer for all Bitcoin to enter circulation.

 --

 --

 18

 More from The Startup

 Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +768K followers.

 Read more from The Startup

 AboutHelpTermsPrivacy

 Get the Medium app

 Get unlimited access

 Rekt Capital

 1.4K Followers

 Cryptocurrency trader and analyst. I share insights about Bitcoin, the cryptocurrency market, and human psychology.

 Follow

 Help

 Status

 Writers

 Blog

 Careers

 Privacy

 Terms

 About

 Text to speech

The amount of Bitcoin that gets created every 10 minutes gets cut in half every four years. This is known as the Bitcoin Halving. The next Halving will be Bitcoin’s third and will take place in May 2020. This is when the current block reward of 12.5 Bitcoin every 10 minutes will be cut in half to 6.25 Bitcoin. Seeing as the maximum supply cap for Bitcoin is 21 million, halving the block reward means that it will take longer for all Bitcoin to enter circulation.
Bitcoin Halving — Everything You Need to Know
https://medium.com/swlh/bitcoin-halving-everything-you-need-to-know-4573dc5b528e
https://braiins.com/blog/bitcoin-mining-analogy-beginners-guide
Bitcoin Mining is NOT Solving Complex Math Problems [Beginner's Guide] | Braiins
2021-04-14
None
<div><div><p>Most people misunderstand what bitcoin miners actually do, and as a result they don't fully grasp the level of security provided by bitcoin's hashrate. In this article, we'll explain proof of work in a non-technical way so that youâll be able to counter the misinformation about supercomputers and <a href="https://braiins.com/blog/can-quantum-computers-51-attack-bitcoin">quantum computers</a> attacking the Bitcoin network in the future.Â </p><p>Simply put, mining is a lottery to create new blocks in the Bitcoin blockchain. There are two main purposes for mining:</p><ol><li>To permanently add transactions to the blockchain without the permission of any entity.</li><li>To fairly distribute the 21 million bitcoin supply by rewarding new coins to miners who spend real world resources (i.e. electricity) to secure the network.</li></ol><p>To understand what is actually happening in this lottery system, let's look at a simple analogy where every Bitcoin hash is equivalent to a dice roll.</p><h2>Luck, Gambling, and SHA256</h2><p>Imagine that miners in the Bitcoin Network are all individuals gambling at a casino. In this example, each of these gamblers have a 1000 sided dice. They roll their die as quickly as possible, trying to get a number less than 10. Statistically, this may take a very long time, but as more gamblers join the game, the time it takes to hit a number less than 10 gets reduced. In short, more gamblers equals quicker rounds.</p><p>Once somebody successfully rolls a number less than 10, all gamblers at the table can look down and verify the number. This lucky gambler takes the prize money and the next round begins.</p><figure><p></p></figure><p>Ultimately, the process of mining bitcoin is very similar. All miners on the network are using Application Specific Integrated Circuits (ASICs), which are specialized computers designed to compute hashes as quickly as possible. To âcompute a hashâ simply means plugging any random input into a mathematical function and producing an output.</p><p>More hashes per second (i.e. higher hashrate) is equivalent to more dice rolls per second, and thus a greater probability of success. Miners propose a potential Bitcoin block of transactions, and use this for an input. The block is plugged into the <a href="https://emn178.github.io/online-tools/sha256.html">SHA256</a> hash function which yields a fixed-sized output, known as a hash. A single hash can be computed in less than a millisecond, as it involves no complex math.</p><p>If the hash value is lower than the Bitcoin Network difficulty, then the miner who proposed the block wins. If not, then the miner continues trying by computing more hashes. The successful minerâs block is then added to the blockchain, the miner is rewarded with newly issued bitcoin for their work, and the ânext roundâ begins.</p><figure><p></p></figure><h2>ASICs vs Supercomputers</h2><p>Assigning the most powerful supercomputer to mine bitcoin would be comparable to hiring a grandmaster chess player to move a pile of bricks by hand. The job would get done eventually but the chess player is much better at thinking and playing chess than exerting energy to repetitively move bricks.Â </p><p>Likewise, combining the computing power of the most powerful supercomputers in the world and using them to mine bitcoin would essentially be pointless when compared to the ASIC machines used today. ASICs are designed to do one thing as quickly and efficiently as possible, whereas a supercomputer is designed to do complicated tasks or math problems. Since Bitcoin mining is a lottery based on random trial and error rather than complex math, specialization (ASICs) beats general excellence (supercomputers) everytime.</p><p>Network Difficulty and 10-Minute Block Times</p><p>Now that you understand the randomness of miners finding a block, it is important to understand block times and difficulty. In our gambling example, imagine that anybody can join or leave the table at any time. If one person is rolling a 1000 sided die trying to get less than a 10 it will take them an average of 10 minutes to hit that number. Sometimes theyâll hit in 1 minute, other times it might take them 30.</p><p>If a new person steps up to the table and starts rolling, collectively it will take them an average of 5 minutes for somebody to win the round. If 20 people step up to the table, this time is significantly shortened. In order to keep the game interesting we want to average a winner every 10 minutes. To do this, we can simply adjust the dice target. As additional gamblers step up to the table, the rules will change (e.g. gamblers must now roll a number less than 5 to win) so that the average remains 10 minutes per round. As more gamblers join, the casino makes winning harder. If gamblers leave, they make it easier.</p><figure><p></p></figure><p>This is exactly how the Bitcoin network regulates mining to maintain a steady issuance schedule of new BTC. Miners compute hashes below the target difficulty every 10 minutes on average. Every 2016 blocks (~2 weeks) the average for those blocks is calculated and the difficulty is adjusted to bring block times back to 10 minutes. If more miners join the network in this ~2 week period, the hashrate and difficulty will increase as a result.Â </p><p>Note: Nobody knows exactly why these arbitrary numbers were chosen. That said, itâs important that 10 minutes is long enough for miners and nodes to pass information around the world without internet speeds causing significant issues, and 2016 blocks is long enough to get a statistically accurate block time needed for the difficulty adjustment.</p><h2>Truly Transparent Supply</h2><p>The difficulty adjustments described above make Bitcoin the only asset with a truly fixed and known supply schedule. Since inception, weâve known two things:</p><ol><li>There will never be more than 21 million coins.Â </li><li>Every 10 minutes more bitcoin is newly issued as we approach that 21 million number.Â </li></ol><p>In every other industry, (gold, auto, or even sandwich bags) the supply fluctuates based on demand. If demand increases for automobiles, then the manufacturer can increase production to match the demand. In Bitcoin, supply is locked in and cannot change, therefore demand and price are tied more closely than any other industry or asset classes. This sounds very cut and dry, but it gets interesting when you try to understand <a href="https://braiins.com/blog/when-and-why-bitcoin-miners-sell-btc">what miners do with their newly issued coins</a> and the impact this has on the market.Â </p><h2>Mining in 2021</h2><p>At the time of writing this article (04/14/2021), more than 89% of the total 21 million coins have been issued. Currently 6.25 BTC are added to the supply every block.Â </p><p>On this date, the price has increased dramatically compared to the growth in network hashrate. This means that price is going up faster than mining difficulty, and thus the revenue that miners are earning per unit of hashpower (i.e. BTC/TH) is increasing.Â </p><p>Additionally, there is a semiconductor shortage that is making it difficult for mining manufacturers to secure chips and make new ASICs. This combination of factors is making it so that even old generation ASICs can profitably mine bitcoin, which is great for all miners including hobbyists and home miners who cannot easily secure competitive electricity costs . Pairing this with our <a href="https://braiins.com/blog/autotuning-the-best-thing-for-bitcoin-miners-since-asicboost">Braiins OS+ firmware</a>, one can further increase the profitability of older ASICs like the Antminer S9 by optimizing performance and efficiency.<br /></p></div>||||I|||| By clicking âAcceptâ, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.
 DenyAccept
 Braiins.comBraiins PoolFarm Proxy Braiins OS+Stratum V2Mining Insights
 More
 Braiins OS+StratumÂ V2Mining Insights
 Help Center
 en
 CZesRUä¸­æFA
 Home
 Blog
 Careers
 Story
 SHOP
 bonds
 KNIHY
 Merch
 More
 Legacy V1betterHash
 We apologize but our blog is available only in English, Spanish and Russian.
 Home
 Blog
 Careers
 Our Story
 Shop
 Bonds
 Knihy
 Braiins Product Stack
 en
 esRUä¸­æFA
 Bitcoin Mining Insights

 Bitcoin Mining is NOT Solving Complex Math Problems [Beginner's Guide]

 Bitcoin mining and difficulty adjustments explained in non-technical terms using a simple dice analogy.

 Published on Apr 14, 2021
 START READING
 Published on Apr 14, 2021

 Table of Contents

 Most people misunderstand what bitcoin miners actually do, and as a result they don't fully grasp the level of security provided by bitcoin's hashrate. In this article, we'll explain proof of work in a non-technical way so that youâll be able to counter the misinformation about supercomputers and quantum computers attacking the Bitcoin network in the future.Â

 Simply put, mining is a lottery to create new blocks in the Bitcoin blockchain. There are two main purposes for mining:

 1. To permanently add transactions to the blockchain without the permission of any entity.
 2. To fairly distribute the 21 million bitcoin supply by rewarding new coins to miners who spend real world resources (i.e. electricity) to secure the network.

 To understand what is actually happening in this lottery system, let's look at a simple analogy where every Bitcoin hash is equivalent to a dice roll.

 Luck, Gambling, and SHA256

 Imagine that miners in the Bitcoin Network are all individuals gambling at a casino. In this example, each of these gamblers have a 1000 sided dice. They roll their die as quickly as possible, trying to get a number less than 10. Statistically, this may take a very long time, but as more gamblers join the game, the time it takes to hit a number less than 10 gets reduced. In short, more gamblers equals quicker rounds.

 Once somebody successfully rolls a number less than 10, all gamblers at the table can look down and verify the number. This lucky gambler takes the prize money and the next round begins.



 Ultimately, the process of mining bitcoin is very similar. All miners on the network are using Application Specific Integrated Circuits (ASICs), which are specialized computers designed to compute hashes as quickly as possible. To âcompute a hashâ simply means plugging any random input into a mathematical function and producing an output.

 More hashes per second (i.e. higher hashrate) is equivalent to more dice rolls per second, and thus a greater probability of success. Miners propose a potential Bitcoin block of transactions, and use this for an input. The block is plugged into the SHA256 hash function which yields a fixed-sized output, known as a hash. A single hash can be computed in less than a millisecond, as it involves no complex math.

 If the hash value is lower than the Bitcoin Network difficulty, then the miner who proposed the block wins. If not, then the miner continues trying by computing more hashes. The successful minerâs block is then added to the blockchain, the miner is rewarded with newly issued bitcoin for their work, and the ânext roundâ begins.



 ASICs vs Supercomputers

 Assigning the most powerful supercomputer to mine bitcoin would be comparable to hiring a grandmaster chess player to move a pile of bricks by hand. The job would get done eventually but the chess player is much better at thinking and playing chess than exerting energy to repetitively move bricks.Â

 Likewise, combining the computing power of the most powerful supercomputers in the world and using them to mine bitcoin would essentially be pointless when compared to the ASIC machines used today. ASICs are designed to do one thing as quickly and efficiently as possible, whereas a supercomputer is designed to do complicated tasks or math problems. Since Bitcoin mining is a lottery based on random trial and error rather than complex math, specialization (ASICs) beats general excellence (supercomputers) everytime.

 Network Difficulty and 10-Minute Block Times

 Now that you understand the randomness of miners finding a block, it is important to understand block times and difficulty. In our gambling example, imagine that anybody can join or leave the table at any time. If one person is rolling a 1000 sided die trying to get less than a 10 it will take them an average of 10 minutes to hit that number. Sometimes theyâll hit in 1 minute, other times it might take them 30.

 If a new person steps up to the table and starts rolling, collectively it will take them an average of 5 minutes for somebody to win the round. If 20 people step up to the table, this time is significantly shortened. In order to keep the game interesting we want to average a winner every 10 minutes. To do this, we can simply adjust the dice target. As additional gamblers step up to the table, the rules will change (e.g. gamblers must now roll a number less than 5 to win) so that the average remains 10 minutes per round. As more gamblers join, the casino makes winning harder. If gamblers leave, they make it easier.

 This is exactly how the Bitcoin network regulates mining to maintain a steady issuance schedule of new BTC. Miners compute hashes below the target difficulty every 10 minutes on average. Every 2016 blocks (~2 weeks) the average for those blocks is calculated and the difficulty is adjusted to bring block times back to 10 minutes. If more miners join the network in this ~2 week period, the hashrate and difficulty will increase as a result.Â

 Note: Nobody knows exactly why these arbitrary numbers were chosen. That said, itâs important that 10 minutes is long enough for miners and nodes to pass information around the world without internet speeds causing significant issues, and 2016 blocks is long enough to get a statistically accurate block time needed for the difficulty adjustment.

 Truly Transparent Supply

 The difficulty adjustments described above make Bitcoin the only asset with a truly fixed and known supply schedule. Since inception, weâve known two things:

 1. There will never be more than 21 million coins.Â
 2. Every 10 minutes more bitcoin is newly issued as we approach that 21 million number.Â

 In every other industry, (gold, auto, or even sandwich bags) the supply fluctuates based on demand. If demand increases for automobiles, then the manufacturer can increase production to match the demand. In Bitcoin, supply is locked in and cannot change, therefore demand and price are tied more closely than any other industry or asset classes. This sounds very cut and dry, but it gets interesting when you try to understand what miners do with their newly issued coins and the impact this has on the market.Â

 Mining in 2021

 At the time of writing this article (04/14/2021), more than 89% of the total 21 million coins have been issued. Currently 6.25 BTC are added to the supply every block.Â

 On this date, the price has increased dramatically compared to the growth in network hashrate. This means that price is going up faster than mining difficulty, and thus the revenue that miners are earning per unit of hashpower (i.e. BTC/TH) is increasing.Â

 Additionally, there is a semiconductor shortage that is making it difficult for mining manufacturers to secure chips and make new ASICs. This combination of factors is making it so that even old generation ASICs can profitably mine bitcoin, which is great for all miners including hobbyists and home miners who cannot easily secure competitive electricity costs . Pairing this with our Braiins OS+ firmware, one can further increase the profitability of older ASICs like the Antminer S9 by optimizing performance and efficiency.

 You can view the changelog also in our documentation.
 See the full changelog

 Get notified when we release new update

 By subscribing you are agreeing to our Privacy Policy
 Wohoo! You're subscribed, we'll be in touch soon.
 Something went wrong. Please try again.
 No items found.
 EXPLORE BRAIINS OS+

 Get notified when we release new update

 By subscribing you are agreeing to our Privacy Policy
 Wohoo! You're subscribed, we'll be in touch soon.
 Something went wrong. Please try again.
 Share now

 AboutÂ Braiins

 Bitcoin mining software company: Braiins Pool, Braiins OS+ & Stratum V2.

 By miners, for miners.

 Braiins full product stack

 Autotuning
 mining firmware

 Increase hashrate on your Bitcoin ASICs, improve efficiency as much as 25%, and mine on any pool or get 0% pool fees on Braiins Pool.

 Discover more
 Hashrate
 Aggregation Proxy

 Reduce data transmission between your farm and pool by 95%. Configure parallel usage of multiple pools. Set a backup pool for the whole farm.

 Discover more
 Next generation protocol
 for pooled mining

 It focuses on making data transfers more efficient, reducing physical infrastructure requirements for mining operations, and increasing security

 Discover more
 Worldâs first
 mining pool

 Industry leaders in transparency and innovation, with more than 1.25 million BTC mined since 2010.

 Discover more

 Still scrolling?
 Keep reading!

 Braiins Acquired Remaining Stake in Braiins Pool, Slush Focusing on SatoshiLabs
 Product Updates
 Hashrate Target - new ASIC firmware feature
 Bitcoin Mining Insights
 Optimizations for Bitcoin Mining with Intermittent Energy Sources
 Bitcoin Mining Insights
 PRODUCTS
 Braiins PoolBraiins OS+Farm ProxyStratumÂ V2
 About
 Product UpdatesBraiins StoryBlogBraiins Design Language
 Legal
 Privacy Policy
 Cookie Policy
 Contact
 Bitcoin mining tools.
 Pushing the industry forward with a full-stack mining solution from mining firmware up to the pool.
 Braiins.comSlush PoolBraiins OS+Farm Proxy NEWStratum V2Mining InsightsMining Insignts
Most people misunderstand what bitcoin miners actually do, and as a result they don't fully grasp the level of security provided by bitcoin's hashrate. In this article, we'll explain proof of work in a non-technical way so that youâll be able to counter the misinformation about supercomputers and quantum computers attacking the Bitcoin network in the future.Â  Simply put, mining is a lottery to create new blocks in the Bitcoin blockchain. There are two main purposes for mining:  To permanently add transactions to the blockchain without the permission of any entity. To fairly distribute the 21 million bitcoin supply by rewarding new coins to miners who spend real world resources (i.e. electricity) to secure the network.  To understand what is actually happening in this lottery system, let's look at a simple analogy where every Bitcoin hash is equivalent to a dice roll. Luck, Gambling, and SHA256 Imagine that miners in the Bitcoin Network are all individuals gambling at a casino. In this example, each of these gamblers have a 1000 sided dice. They roll their die as quickly as possible, trying to get a number less than 10. Statistically, this may take a very long time, but as more gamblers join the game, the time it takes to hit a number less than 10 gets reduced. In short, more gamblers equals quicker rounds. Once somebody successfully rolls a number less than 10, all gamblers at the table can look down and verify the number. This lucky gambler takes the prize money and the next round begins.     Ultimately, the process of mining bitcoin is very similar. All miners on the network are using Application Specific Integrated Circuits (ASICs), which are specialized computers designed to compute hashes as quickly as possible. To âcompute a hashâ simply means plugging any random input into a mathematical function and producing an output. More hashes per second (i.e. higher hashrate) is equivalent to more dice rolls per second, and thus a greater probability of success. Miners propose a potential Bitcoin block of transactions, and use this for an input. The block is plugged into the SHA256 hash function which yields a fixed-sized output, known as a hash. A single hash can be computed in less than a millisecond, as it involves no complex math. If the hash value is lower than the Bitcoin Network difficulty, then the miner who proposed the block wins. If not, then the miner continues trying by computing more hashes. The successful minerâs block is then added to the blockchain, the miner is rewarded with newly issued bitcoin for their work, and the ânext roundâ begins.     ASICs vs Supercomputers Assigning the most powerful supercomputer to mine bitcoin would be comparable to hiring a grandmaster chess player to move a pile of bricks by hand. The job would get done eventually but the chess player is much better at thinking and playing chess than exerting energy to repetitively move bricks.Â  Likewise, combining the computing power of the most powerful supercomputers in the world and using them to mine bitcoin would essentially be pointless when compared to the ASIC machines used today. ASICs are designed to do one thing as quickly and efficiently as possible, whereas a supercomputer is designed to do complicated tasks or math problems. Since Bitcoin mining is a lottery based on random trial and error rather than complex math, specialization (ASICs) beats general excellence (supercomputers) everytime. Network Difficulty and 10-Minute Block Times Now that you understand the randomness of miners finding a block, it is important to understand block times and difficulty. In our gambling example, imagine that anybody can join or leave the table at any time. If one person is rolling a 1000 sided die trying to get less than a 10 it will take them an average of 10 minutes to hit that number. Sometimes theyâll hit in 1 minute, other times it might take them 30. If a new person steps up to the table and starts rolling, collectively it will take them an average of 5 minutes for somebody to win the round. If 20 people step up to the table, this time is significantly shortened. In order to keep the game interesting we want to average a winner every 10 minutes. To do this, we can simply adjust the dice target. As additional gamblers step up to the table, the rules will change (e.g. gamblers must now roll a number less than 5 to win) so that the average remains 10 minutes per round. As more gamblers join, the casino makes winning harder. If gamblers leave, they make it easier.     This is exactly how the Bitcoin network regulates mining to maintain a steady issuance schedule of new BTC. Miners compute hashes below the target difficulty every 10 minutes on average. Every 2016 blocks (~2 weeks) the average for those blocks is calculated and the difficulty is adjusted to bring block times back to 10 minutes. If more miners join the network in this ~2 week period, the hashrate and difficulty will increase as a result.Â  Note: Nobody knows exactly why these arbitrary numbers were chosen. That said, itâs important that 10 minutes is long enough for miners and nodes to pass information around the world without internet speeds causing significant issues, and 2016 blocks is long enough to get a statistically accurate block time needed for the difficulty adjustment. Truly Transparent Supply The difficulty adjustments described above make Bitcoin the only asset with a truly fixed and known supply schedule. Since inception, weâve known two things:  There will never be more than 21 million coins.Â  Every 10 minutes more bitcoin is newly issued as we approach that 21 million number.Â   In every other industry, (gold, auto, or even sandwich bags) the supply fluctuates based on demand. If demand increases for automobiles, then the manufacturer can increase production to match the demand. In Bitcoin, supply is locked in and cannot change, therefore demand and price are tied more closely than any other industry or asset classes. This sounds very cut and dry, but it gets interesting when you try to understand what miners do with their newly issued coins and the impact this has on the market.Â  Mining in 2021 At the time of writing this article (04/14/2021), more than 89% of the total 21 million coins have been issued. Currently 6.25 BTC are added to the supply every block.Â  On this date, the price has increased dramatically compared to the growth in network hashrate. This means that price is going up faster than mining difficulty, and thus the revenue that miners are earning per unit of hashpower (i.e. BTC/TH) is increasing.Â  Additionally, there is a semiconductor shortage that is making it difficult for mining manufacturers to secure chips and make new ASICs. This combination of factors is making it so that even old generation ASICs can profitably mine bitcoin, which is great for all miners including hobbyists and home miners who cannot easily secure competitive electricity costs . Pairing this with our Braiins OS+ firmware, one can further increase the profitability of older ASICs like the Antminer S9 by optimizing performance and efficiency.
Bitcoin Mining is NOT Solving Complex Math Problems [Beginner's Guide] | Braiins
https://braiins.com/blog/bitcoin-mining-analogy-beginners-guide
https://blog.programster.org/bitcoins-mathematical-problem
Programster's Blog
2021-12-08
None
<div><div>
 <h2>Bitcoin's Mathematical Problem</h2>
 
 <h2>Introduction</h2>
<p>How "mining" works is at the very heart of Bitcoin. It is often <a href="https://www.youtube.com/watch?v=vDXlWGrynHo&amp;t=0m24s">brushed over and simply referred to as "complicated math" in the media</a>, but it's actually quite simple to understand even if it is computationally intensive to solve.</p>
<h3>Disclaimer</h3>
<p>Most of the content in this post comes from <a href="https://www.reddit.com/r/BitcoinBeginners/comments/22b0xa/what_is_it_exactly_that_miners_work_on_why_does/cglbjtw">a post on Reddit</a> that I have edited, reformatted, and elaborated on. Feel free to read the original post if you prefer.</p>
<h2>Hashes</h2>
<p>Understanding hashes is the first step in understanding mining. A hash will take an input of any length, and generate is seemingly randomised output of a specific length. The same input will always generate the same output, but changing just one character will drastically change the output. For example, <code>a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447</code> is the hash of <code>hello world</code>, and <code>30e731839774de9ea08ff1adb8aa6b638e05f64900d005f84aea563cab0092b5</code> is the hash of <code>hello worle</code>.</p>
<p>This behaviour makes it very difficult to predict what input gives a particular output. For example, what input gives <code>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</code> as a hash? It's effectively impossible to work it out. People will often build lookup tables that map these inputs to outputs in order to perform quick reversals later. These tables are called <em>rainbow tables</em> and rely on the input already having been hashed.</p>
<p>The second step is to get the idea of a proof of work. It might be impossible to find a hash specifically with a string consisting of nothing but the letter "a" but what if we asked for a hash with a single zero at the front?</p>
<p>Altering the last letter of <code>hello world</code> took 26 attempts to finally get <code>hello worlC</code> which equates to <code>0d7eae0f646102a05716b3ab0309c2ccc2952c0b3420b4aabb24ff969a320f8c</code></p>
<p>Why is this useful? Because it creates a puzzle whose difficulty is measurable and which it's impossible to perform better than blind guessing. That second property is important because it's the only way to create a fair "mining" system. Miners solve such puzzles as above but which are far more difficult. For example, find a hash that looks like this: <code>00000000000000xxxx...</code></p>
<p>Each hash is can be considered to be just a number. For example, the hash <code>00000000000000a05716b3ab0309c2ccc2952c0b3420b4aabb24ff969a320f8c</code> has a numeric value of <code>1006471685857908083785100068964934199141504624183378801987468</code></p>
<p>So in mining, the miners have to achieve a hash with a numeric value lower than a specified number. This number is called the <em>target</em>. If your hash attempt gives you a number less than the target, which is the same thing as having a bunch of zeros at the front of the hash, then you win and you get to "mine the block". To find such a small hash takes millions of attempts, or more accurately, the whole mining network, with everyone trying at the same time, needs millions of billions of tries to get it right.</p>
<p>The part of the content that they are hashing and are allowed to change, a single number, in order to try and get a hash beginning with zeros, is called the nonce.</p>
<p>The current block reward of 25 Bitcoins is given to the miner who successfully "mines the block" (finds the appropriate hash). It's not really that mining "generates" the Bitcoin in any sense, it's just that it's written into Bitcoin code that a transaction block starts with a unique transaction called a "coinbase" transaction, which is the only type of transaction with no inputs. It only has an output, consisting of the reward plus the transaction fees.</p>
<h2>Byzantine Generals problem</h2>
<p>To make any sense of Bitcoin's solution to this problem, you need to understand also what is meant by "distributed timestamp server" and how proof of work hashes can be used to construct this. It is, very briefly, explained in Sections 3 and 4 of the <a href="bitcoin.org/bitcoin.pdf">bitcoin whitepaper</a>. You're creating a sequence of blocks, tied to each other by including the hash of the last one in the next one. This proves that the next block knew about the last block (remember, hashes are totally unpredictable), which proves that it came afterwards. However, that's not enough; you might know that block 8 comes after block 7, but what if a different block 8, put in by a different miner, also comes after block 7? Worse still, what if these two competing blocks, 8a and 8b contain different transactions, spending money to different places? Which one is the "true" block of transactions? The reason miners did the complicated proof of work process above is exactly to solve this problem.</p>
<p>In bitcoin, the chain of blocks with the largest total proof of work embedded in it is the "winner".</p>
<p>The reason this is such a good way of deciding is that it makes it incredibly difficult for an attacker (someone, say, who wants to spend the same Bitcoins twice) to create an alternative single block or chain of blocks and try to convince everyone else on the network that theirs is the right one. To be valid, yours would have to have more "proof of work" in it (a lower hash value and/or more subsequent blocks). Since everyone else is working on the "true" chain, they have an enormous amount of CPU power working together to create it. To beat them, you're going to have to have more CPU power than everyone else, hence the "51% attack".</p>
<p>Proof of work makes sense because work cannot be faked.</p>
<p>Lastly, here is <a href="http://www.mail-archive.com/cryptography@metzdowd.com/msg09997.html">Satoshi's explanation of the Byzantine Generals' problem</a>. Hopefully you can see how it connects.</p>
<h2>Conclusion</h2>
<p>The math problem that these mining computers solve serves no purpose other than to secure Bitcoin's network from attackers wishing to "double spend". Miners are not creating a massive rainbow table or computing the human genome. As more computers are thrown at the problem, and hardware advances, the problem is artificially made more difficult to compensate. This seems incredibly wasteful to me as we start to read about the <a href="http://www.bbc.co.uk/news/technology-22153687">electrical costs of the Bitcoin network</a> and think about the fact that Bitcoin could easily run on just 3 computers to be considered distributed. This is why I have high hopes for alternative cryptocurrencies, such as <a href="http://peercoin.net/">Peercoin</a>, that implement <a href="https://en.wikipedia.org/wiki/Proof-of-stake">proof-of-stake</a>. This will allow us to enjoy the benefits that a cryptocurrency provides, but be able to run the network securely on fewer devices, and not hammering their CPU/electricity whilst doing so. The network could run on multi-purpose devices, such as people's phones and tablets rather than purpose-built and costly <a href="https://en.wikipedia.org/wiki/Application-specific_integrated_circuit">ASICs</a> that will be redundant in a few years.</p>
 <p>
 Last updated: 8th December 2021 <br />
 First published: 16th August 2018</p>
 </div>||||I|||| Programster's Blog

 Tutorials focusing on Linux, programming, and open-source

 Bitcoin's Mathematical Problem

 bitcoin mining

 Introduction

 How "mining" works is at the very heart of Bitcoin. It is often brushed over and simply referred to as "complicated math" in the media, but it's actually quite simple to understand even if it is computationally intensive to solve.

 Disclaimer

 Most of the content in this post comes from a post on Reddit that I have edited, reformatted, and elaborated on. Feel free to read the original post if you prefer.

 Hashes

 Understanding hashes is the first step in understanding mining. A hash will take an input of any length, and generate is seemingly randomised output of a specific length. The same input will always generate the same output, but changing just one character will drastically change the output. For example, a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447 is the hash of hello world, and 30e731839774de9ea08ff1adb8aa6b638e05f64900d005f84aea563cab0092b5 is the hash of hello worle.

 This behaviour makes it very difficult to predict what input gives a particular output. For example, what input gives aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa as a hash? It's effectively impossible to work it out. People will often build lookup tables that map these inputs to outputs in order to perform quick reversals later. These tables are called rainbow tables and rely on the input already having been hashed.

 The second step is to get the idea of a proof of work. It might be impossible to find a hash specifically with a string consisting of nothing but the letter "a" but what if we asked for a hash with a single zero at the front?

 Altering the last letter of hello world took 26 attempts to finally get hello worlC which equates to 0d7eae0f646102a05716b3ab0309c2ccc2952c0b3420b4aabb24ff969a320f8c

 Why is this useful? Because it creates a puzzle whose difficulty is measurable and which it's impossible to perform better than blind guessing. That second property is important because it's the only way to create a fair "mining" system. Miners solve such puzzles as above but which are far more difficult. For example, find a hash that looks like this: 00000000000000xxxx...

 Each hash is can be considered to be just a number. For example, the hash 00000000000000a05716b3ab0309c2ccc2952c0b3420b4aabb24ff969a320f8c has a numeric value of 1006471685857908083785100068964934199141504624183378801987468

 So in mining, the miners have to achieve a hash with a numeric value lower than a specified number. This number is called the target. If your hash attempt gives you a number less than the target, which is the same thing as having a bunch of zeros at the front of the hash, then you win and you get to "mine the block". To find such a small hash takes millions of attempts, or more accurately, the whole mining network, with everyone trying at the same time, needs millions of billions of tries to get it right.

 The part of the content that they are hashing and are allowed to change, a single number, in order to try and get a hash beginning with zeros, is called the nonce.

 The current block reward of 25 Bitcoins is given to the miner who successfully "mines the block" (finds the appropriate hash). It's not really that mining "generates" the Bitcoin in any sense, it's just that it's written into Bitcoin code that a transaction block starts with a unique transaction called a "coinbase" transaction, which is the only type of transaction with no inputs. It only has an output, consisting of the reward plus the transaction fees.

 Byzantine Generals problem

 To make any sense of Bitcoin's solution to this problem, you need to understand also what is meant by "distributed timestamp server" and how proof of work hashes can be used to construct this. It is, very briefly, explained in Sections 3 and 4 of the bitcoin whitepaper. You're creating a sequence of blocks, tied to each other by including the hash of the last one in the next one. This proves that the next block knew about the last block (remember, hashes are totally unpredictable), which proves that it came afterwards. However, that's not enough; you might know that block 8 comes after block 7, but what if a different block 8, put in by a different miner, also comes after block 7? Worse still, what if these two competing blocks, 8a and 8b contain different transactions, spending money to different places? Which one is the "true" block of transactions? The reason miners did the complicated proof of work process above is exactly to solve this problem.

 In bitcoin, the chain of blocks with the largest total proof of work embedded in it is the "winner".

 The reason this is such a good way of deciding is that it makes it incredibly difficult for an attacker (someone, say, who wants to spend the same Bitcoins twice) to create an alternative single block or chain of blocks and try to convince everyone else on the network that theirs is the right one. To be valid, yours would have to have more "proof of work" in it (a lower hash value and/or more subsequent blocks). Since everyone else is working on the "true" chain, they have an enormous amount of CPU power working together to create it. To beat them, you're going to have to have more CPU power than everyone else, hence the "51% attack".

 Proof of work makes sense because work cannot be faked.

 Lastly, here is Satoshi's explanation of the Byzantine Generals' problem. Hopefully you can see how it connects.

 Conclusion

 The math problem that these mining computers solve serves no purpose other than to secure Bitcoin's network from attackers wishing to "double spend". Miners are not creating a massive rainbow table or computing the human genome. As more computers are thrown at the problem, and hardware advances, the problem is artificially made more difficult to compensate. This seems incredibly wasteful to me as we start to read about the electrical costs of the Bitcoin network and think about the fact that Bitcoin could easily run on just 3 computers to be considered distributed. This is why I have high hopes for alternative cryptocurrencies, such as Peercoin, that implement proof-of-stake. This will allow us to enjoy the benefits that a cryptocurrency provides, but be able to run the network securely on fewer devices, and not hammering their CPU/electricity whilst doing so. The network could run on multi-purpose devices, such as people's phones and tablets rather than purpose-built and costly ASICs that will be redundant in a few years.

 Last updated: 8th December 2021
 First published: 16th August 2018
 Please enable JavaScript to view the comments powered by Disqus.
 Programster's Blog Ⓒ 2023
Bitcoin's Mathematical Problem
 
 Introduction
How "mining" works is at the very heart of Bitcoin. It is often brushed over and simply referred to as "complicated math" in the media, but it's actually quite simple to understand even if it is computationally intensive to solve.
Disclaimer
Most of the content in this post comes from a post on Reddit that I have edited, reformatted, and elaborated on. Feel free to read the original post if you prefer.
Hashes
Understanding hashes is the first step in understanding mining. A hash will take an input of any length, and generate is seemingly randomised output of a specific length. The same input will always generate the same output, but changing just one character will drastically change the output. For example, a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447 is the hash of hello world, and 30e731839774de9ea08ff1adb8aa6b638e05f64900d005f84aea563cab0092b5 is the hash of hello worle.
This behaviour makes it very difficult to predict what input gives a particular output. For example, what input gives aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa as a hash? It's effectively impossible to work it out. People will often build lookup tables that map these inputs to outputs in order to perform quick reversals later. These tables are called rainbow tables and rely on the input already having been hashed.
The second step is to get the idea of a proof of work. It might be impossible to find a hash specifically with a string consisting of nothing but the letter "a" but what if we asked for a hash with a single zero at the front?
Altering the last letter of hello world took 26 attempts to finally get hello worlC which equates to 0d7eae0f646102a05716b3ab0309c2ccc2952c0b3420b4aabb24ff969a320f8c 
Why is this useful? Because it creates a puzzle whose difficulty is measurable and which it's impossible to perform better than blind guessing. That second property is important because it's the only way to create a fair "mining" system. Miners solve such puzzles as above but which are far more difficult. For example, find a hash that looks like this: 00000000000000xxxx... 
Each hash is can be considered to be just a number. For example, the hash 00000000000000a05716b3ab0309c2ccc2952c0b3420b4aabb24ff969a320f8c has a numeric value of 1006471685857908083785100068964934199141504624183378801987468 
So in mining, the miners have to achieve a hash with a numeric value lower than a specified number. This number is called the target. If your hash attempt gives you a number less than the target, which is the same thing as having a bunch of zeros at the front of the hash, then you win and you get to "mine the block". To find such a small hash takes millions of attempts, or more accurately, the whole mining network, with everyone trying at the same time, needs millions of billions of tries to get it right.
The part of the content that they are hashing and are allowed to change, a single number, in order to try and get a hash beginning with zeros, is called the nonce.
The current block reward of 25 Bitcoins is given to the miner who successfully "mines the block" (finds the appropriate hash). It's not really that mining "generates" the Bitcoin in any sense, it's just that it's written into Bitcoin code that a transaction block starts with a unique transaction called a "coinbase" transaction, which is the only type of transaction with no inputs. It only has an output, consisting of the reward plus the transaction fees.
Byzantine Generals problem
To make any sense of Bitcoin's solution to this problem, you need to understand also what is meant by "distributed timestamp server" and how proof of work hashes can be used to construct this. It is, very briefly, explained in Sections 3 and 4 of the bitcoin whitepaper. You're creating a sequence of blocks, tied to each other by including the hash of the last one in the next one. This proves that the next block knew about the last block (remember, hashes are totally unpredictable), which proves that it came afterwards. However, that's not enough; you might know that block 8 comes after block 7, but what if a different block 8, put in by a different miner, also comes after block 7? Worse still, what if these two competing blocks, 8a and 8b contain different transactions, spending money to different places? Which one is the "true" block of transactions? The reason miners did the complicated proof of work process above is exactly to solve this problem.
In bitcoin, the chain of blocks with the largest total proof of work embedded in it is the "winner".
The reason this is such a good way of deciding is that it makes it incredibly difficult for an attacker (someone, say, who wants to spend the same Bitcoins twice) to create an alternative single block or chain of blocks and try to convince everyone else on the network that theirs is the right one. To be valid, yours would have to have more "proof of work" in it (a lower hash value and/or more subsequent blocks). Since everyone else is working on the "true" chain, they have an enormous amount of CPU power working together to create it. To beat them, you're going to have to have more CPU power than everyone else, hence the "51% attack".
Proof of work makes sense because work cannot be faked.
Lastly, here is Satoshi's explanation of the Byzantine Generals' problem. Hopefully you can see how it connects.
Conclusion
The math problem that these mining computers solve serves no purpose other than to secure Bitcoin's network from attackers wishing to "double spend". Miners are not creating a massive rainbow table or computing the human genome. As more computers are thrown at the problem, and hardware advances, the problem is artificially made more difficult to compensate. This seems incredibly wasteful to me as we start to read about the electrical costs of the Bitcoin network and think about the fact that Bitcoin could easily run on just 3 computers to be considered distributed. This is why I have high hopes for alternative cryptocurrencies, such as Peercoin, that implement proof-of-stake. This will allow us to enjoy the benefits that a cryptocurrency provides, but be able to run the network securely on fewer devices, and not hammering their CPU/electricity whilst doing so. The network could run on multi-purpose devices, such as people's phones and tablets rather than purpose-built and costly ASICs that will be redundant in a few years.
 
 Last updated: 8th December 2021 
 First published: 16th August 2018
Programster's Blog
https://blog.programster.org/bitcoins-mathematical-problem
https://levelup.gitconnected.com/how-i-tripled-my-return-on-bitcoin-using-mathematics-algorithms-and-python-347edd9b5625?gi=2b8e2c80ce8a
How I Tripled My Return on Bitcoin Using Mathematics, Algorithms, and Python
2021-09-29T06:54:15Z
Sajid Lhessani
<html><body><div><p></p><figure><figcaption>Photo by the author.</figcaption></figure><p></p><div><p><span>T</span>his article is going to be slightly different than usual. For people following me for a few months either on Medium or <a href="https://www.youtube.com/c/AlgorithmicTradingbySajid">Youtube</a>, you have seen different articles or videos on which I am using mathematics, science, and probability to help predict the market.</p><p>Lately, I started getting interested in cryptocurrencies after seeing the hype and strong buying indicators. But before digging deeper and start talking about theory and coding, let’s have a bit of background and see what we have covered so far.</p><h2>Before to starting</h2><p>In a previous article, we tested a famous mathematical technique on the S&amp;P 500 (US Stock exchange index). We discovered how accurate and terrific the Bollinger Band theory is when you want to trade on the <strong>US Market</strong>.</p><p>Even if all the trades were not perfect, this previous algorithm brought us serious trending indicators to predict the market&#39;s movement.</p><p>However, after backtesting, I noticed that John Bollinger’s theory developed in the article above doesn’t accurately predict cryptocurrencies.</p><p>That’s why after further tests and readings, a viral algorithm popped up: <strong>Golden cross vs Death cross</strong>.</p><p>That’s why I tested it for a few weeks, and here is my recap.</p><p>Before exploring the coding script for the live test, let’s start digging into some basic science and theoretical questions and look at how these trading signals are calculated.</p><h2>Golden cross, Death cross?</h2><p>For people with a financial background, Golden cross and Death cross indicators are a <strong>derivate</strong> of the <strong>moving averages,</strong> also…</p></div></div></body></html>
Photo by the author.      This article is going to be slightly different than usual. For people following me for a few months either on Medium or Youtube, you have seen different articles or videos on which I am using mathematics, science, and probability to help predict the market. Lately, I started getting interested in cryptocurrencies after seeing the hype and strong buying indicators. But before digging deeper and start talking about theory and coding, let’s have a bit of background and see what we have covered so far. Before to starting In a previous article, we tested a famous mathematical technique on the S&amp;P 500 (US Stock exchange index). We discovered how accurate and terrific the Bollinger Band theory is when you want to trade on the US Market. Even if all the trades were not perfect, this previous algorithm brought us serious trending indicators to predict the market&#39;s movement. However, after backtesting, I noticed that John Bollinger’s theory developed in the article above doesn’t accurately predict cryptocurrencies. That’s why after further tests and readings, a viral algorithm popped up: Golden cross vs Death cross. That’s why I tested it for a few weeks, and here is my recap. Before exploring the coding script for the live test, let’s start digging into some basic science and theoretical questions and look at how these trading signals are calculated. Golden cross, Death cross? For people with a financial background, Golden cross and Death cross indicators are a derivate of the moving averages, also…
How I Tripled My Return on Bitcoin Using Mathematics, Algorithms, and Python
https://levelup.gitconnected.com/how-i-tripled-my-return-on-bitcoin-using-mathematics-algorithms-and-python-347edd9b5625
https://www.investopedia.com/terms/b/bitcoin-mining.asp
Bitcoin Mining
2023-05-02
Jake Frankenfield; JeFreda R Brown; Melody Kazel
<div><div>
<h2> What Is Bitcoin Mining? </h2>
<p>
Bitcoin mining is the process of validating the information in a blockchain block by generating a cryptographic solution that matches specific criteria. When a correct solution is reached, a reward in the form of bitcoin and fees for the work done is given to the miner who reached the solution first.
</p>
<p>
Over time, the reward for mining Bitcoin is reduced. This reward process continues until there are 21 million bitcoin circulating. Once that number is reached, the bitcoin reward will cease, and Bitcoin miners will be rewarded through fees paid for the work done.<br />
</p>
<div>
<h3>
Key Takeaways</h3>
<div>
<ul><li>Validating transaction information and maintaining the integrity of the blockchain is mining's purpose, while the bitcoin reward is the incentive to mine.</li><li>Bitcoin mining is necessary to maintain the ledger of transactions upon which Bitcoin is based.</li><li>Miners have become very sophisticated over the past several years, using complex machinery to speed up mining operations.</li><li>Bitcoin mining has generated controversy because it is not considered environmentally friendly.</li></ul></div>
</div>
<div>
<h4>
Click Play to Learn How Bitcoin Mining Works</h4>
</div>
<h2> How Does Bitcoin Mining Work? </h2>
<p>
Here's a simplified example to explain the process. Say you ask friends to guess a number between 1 and 100. Your friends don’t have to guess the exact number; they just have to be the first to guess a number less than or equal to your number. If you are thinking of the number 19 and a friend comes up with 21, another 55, and yet another 83, they lose because they all guessed more than 19. But if you have three friends left, and the next one guesses 16, they win, and the others don't get a chance to guess. The one that guessed 16 was the first to guess a number less than or equal to 19.
</p>
<p>
In this case, the number you chose, 19, represents the target hash the Bitcoin network creates for a block, and the random guesses from your friends are the guesses from the miners.
</p>
<h3> The Hash </h3>
<p>
At the heart of Bitcoin mining is <a href="https://ccaf.io/cbnsi/cbeci">the hash</a>. The hash is a 64-digit hexadecimal number that is the result of sending the information contained in a block through the SHA256 hashing algorithm. This part of the process takes little time to complete—in fact, you can generate a hash in less than one second, pasting some content into an online SHA256 hash generator. This is the encryption method used by Bitcoin to create a block hash. However, decrypting that hash back to the content you pasted is the difficult part: a 64-digit hash can take centuries to decode with modern hardware.
</p>
<p>
A hash might look like this (this is the previous paragraph run through a hash generator). If you change one value in that content, like switching one "t" to an "a," the hash changes:
</p>
<blockquote>
a54f83a5db7371eeefa2287a0ede750ac623e49a8ba29f248eb785fe0a678559
</blockquote>
<p>
Here is the same paragraph, but the first word is misspelled as "Aa" instead of "At":
</p>
<blockquote>
fbfa33ff980d1492b3a9275a1eb945d89bd6b699ca19c3c470021b8f253654af
</blockquote>
<p>
This is the number called the block hash, which is used in the next block's header as part of the information run through encryption. Each block uses the previous block's hash, which acts to chain them together, thus creating the term "<a href="https://www.investopedia.com/terms/b/blockchain.asp">blockchain</a>."<br />
</p>
<h3> Target Hash </h3>
<p>
The <a href="https://www.investopedia.com/terms/t/target-hash.asp">target hash</a>, used
What Is Bitcoin Mining? 
Bitcoin mining is the process of validating the information in a blockchain block by generating a cryptographic solution that matches specific criteria. When a correct solution is reached, a reward in the form of bitcoin and fees for the work done is given to the miner who reached the solution first.
Over time, the reward for mining Bitcoin is reduced. This reward process continues until there are 21 million bitcoin circulating. Once that number is reached, the bitcoin reward will cease, and Bitcoin miners will be rewarded through fees paid for the work done.
Key Takeaways
 Validating transaction information and maintaining the integrity of the blockchain is mining's purpose, while the bitcoin reward is the incentive to mine. Bitcoin mining is necessary to maintain the ledger of transactions upon which Bitcoin is based. Miners have become very sophisticated over the past several years, using complex machinery to speed up mining operations. Bitcoin mining has generated controversy because it is not considered environmentally friendly.  
Click Play to Learn How Bitcoin Mining Works
 How Does Bitcoin Mining Work? 
Here's a simplified example to explain the process. Say you ask friends to guess a number between 1 and 100. Your friends don’t have to guess the exact number; they just have to be the first to guess a number less than or equal to your number. If you are thinking of the number 19 and a friend comes up with 21, another 55, and yet another 83, they lose because they all guessed more than 19. But if you have three friends left, and the next one guesses 16, they win, and the others don't get a chance to guess. The one that guessed 16 was the first to guess a number less than or equal to 19.
In this case, the number you chose, 19, represents the target hash the Bitcoin network creates for a block, and the random guesses from your friends are the guesses from the miners.
 The Hash 
At the heart of Bitcoin mining is the hash. The hash is a 64-digit hexadecimal number that is the result of sending the information contained in a block through the SHA256 hashing algorithm. This part of the process takes little time to complete—in fact, you can generate a hash in less than one second, pasting some content into an online SHA256 hash generator. This is the encryption method used by Bitcoin to create a block hash. However, decrypting that hash back to the content you pasted is the difficult part: a 64-digit hash can take centuries to decode with modern hardware.
A hash might look like this (this is the previous paragraph run through a hash generator). If you change one value in that content, like switching one "t" to an "a," the hash changes:
a54f83a5db7371eeefa2287a0ede750ac623e49a8ba29f248eb785fe0a678559
Here is the same paragraph, but the first word is misspelled as "Aa" instead of "At":
fbfa33ff980d1492b3a9275a1eb945d89bd6b699ca19c3c470021b8f253654af
This is the number called the block hash, which is used in the next block's header as part of the information run through encryption. Each block uses the previous block's hash, which acts to chain them together, thus creating the term "blockchain."
 Target Hash 
The target hash, used
Bitcoin Mining
https://www.investopedia.com/terms/b/bitcoin-mining.asp
https://www.toptal.com/bitcoin/cryptocurrency-for-dummies-bitcoin-and-beyond
Cryptocurrency for Dummies: Bitcoin and Beyond | Toptal®
2014-07-08
Demir Selmanovic
<div><div><p>Bitcoin created a lot of buzz on the Internet. It was ridiculed, it was attacked, and eventually it was accepted and became a part of our lives. However, <a href="https://www.toptal.com/bitcoin">Bitcoin</a> is not alone. At this moment, there are <a href="http://mapofcoins.com/">over 700 AltCoin</a> implementations, which use similar principles and various cryptocurrency algorithms.</p>
<div><figure><a href="https://uploads.toptal.io/blog/image/125343/toptal-blog-image-1517911180131-588ef8c3e7cd0fea221ae3167d7a7595.png"></a></figure></div>
<p>So, what do you need to create something like Bitcoin?</p>
<p>Without trying to understand your personal motivation for creating a decentralized, anonymous system for exchanging money/information (but still hoping that it is in scope of moral and legal activities), let’s first break down the basic requirements for our new payment system:</p>
<ol>
 <li>All transactions should be made over the Internet</li>
 <li>We do not want to have a central authority that will process transactions</li>
 <li>Users should be anonymous and identified only by their virtual identity</li>
 <li>A single user can have as many virtual identities as he or she likes</li>
 <li>Value supply (new virtual bills) must be added in a controlled way</li>
</ol>
<h2>Decentralized Information Sharing Over Internet</h2>
<p>Fulfilling the first two requirements from our list, removing a central authority for information exchange over the Internet, is already possible. What you need is a <strong>peer-to-peer (P2P)</strong> network.</p>
<p>Information sharing in P2P networks is similar to information sharing among friends and family. If you share information with at least one member of the network, eventually this information will reach every other member of the network. The only difference is that in digital networks this information will not be altered in any way.</p>
<div><figure><a href="https://uploads.toptal.io/blog/image/125344/toptal-blog-image-1517911234566-a7e7abe7768bd062529aa08ff79aa4f5.png"></a></figure></div>
<p>You have probably heard of BitTorrent, one of the most popular P2P file sharing (content delivery) systems. Another popular application for P2P sharing is Skype, as well as other chat systems.</p>
<p>Bottom line is that you can implement or use one of the existing open-source P2P protocols to support your new cryptocurrency, which we’ll call <em>Topcoin</em>.</p>
<h2>Hashing Algorithm</h2>
<p>To understand digital identities, we need to understand how <strong>cryptographic hashing works</strong>. Hashing is the process of mapping digital data of any arbitrary size to data of a fixed size. In simpler words, hashing is a process of taking some information that is readable and making something that makes no sense at all.</p>
<blockquote>
 <p>You can compare hashing to getting answers from politicians. Information you provide to them is clear and understandable, while the output they provide looks like random stream of words.</p>
</blockquote>
<div><figure><a href="https://uploads.toptal.io/blog/image/125345/toptal-blog-image-1517911252174-46bb6f6e49c2cfaf1e09ed4bdff115e5.png"></a></figure></div>
<p>There are a few requirements that a good hashing algorithm needs:</p>
<ol>
 <li>Output length of hashing algorithm must be fixed (a good value is 256 bytes)</li>
 <li>Even the smallest change in input data must produce significant difference in output</li>
 <li>Same input will always produce same output</li>
 <li>There must be no way to reverse the output value to calculate the input</li>
 <li>Calculating the HASH value should not be compute intensive and should be fast</li>
</ol>
<p>If you take a look at the simple statistics, we will have a limited (but huge) number of possible HASH values, simply because our HASH length is limited. However, our hashing algorithm (let’s name it Politician256) should be reliable enough that it only produces duplicate hash values for different inputs about as frequently as a monkey in a zoo manages to correctly type Hamlet on a typewriter!</p>
<p><em>If you think Hamlet is just a name or a word, please stop reading now, or read about the <a href="https://en.wikipedia.org/wiki/Infinite_monkey_theorem">Infinite Monkey Theorem</a>.</em></p>
<h2>Digital Signature</h2>
<p>When signing a paper, all you need to do is append your signature to the text of a document. A digital signature is similar: you just need to append your personal data to the document you are signing.</p>
<p>If you understand that the hashing algorithm adheres to the rule where <strong>even the smallest change in input data must produce significant difference in output</strong>, then it is obvious that the HASH value created for the original document will be different from the HASH value created for the document with the appended signature.</p>
<p>A combination of the original document and the HASH value produced for the document with your personal data appended is a <strong>digitally signed document</strong>.</p>
<p>And this is how we get to your <strong>virtual identity</strong>, which is defined as the data you appended to the document before you created that HASH value.</p>
<p>Next, you need to make sure that your signature cannot be copied, and no one can execute any transaction on your behalf. The best way to make sure that your signature is secured, is to keep it yourself, and provide a different method for someone else to validate the signed document. Again, we can fall back on technology and algorithms that are readily available. What we need to use is <a href="https://en.wikipedia.org/wiki/Public-key_cryptography"><strong>public-key cryptography</strong></a> also known as <strong>asymmetric cryptography</strong>.</p>
<p>To make this work, you need to create a <strong>private key</strong> and a <strong>public key</strong>. These two keys will be in some kind of mathematical correlation and will depend on each other. The algorithm that you will use to make these keys will assure that each private key will have a different public key. As their names suggest, a private key is information that you will keep just for yourself, while a public key is information that you will share.</p>
<p>If you use your private key (your identity) and original document as input values for the <strong>signing algorithm</strong> to create a HASH value, assuming you kept your key secret, you can be sure that no one else can produce the same HASH value for that document.</p>
<div><figure><a href="https://uploads.toptal.io/blog/image/125346/toptal-blog-image-1517911271084-3f85bc66149f3f6a2c1ae304152490d2.png"></a></figure></div>
<p>If anyone needs to validate your signature, he or she will use the original document, the HASH value you produced, and your public key as inputs for the <strong>signature verifying algorithm</strong> to verify that these values match.</p>
<div><figure><a href="https://uploads.toptal.io/blog/image/126560/toptal-blog-image-1530693489685-c2f3480ec40d143c432fb94bb85ed898.png"></a></figure></div>
<h2>How to send Bitcoin/Money</h2>
<p>Assuming that you have implemented P2P communication, mechanisms for creating digital identities (private and public keys), and provided ways for users to sign documents using their private keys, you are ready to start sending information to your peers.</p>
<p>Since we do not have a central authority that will validate how much money you have, the system will have to ask you about it every time, and then check if you lied or not. So, your transaction record might contain the following information:</p>
<ol>
 <li>I have 100 Topcoins</li>
 <li>I want to send 10 coins to my pharmacist for the medication (<em>you would include your pharmacists public key here</em>)</li>
 <li>I want to give one coin as transaction fee to the system (<em>we will come back to this later</em>)</li>
 <li>I want to keep the remaining 89 coins</li>
</ol>
<p>The only thing left to do is digitally sign the transaction record with your private key and transmit the transaction record to your peers in the network. At that point, everyone will receive the information that someone (your virtual identity) is sending money to someone else (your pharmacist’s virtual identity).</p>
<p>Your job is done. However, your medication will not be paid for until the whole network agrees that you really did have 100 coins, and therefore could execute this transaction. Only after your transaction is validated will your pharmacist get the funds and send you the medication.</p>
<h2>Cryptocurrency Miners: A New Breed of Agent</h2>
<p>Miners are known to be very hard working people who are, in my opinion, heavily underpaid. In the digital world of cryptocurrency, miners play a very similar role, except in this case, they do the computationally-intensive work instead of digging piles of dirt. Unlike real miners, some cryptocurrency miners earned a small fortune over the past five years, but many others lost a fortune on this risky endeavour.</p>
<p>Miners are the core component of the system and their main purpose is to confirm the validity of each and every transaction requested by users.</p>
<p>In order to confirm the validity of your transaction (or a combination of several transactions requested by a few other users), miners will do two things.</p>
<p>First, they will rely on the fact that “everyone knows everything,” meaning that every transaction executed in the system is copied and available to any peer in the network. They will look into the history of your transactions to verify that you actually had 100 coins to begin with. Once your account balance is confirmed, they will generate a specific HASH value. <strong>This hash value must have a specific format; it must start with certain number of zeros</strong>.</p>
<p>There are two inputs for calculating this HASH value:</p>
<ol>
 <li>Transaction record data</li>
 <li>Miner’s proof-of-work</li>
</ol>
<p>Considering that <em>even the smallest change in input data must produce a significant difference in output HASH value</em>, miners have a very difficult task. They need to find a specific value for a <strong>proof-of-work</strong> variable that will produce a HASH beginning with zeros. If your system requires a minimum of 40 zeros in each validated transaction, the miner will need to calculate approximately 2^40 different HASH values in order to find the right <strong>proof-of-work</strong>.</p>
<p>Once a miner finds the proper value for proof-of-work, he or she is entitled to a transaction fee (the single coin you were willing to pay), which can be added as part of the validated transaction. Every validated transaction is transmitted to peers in the network and stored in a specific database format known as the <strong>Blockchain</strong>.</p>
<p>But what happens if the number of miners goes up, and their hardware becomes much more efficient? Bitcoin used to be mined on CPUs, then GPUs and FPGAs, but ultimately miners started designing their own ASIC chips, which were vastly more powerful than these early solutions. As the hash rate goes up, so does the mining difficulty, thus ensuring equilibrium. When more hashing power is introduced into the network, the difficulty goes up and vice versa; if many miners decide to pull the plug because their operation is no longer profitable, difficulty is readjusted to match the new hash rate.</p>
<h2>Blockchain for Dummies: The Global Cryptocurrency Ledger</h2>
<p>The blockchain contains the history of all transactions performed in the system. Every validated transaction, or batch of transactions, becomes another ring in the chain. Every single <a href="https://www.toptal.com/services/blockchain-development">blockchain development company</a> relies on this public ledger.</p>
<p>So, the Bitcoin blockchain is, essentially, a public ledger where transactions are listed in a chronological order.</p>
<blockquote>
 <p>The first ring in the Bitcoin blockchain is called the Genesis Block</p>
</blockquote>
<p>To read more about how the blockchain works, I suggest reading <a href="https://www.toptal.com/bitcoin/blockchain-technology-powering-bitcoin">Blockchain Technology Explained: Powering Bitcoin</a>, by Nermin Hajdarbegovic.</p>
<p>There is no limit to how many miners may be active in your system. This means that it is possible for two or more miners to validate the same transaction. If this happens, the system will check the total effort each miner invested in validating the transaction by simply counting zeros. The miner that invested more effort (found more leading zeros) will prevail and his or her block will be accepted.</p>
<h2>Controlling The Money Supply</h2>
<p>The first rule of the Bitcoin system is that there can be a maximum of 21,000,000 Bitcoins generated. This number has still not been achieved, and according to current trends, it is thought that this number will be reached by the year 2140.</p>
<p>This may cause you to question the usefulness of such a system, because 21 million units doesn’t sound like much. However, Bitcoin system supports fractional values down to the eight decimal (0.00000001). This smallest unit of a bitcoin is called a <strong>Satoshi</strong>, in honor of Satoshi Nakamoto, the anonymous developer behind the Bitcoin protocol.</p>
<p>New coins are created as a reward to miners for validating transactions. This reward <strong>is not the transaction fee</strong> that you specified when you created a transaction record, but it is defined by the system. The reward amount decreases over time and eventually will be set to zero once the total number of coins issued (21m) has been reached. When this happens, transaction fees will play a much more important role since miners might choose to prioritize more valuable transactions for validation.</p>
<p>Apart from setting the upper limit in maximum number of coins, the Bitcoin system also uses an interesting way to limit daily production of new coins. By calibrating the minimum number of leading zeros required for a proof-of-work calculation, the time required to validate the transaction, and get a reward of new coins, is always set to approximately 10 minutes. If the time between adding new blocks to the blockchain decreases, the system might require that proof-of-work generates 45 or 50 leading zeros.</p>
<p>So, by limiting how fast and how many new coins can be generated, the Bitcoin system is effectively controlling the money supply.</p>
<h2>Start “Printing” Your Own Currency</h2>
<p>As you can see, making your own version of Bitcoin is not that difficult. By utilizing existing technology, implemented in an innovative way, you have everything you need for a cryptocurrency.</p>
<ol>
 <li>All transaction are made over the Internet using P2P communication, thus removing the need for a central authority</li>
 <li>Users can perform anonymous transactions by utilizing asynchronous cryptography and they are identified only by their private key/public key combination</li>
 <li>You have implemented a validated global ledger of all transactions that has been safely copied to every peer in the network</li>
 <li>You have a secured, automated, and controlled money supply, which assures the stability of your currency without the need of central authority</li>
</ol>
<p>One last thing worth mentioning is that, in its essence, <strong>cryptocurrency is a way to transfer anonymous value/information from one user to another in a distributed peer-to-peer network</strong>.</p>
<p>Consider replacing coins in your transaction record with random data that might even be encrypted using asynchronous cryptography so only the sender and receiver can decipher it. Now think about applying that to something like the <strong>Internet Of Things</strong>!</p>
<p>A cryptocurrency system might be an interesting way to enable communication between our stove and toaster.</p>
<p>A number of tech heavyweights are already exploring the use of blockchain technology in IoT platforms, but that’s not the only <a href="https://www.toptal.com/finance/blockchain/blockchain-supply-chain">potential application</a> of this relatively new technology.</p>
<p>If you see no reason to create an alternative currency of your own (other than a practical joke), you could try to use the same or similar approach for something else, such as distributed authentication, creation of virtual currencies used in games, social networks, and other applications, or you could proceed to create a new loyalty program for your e-commerce business, which would reward regular customers with virtual tokens that could be redeemed later on.</p>
<p>”## Further Reading on the Toptal Engineering Blog:</p>
<ul>
 <li><a href="https://www.toptal.com/finance/blockchain/what-is-bitcoin-mining">What Is Bitcoin Mining? How It Works and What It Takes to Make It Pay</a></li>
 <li><a href="https://www.toptal.com/finance/market-research-analysts/cryptocurrency-market">Demystifying Cryptocurrencies, Blockchain, and ICOs</a></li>
 <li><a href="https://www.toptal.com/bitcoin/blockchain-technology-powering-bitcoin">Blockchain Technology Explained: Powering Bitcoin</a></li>
 <li><a href="https://www.toptal.com/finance/fintech/investing-in-cryptocurrencies">Investing in Cryptocurrencies: The Ultimate Guide</a></li>
 <li>
<a href="https://www.toptal.com/bitcoin/intro-to-bitcoin-lightning-network">Scale with Speed: The Bitcoin Lightning Network Explained</a>”</li>
</ul>
</div><section><h2>Understanding the basics</h2><ul><li><h3>What is cryptocurrency?</h3><p>A cryptocurrency is a digital medium of exchange that relies on cryptography to secure and verify transactions. Most cryptocurrencies, such as bitcoin, are decentralized and consensus-based.</p></li><li><h3>What is a blockchain?</h3><p>A blockhain is essentially a digitally-signed financial ledger. Each transaction on the blockchain is visible on the public ledger, and all entries are distributed across the network, requiring consensus about each transaction.</p></li><li><h3>How does a blockchain work?</h3><p>Each transaction executed in the system becomes part of the blockchain, but only after a certain number of nodes reaches a consensus that the transaction is valid. Then, the transaction is added to the blockchain in a new block.</p></li></ul></section>||||I|||| ®
 Follow us on

 Hiring? Toptal handpicks top Bitcoin developers to suit your needs.

 * Follow us on
 * Log In
 ®
 Developers
 Follow us on
 Top 3%WhyClientsEnterpriseCommunityBlogAbout Us
 * Follow us on
 * Log In
 Engineering
 * Engineering
 * Design
 * Finance
 * Projects
 * Product
 * Toptal Insights
 Search
 Data Science and Databases 10 minute read

 Cryptocurrency for Dummies: Bitcoin and Beyond

 Bitcoin created a lot of buzz on the Internet. It was ridiculed, it was attacked, and eventually it was accepted and became a part of our lives. However, Bitcoin is not alone. At this moment, there are over 700 AltCoin implementations, which use similar principles of CryptoCurrency.
 Share
 Share
 Bitcoin created a lot of buzz on the Internet. It was ridiculed, it was attacked, and eventually it was accepted and became a part of our lives. However, Bitcoin is not alone. At this moment, there are over 700 AltCoin implementations, which use similar principles of CryptoCurrency.

 By Demir Selmanovic

 Verified Expert in Engineering

 Demir is a developer and project manager with over 15 years of professional experience in a wide range of software development roles.

 Expertise

 BitcoinAlgorithm
 Read the Spanish version of this article translated by Yesica Danderfer.

 Bitcoin created a lot of buzz on the Internet. It was ridiculed, it was attacked, and eventually it was accepted and became a part of our lives. However, Bitcoin is not alone. At this moment, there are over 700 AltCoin implementations, which use similar principles and various cryptocurrency algorithms.

 So, what do you need to create something like Bitcoin?

 Without trying to understand your personal motivation for creating a decentralized, anonymous system for exchanging money/information (but still hoping that it is in scope of moral and legal activities), let’s first break down the basic requirements for our new payment system:

 1. All transactions should be made over the Internet
 2. We do not want to have a central authority that will process transactions
 3. Users should be anonymous and identified only by their virtual identity
 4. A single user can have as many virtual identities as he or she likes
 5. Value supply (new virtual bills) must be added in a controlled way

 Decentralized Information Sharing Over Internet

 Fulfilling the first two requirements from our list, removing a central authority for information exchange over the Internet, is already possible. What you need is a peer-to-peer (P2P) network.

 Information sharing in P2P networks is similar to information sharing among friends and family. If you share information with at least one member of the network, eventually this information will reach every other member of the network. The only difference is that in digital networks this information will not be altered in any way.

 You have probably heard of BitTorrent, one of the most popular P2P file sharing (content delivery) systems. Another popular application for P2P sharing is Skype, as well as other chat systems.

 Bottom line is that you can implement or use one of the existing open-source P2P protocols to support your new cryptocurrency, which we’ll call Topcoin.

 Hashing Algorithm

 To understand digital identities, we need to understand how cryptographic hashing works. Hashing is the process of mapping digital data of any arbitrary size to data of a fixed size. In simpler words, hashing is a process of taking some information that is readable and making something that makes no sense at all.

 You can compare hashing to getting answers from politicians. Information you provide to them is clear and understandable, while the output they provide looks like random stream of words.

 There are a few requirements that a good hashing algorithm needs:

 1. Output length of hashing algorithm must be fixed (a good value is 256 bytes)
 2. Even the smallest change in input data must produce significant difference in output
 3. Same input will always produce same output
 4. There must be no way to reverse the output value to calculate the input
 5. Calculating the HASH value should not be compute intensive and should be fast

 If you take a look at the simple statistics, we will have a limited (but huge) number of possible HASH values, simply because our HASH length is limited. However, our hashing algorithm (let’s name it Politician256) should be reliable enough that it only produces duplicate hash values for different inputs about as frequently as a monkey in a zoo manages to correctly type Hamlet on a typewriter!

 If you think Hamlet is just a name or a word, please stop reading now, or read about the Infinite Monkey Theorem.

 Digital Signature

 When signing a paper, all you need to do is append your signature to the text of a document. A digital signature is similar: you just need to append your personal data to the document you are signing.

 If you understand that the hashing algorithm adheres to the rule where even the smallest change in input data must produce significant difference in output, then it is obvious that the HASH value created for the original document will be different from the HASH value created for the document with the appended signature.

 A combination of the original document and the HASH value produced for the document with your personal data appended is a digitally signed document.

 And this is how we get to your virtual identity, which is defined as the data you appended to the document before you created that HASH value.

 Next, you need to make sure that your signature cannot be copied, and no one can execute any transaction on your behalf. The best way to make sure that your signature is secured, is to keep it yourself, and provide a different method for someone else to validate the signed document. Again, we can fall back on technology and algorithms that are readily available. What we need to use is public-key cryptography also known as asymmetric cryptography.

 To make this work, you need to create a private key and a public key. These two keys will be in some kind of mathematical correlation and will depend on each other. The algorithm that you will use to make these keys will assure that each private key will have a different public key. As their names suggest, a private key is information that you will keep just for yourself, while a public key is information that you will share.

 If you use your private key (your identity) and original document as input values for the signing algorithm to create a HASH value, assuming you kept your key secret, you can be sure that no one else can produce the same HASH value for that document.

 If anyone needs to validate your signature, he or she will use the original document, the HASH value you produced, and your public key as inputs for the signature verifying algorithm to verify that these values match.

 How to send Bitcoin/Money

 Assuming that you have implemented P2P communication, mechanisms for creating digital identities (private and public keys), and provided ways for users to sign documents using their private keys, you are ready to start sending information to your peers.

 Since we do not have a central authority that will validate how much money you have, the system will have to ask you about it every time, and then check if you lied or not. So, your transaction record might contain the following information:

 1. I have 100 Topcoins
 2. I want to send 10 coins to my pharmacist for the medication (you would include your pharmacists public key here)
 3. I want to give one coin as transaction fee to the system (we will come back to this later)
 4. I want to keep the remaining 89 coins

 The only thing left to do is digitally sign the transaction record with your private key and transmit the transaction record to your peers in the network. At that point, everyone will receive the information that someone (your virtual identity) is sending money to someone else (your pharmacist’s virtual identity).

 Your job is done. However, your medication will not be paid for until the whole network agrees that you really did have 100 coins, and therefore could execute this transaction. Only after your transaction is validated will your pharmacist get the funds and send you the medication.

 Cryptocurrency Miners: A New Breed of Agent

 Miners are known to be very hard working people who are, in my opinion, heavily underpaid. In the digital world of cryptocurrency, miners play a very similar role, except in this case, they do the computationally-intensive work instead of digging piles of dirt. Unlike real miners, some cryptocurrency miners earned a small fortune over the past five years, but many others lost a fortune on this risky endeavour.

 Miners are the core component of the system and their main purpose is to confirm the validity of each and every transaction requested by users.

 In order to confirm the validity of your transaction (or a combination of several transactions requested by a few other users), miners will do two things.

 First, they will rely on the fact that “everyone knows everything,” meaning that every transaction executed in the system is copied and available to any peer in the network. They will look into the history of your transactions to verify that you actually had 100 coins to begin with. Once your account balance is confirmed, they will generate a specific HASH value. This hash value must have a specific format; it must start with certain number of zeros.

 There are two inputs for calculating this HASH value:

 1. Transaction record data
 2. Miner’s proof-of-work

 Considering that even the smallest change in input data must produce a significant difference in output HASH value, miners have a very difficult task. They need to find a specific value for a proof-of-work variable that will produce a HASH beginning with zeros. If your system requires a minimum of 40 zeros in each validated transaction, the miner will need to calculate approximately 2^40 different HASH values in order to find the right proof-of-work.

 Once a miner finds the proper value for proof-of-work, he or she is entitled to a transaction fee (the single coin you were willing to pay), which can be added as part of the validated transaction. Every validated transaction is transmitted to peers in the network and stored in a specific database format known as the Blockchain.

 But what happens if the number of miners goes up, and their hardware becomes much more efficient? Bitcoin used to be mined on CPUs, then GPUs and FPGAs, but ultimately miners started designing their own ASIC chips, which were vastly more powerful than these early solutions. As the hash rate goes up, so does the mining difficulty, thus ensuring equilibrium. When more hashing power is introduced into the network, the difficulty goes up and vice versa; if many miners decide to pull the plug because their operation is no longer profitable, difficulty is readjusted to match the new hash rate.

 Blockchain for Dummies: The Global Cryptocurrency Ledger

 The blockchain contains the history of all transactions performed in the system. Every validated transaction, or batch of transactions, becomes another ring in the chain. Every single blockchain development company relies on this public ledger.

 So, the Bitcoin blockchain is, essentially, a public ledger where transactions are listed in a chronological order.

 The first ring in the Bitcoin blockchain is called the Genesis Block

 To read more about how the blockchain works, I suggest reading Blockchain Technology Explained: Powering Bitcoin, by Nermin Hajdarbegovic.

 There is no limit to how many miners may be active in your system. This means that it is possible for two or more miners to validate the same transaction. If this happens, the system will check the total effort each miner invested in validating the transaction by simply counting zeros. The miner that invested more effort (found more leading zeros) will prevail and his or her block will be accepted.

 Controlling The Money Supply

 The first rule of the Bitcoin system is that there can be a maximum of 21,000,000 Bitcoins generated. This number has still not been achieved, and according to current trends, it is thought that this number will be reached by the year 2140.

 This may cause you to question the usefulness of such a system, because 21 million units doesn’t sound like much. However, Bitcoin system supports fractional values down to the eight decimal (0.00000001). This smallest unit of a bitcoin is called a Satoshi, in honor of Satoshi Nakamoto, the anonymous developer behind the Bitcoin protocol.

 New coins are created as a reward to miners for validating transactions. This reward is not the transaction fee that you specified when you created a transaction record, but it is defined by the system. The reward amount decreases over time and eventually will be set to zero once the total number of coins issued (21m) has been reached. When this happens, transaction fees will play a much more important role since miners might choose to prioritize more valuable transactions for validation.

 Apart from setting the upper limit in maximum number of coins, the Bitcoin system also uses an interesting way to limit daily production of new coins. By calibrating the minimum number of leading zeros required for a proof-of-work calculation, the time required to validate the transaction, and get a reward of new coins, is always set to approximately 10 minutes. If the time between adding new blocks to the blockchain decreases, the system might require that proof-of-work generates 45 or 50 leading zeros.

 So, by limiting how fast and how many new coins can be generated, the Bitcoin system is effectively controlling the money supply.

 Start “Printing” Your Own Currency

 As you can see, making your own version of Bitcoin is not that difficult. By utilizing existing technology, implemented in an innovative way, you have everything you need for a cryptocurrency.

 1. All transaction are made over the Internet using P2P communication, thus removing the need for a central authority
 2. Users can perform anonymous transactions by utilizing asynchronous cryptography and they are identified only by their private key/public key combination
 3. You have implemented a validated global ledger of all transactions that has been safely copied to every peer in the network
 4. You have a secured, automated, and controlled money supply, which assures the stability of your currency without the need of central authority

 One last thing worth mentioning is that, in its essence, cryptocurrency is a way to transfer anonymous value/information from one user to another in a distributed peer-to-peer network.

 Consider replacing coins in your transaction record with random data that might even be encrypted using asynchronous cryptography so only the sender and receiver can decipher it. Now think about applying that to something like the Internet Of Things!

 A cryptocurrency system might be an interesting way to enable communication between our stove and toaster.
 Tweet

 A number of tech heavyweights are already exploring the use of blockchain technology in IoT platforms, but that’s not the only potential application of this relatively new technology.

 If you see no reason to create an alternative currency of your own (other than a practical joke), you could try to use the same or similar approach for something else, such as distributed authentication, creation of virtual currencies used in games, social networks, and other applications, or you could proceed to create a new loyalty program for your e-commerce business, which would reward regular customers with virtual tokens that could be redeemed later on.

 ”## Further Reading on the Toptal Engineering Blog:

 * What Is Bitcoin Mining? How It Works and What It Takes to Make It Pay
 * Demystifying Cryptocurrencies, Blockchain, and ICOs
 * Blockchain Technology Explained: Powering Bitcoin
 * Investing in Cryptocurrencies: The Ultimate Guide
 * Scale with Speed: The Bitcoin Lightning Network Explained”

 Understanding the basics

 * What is cryptocurrency?

 A cryptocurrency is a digital medium of exchange that relies on cryptography to secure and verify transactions. Most cryptocurrencies, such as bitcoin, are decentralized and consensus-based.

 * What is a blockchain?

 A blockhain is essentially a digitally-signed financial ledger. Each transaction on the blockchain is visible on the public ledger, and all entries are distributed across the network, requiring consensus about each transaction.

 * How does a blockchain work?

 Each transaction executed in the system becomes part of the blockchain, but only after a certain number of nodes reaches a consensus that the transaction is valid. Then, the transaction is added to the blockchain in a new block.

 Tags

 * Bitcoin
 * Cryptocurrency
 * Cryptography
 Freelancer? Find your next job.
 Remote Freelance Jobs

 Demir Selmanovic
 Verified Expert in Engineering

 Located in Sarajevo, Federation of Bosnia and Herzegovina, Bosnia and Herzegovina

 Member since July 8, 2014

 About the author

 Demir is a developer and project manager with over 15 years of professional experience in a wide range of software development roles.

 authors are vetted experts in their fields and write on topics in which they have demonstrated experience. All of our content is peer reviewed and validated by Toptal experts in the same field.

 Expertise

 BitcoinAlgorithm
 Hire Demir

 World-class articles, delivered weekly.

 Get great content

 Subscription implies consent to our privacy policy

 Trending Articles

 * 
 1. Engineering
 2. Web Front-end

 SolidJS vs. React: The Go-to Guide

 * 
 1. Engineering
 2. Mobile

 Kotlin vs. Java: All-purpose Uses and Android Apps

 * 
 1. Engineering
 2. Web Front-end

 The 10 Most Common JavaScript Issues Developers Face

 * 
 1. Engineering
 2. Technology

 Investing in Unit Testing: Benefits and Approaches

 See our related talent

 * Bitcoin Developers
 * Algorithm Developers
 Freelancer? Find your next job.
 Remote Freelance Jobs

 Hire the author

 Demir Selmanovic

 Verified Expert in Engineering

 Read Next

 1. Engineering
 2. Web Front-end

 SolidJS vs. React: The Go-to Guide

 World-class articles, delivered weekly.

 Sign Me Up

 Subscription implies consent to our privacy policy

 World-class articles, delivered weekly.

 Sign Me Up

 Subscription implies consent to our privacy policy

 Toptal Developers

 * Algorithm Developers
 * Angular Developers
 * AWS Developers
 * Azure Developers
 * Big Data Architects
 * Blockchain Developers
 * Business Intelligence Developers
 * C Developers
 * Computer Vision Developers
 * Django Developers
 * Docker Developers
 * Elixir Developers
 * Go Engineers
 * GraphQL Developers
 * Jenkins Developers
 * Kotlin Developers
 * Kubernetes Experts
 * Machine Learning Engineers
 * Magento Developers
 * .NET Developers
 * R Developers
 * React Native Developers
 * Ruby on Rails Developers
 * Salesforce Developers
 * SQL Developers
 * Sys Admins
 * Tableau Developers
 * Unreal Engine Developers
 * Xamarin Developers
 * View More Freelance Developers

 Join the Toptal® community.

 Hire a Developer or Apply as a Developer

 Footer

 Most In-demand Talent

 * iOS Developers
 * Front-end Developers
 * UX Designers
 * UI Designers
 * Financial Modeling Consultants
 * Interim CFOs
 * Digital Project Managers
 * AWS Experts

 About

 * Top 3%
 * Clients
 * Freelance Developers
 * Freelance Designers
 * Freelance Finance Experts
 * Freelance Project Managers
 * Freelance Product Managers
 * Freelance Jobs
 * Specialized Services
 * Utilities & Tools
 * Research & Analysis Center
 * About Us

 Contact

 * Contact Us
 * Press Center
 * Careers
 * FAQ

 Social

 * 
 * 
 * 
 * 
 ®
 The World’s Top Talent, On Demand ®
 * Copyright 2010 - 2023 Toptal, LLC
 * Privacy Policy
 * Website Terms
 * Accessibility
Bitcoin created a lot of buzz on the Internet. It was ridiculed, it was attacked, and eventually it was accepted and became a part of our lives. However, Bitcoin is not alone. At this moment, there are over 700 AltCoin implementations, which use similar principles and various cryptocurrency algorithms.
     
So, what do you need to create something like Bitcoin?
Without trying to understand your personal motivation for creating a decentralized, anonymous system for exchanging money/information (but still hoping that it is in scope of moral and legal activities), let’s first break down the basic requirements for our new payment system:
 All transactions should be made over the Internet
 We do not want to have a central authority that will process transactions
 Users should be anonymous and identified only by their virtual identity
 A single user can have as many virtual identities as he or she likes
 Value supply (new virtual bills) must be added in a controlled way
Decentralized Information Sharing Over Internet
Fulfilling the first two requirements from our list, removing a central authority for information exchange over the Internet, is already possible. What you need is a peer-to-peer (P2P) network.
Information sharing in P2P networks is similar to information sharing among friends and family. If you share information with at least one member of the network, eventually this information will reach every other member of the network. The only difference is that in digital networks this information will not be altered in any way.
     
You have probably heard of BitTorrent, one of the most popular P2P file sharing (content delivery) systems. Another popular application for P2P sharing is Skype, as well as other chat systems.
Bottom line is that you can implement or use one of the existing open-source P2P protocols to support your new cryptocurrency, which we’ll call Topcoin.
Hashing Algorithm
To understand digital identities, we need to understand how cryptographic hashing works. Hashing is the process of mapping digital data of any arbitrary size to data of a fixed size. In simpler words, hashing is a process of taking some information that is readable and making something that makes no sense at all.
 You can compare hashing to getting answers from politicians. Information you provide to them is clear and understandable, while the output they provide looks like random stream of words.
     
There are a few requirements that a good hashing algorithm needs:
 Output length of hashing algorithm must be fixed (a good value is 256 bytes)
 Even the smallest change in input data must produce significant difference in output
 Same input will always produce same output
 There must be no way to reverse the output value to calculate the input
 Calculating the HASH value should not be compute intensive and should be fast
If you take a look at the simple statistics, we will have a limited (but huge) number of possible HASH values, simply because our HASH length is limited. However, our hashing algorithm (let’s name it Politician256) should be reliable enough that it only produces duplicate hash values for different inputs about as frequently as a monkey in a zoo manages to correctly type Hamlet on a typewriter!
 If you think Hamlet is just a name or a word, please stop reading now, or read about the Infinite Monkey Theorem. 
Digital Signature
When signing a paper, all you need to do is append your signature to the text of a document. A digital signature is similar: you just need to append your personal data to the document you are signing.
If you understand that the hashing algorithm adheres to the rule where even the smallest change in input data must produce significant difference in output, then it is obvious that the HASH value created for the original document will be different from the HASH value created for the document with the appended signature.
A combination of the original document and the HASH value produced for the document with your personal data appended is a digitally signed document.
And this is how we get to your virtual identity, which is defined as the data you appended to the document before you created that HASH value.
Next, you need to make sure that your signature cannot be copied, and no one can execute any transaction on your behalf. The best way to make sure that your signature is secured, is to keep it yourself, and provide a different method for someone else to validate the signed document. Again, we can fall back on technology and algorithms that are readily available. What we need to use is  public-key cryptography  also known as asymmetric cryptography.
To make this work, you need to create a private key and a public key. These two keys will be in some kind of mathematical correlation and will depend on each other. The algorithm that you will use to make these keys will assure that each private key will have a different public key. As their names suggest, a private key is information that you will keep just for yourself, while a public key is information that you will share.
If you use your private key (your identity) and original document as input values for the signing algorithm to create a HASH value, assuming you kept your key secret, you can be sure that no one else can produce the same HASH value for that document.
     
If anyone needs to validate your signature, he or she will use the original document, the HASH value you produced, and your public key as inputs for the signature verifying algorithm to verify that these values match.
     
How to send Bitcoin/Money
Assuming that you have implemented P2P communication, mechanisms for creating digital identities (private and public keys), and provided ways for users to sign documents using their private keys, you are ready to start sending information to your peers.
Since we do not have a central authority that will validate how much money you have, the system will have to ask you about it every time, and then check if you lied or not. So, your transaction record might contain the following information:
 I have 100 Topcoins
 I want to send 10 coins to my pharmacist for the medication (you would include your pharmacists public key here)
 I want to give one coin as transaction fee to the system (we will come back to this later)
 I want to keep the remaining 89 coins
The only thing left to do is digitally sign the transaction record with your private key and transmit the transaction record to your peers in the network. At that point, everyone will receive the information that someone (your virtual identity) is sending money to someone else (your pharmacist’s virtual identity).
Your job is done. However, your medication will not be paid for until the whole network agrees that you really did have 100 coins, and therefore could execute this transaction. Only after your transaction is validated will your pharmacist get the funds and send you the medication.
Cryptocurrency Miners: A New Breed of Agent
Miners are known to be very hard working people who are, in my opinion, heavily underpaid. In the digital world of cryptocurrency, miners play a very similar role, except in this case, they do the computationally-intensive work instead of digging piles of dirt. Unlike real miners, some cryptocurrency miners earned a small fortune over the past five years, but many others lost a fortune on this risky endeavour.
Miners are the core component of the system and their main purpose is to confirm the validity of each and every transaction requested by users.
In order to confirm the validity of your transaction (or a combination of several transactions requested by a few other users), miners will do two things.
First, they will rely on the fact that “everyone knows everything,” meaning that every transaction executed in the system is copied and available to any peer in the network. They will look into the history of your transactions to verify that you actually had 100 coins to begin with. Once your account balance is confirmed, they will generate a specific HASH value. This hash value must have a specific format; it must start with certain number of zeros.
There are two inputs for calculating this HASH value:
 Transaction record data
 Miner’s proof-of-work
Considering that even the smallest change in input data must produce a significant difference in output HASH value, miners have a very difficult task. They need to find a specific value for a proof-of-work variable that will produce a HASH beginning with zeros. If your system requires a minimum of 40 zeros in each validated transaction, the miner will need to calculate approximately 2^40 different HASH values in order to find the right proof-of-work.
Once a miner finds the proper value for proof-of-work, he or she is entitled to a transaction fee (the single coin you were willing to pay), which can be added as part of the validated transaction. Every validated transaction is transmitted to peers in the network and stored in a specific database format known as the Blockchain.
But what happens if the number of miners goes up, and their hardware becomes much more efficient? Bitcoin used to be mined on CPUs, then GPUs and FPGAs, but ultimately miners started designing their own ASIC chips, which were vastly more powerful than these early solutions. As the hash rate goes up, so does the mining difficulty, thus ensuring equilibrium. When more hashing power is introduced into the network, the difficulty goes up and vice versa; if many miners decide to pull the plug because their operation is no longer profitable, difficulty is readjusted to match the new hash rate.
Blockchain for Dummies: The Global Cryptocurrency Ledger
The blockchain contains the history of all transactions performed in the system. Every validated transaction, or batch of transactions, becomes another ring in the chain. Every single blockchain development company relies on this public ledger.
So, the Bitcoin blockchain is, essentially, a public ledger where transactions are listed in a chronological order.
 The first ring in the Bitcoin blockchain is called the Genesis Block
To read more about how the blockchain works, I suggest reading Blockchain Technology Explained: Powering Bitcoin, by Nermin Hajdarbegovic.
There is no limit to how many miners may be active in your system. This means that it is possible for two or more miners to validate the same transaction. If this happens, the system will check the total effort each miner invested in validating the transaction by simply counting zeros. The miner that invested more effort (found more leading zeros) will prevail and his or her block will be accepted.
Controlling The Money Supply
The first rule of the Bitcoin system is that there can be a maximum of 21,000,000 Bitcoins generated. This number has still not been achieved, and according to current trends, it is thought that this number will be reached by the year 2140.
This may cause you to question the usefulness of such a system, because 21 million units doesn’t sound like much. However, Bitcoin system supports fractional values down to the eight decimal (0.00000001). This smallest unit of a bitcoin is called a Satoshi, in honor of Satoshi Nakamoto, the anonymous developer behind the Bitcoin protocol.
New coins are created as a reward to miners for validating transactions. This reward is not the transaction fee that you specified when you created a transaction record, but it is defined by the system. The reward amount decreases over time and eventually will be set to zero once the total number of coins issued (21m) has been reached. When this happens, transaction fees will play a much more important role since miners might choose to prioritize more valuable transactions for validation.
Apart from setting the upper limit in maximum number of coins, the Bitcoin system also uses an interesting way to limit daily production of new coins. By calibrating the minimum number of leading zeros required for a proof-of-work calculation, the time required to validate the transaction, and get a reward of new coins, is always set to approximately 10 minutes. If the time between adding new blocks to the blockchain decreases, the system might require that proof-of-work generates 45 or 50 leading zeros.
So, by limiting how fast and how many new coins can be generated, the Bitcoin system is effectively controlling the money supply.
Start “Printing” Your Own Currency
As you can see, making your own version of Bitcoin is not that difficult. By utilizing existing technology, implemented in an innovative way, you have everything you need for a cryptocurrency.
 All transaction are made over the Internet using P2P communication, thus removing the need for a central authority
 Users can perform anonymous transactions by utilizing asynchronous cryptography and they are identified only by their private key/public key combination
 You have implemented a validated global ledger of all transactions that has been safely copied to every peer in the network
 You have a secured, automated, and controlled money supply, which assures the stability of your currency without the need of central authority
One last thing worth mentioning is that, in its essence, cryptocurrency is a way to transfer anonymous value/information from one user to another in a distributed peer-to-peer network.
Consider replacing coins in your transaction record with random data that might even be encrypted using asynchronous cryptography so only the sender and receiver can decipher it. Now think about applying that to something like the Internet Of Things!
A cryptocurrency system might be an interesting way to enable communication between our stove and toaster.
A number of tech heavyweights are already exploring the use of blockchain technology in IoT platforms, but that’s not the only potential application of this relatively new technology.
If you see no reason to create an alternative currency of your own (other than a practical joke), you could try to use the same or similar approach for something else, such as distributed authentication, creation of virtual currencies used in games, social networks, and other applications, or you could proceed to create a new loyalty program for your e-commerce business, which would reward regular customers with virtual tokens that could be redeemed later on.
”## Further Reading on the Toptal Engineering Blog:
  What Is Bitcoin Mining? How It Works and What It Takes to Make It Pay 
  Demystifying Cryptocurrencies, Blockchain, and ICOs 
  Blockchain Technology Explained: Powering Bitcoin 
  Investing in Cryptocurrencies: The Ultimate Guide 
 
Scale with Speed: The Bitcoin Lightning Network Explained”
  Understanding the basics   What is cryptocurrency? A cryptocurrency is a digital medium of exchange that relies on cryptography to secure and verify transactions. Most cryptocurrencies, such as bitcoin, are decentralized and consensus-based.   What is a blockchain? A blockhain is essentially a digitally-signed financial ledger. Each transaction on the blockchain is visible on the public ledger, and all entries are distributed across the network, requiring consensus about each transaction.   How does a blockchain work? Each transaction executed in the system becomes part of the blockchain, but only after a certain number of nodes reaches a consensus that the transaction is valid. Then, the transaction is added to the blockchain in a new block.
Cryptocurrency for Dummies: Bitcoin and Beyond | Toptal®
https://www.toptal.com/bitcoin/cryptocurrency-for-dummies-bitcoin-and-beyond
https://bitcoinmagazine.com/culture/the-universe-shows-bitcoin-is-mathematically-perfect
Bitcoin Is Mathematically Perfect With Patterns Of The Universe
2022-08-16
Ella Hough
<div><div><p><em>This is an opinion editorial by Ella Hough</em><em>, a student at Cornell University, pursuing degrees in cognitive science and moral psychology.</em></p><p>Recently, I’ve been looking into some of the numbers associated with Bitcoin. While I haven’t exactly come to an overarching conclusion, I find the very common presence of 0, 1, 2, and 6 together fascinating, along with 3 and 9. </p><p>The reason for my fascination came after reading the following quote and explanation of <a href="https://medium.com/the-ascent/why-tesla-called-3-6-and-9-the-secret-of-the-universe-b308d8b77eb6">Nikola Tesla’s theory</a> that “If you only knew the magnificence of 3, 6, and 9, then you would have a key to the universe.”</p><p>I believe Bitcoin is the “key” to solving many of the issues humanity faces, but I was curious if math thought so too.</p><p>Also, possibly irrelevant but still interesting is the lack of 2* or 8 being a solution to any of the equations outlined below. </p><div><figure><figcaption></figcaption></figure></div><p><em>Note: In all instances throughout this article, I add the numerals until I reach 1 digit. </em></p><p>Let’s use the date this was written as an example: August 9, 2022. </p><p>08 + 09 + 2022 = 2039 </p><p>2 + 0 + 3 + 9 = 14 </p><p>1 + 4 = 5</p><p>Answer = 5</p><h2>0, 1, 2 And 6</h2><p>6102. 2,016. 21 and 6 zeroes. 21st century.</p><p>Question: 0, 1, 2, and 6. What do these numbers have in common?</p><p>Answer: Bitcoin.</p><blockquote><p>“Executive Order 6102 is an executive order signed on April 5, 1933, by US President Franklin D. Roosevelt “forbidding the hoarding of gold coin, gold bullion, and gold certificates within the continental United States.” Executive Order 6102 required all persons to deliver on or before May 1, 1933, all but a small amount of gold coin, gold bullion, and gold certificates owned by them to the Federal Reserve in exchange for $20.67 (equivalent to $433 in 2021) per troy ounce” — <a href="https://en.wikipedia.org/wiki/Executive_Order_6102">Executive Order 6102</a></p></blockquote><p>6 + 1 + 0 + 2 = 9</p><p>04 + 05 + 1933 = 1942 → 1 + 9 + 4 + 2 = 16 → 1 + 6 = 7 </p><p>05 + 01 + 1933 = 1939 → 1 + 9 + 3 + 9 = 22 → 2 + 2 = 4</p><p>2 + 0 + 6 + 7 = 15 → 1 + 5 = 6</p><p>4 + 3 + 3 = 10 → 1 + 0 = 1</p><p>2 + 0 + 2 + 1 = 5</p><blockquote><p>“Bitcoin’s mining difficulty is updated every 2,016 blocks. This is why each 2,016 block interval is called the difficulty epoch, as the network determines whether the activities of miners for the last two weeks have reduced or increased the time it takes to mine a new block” — <a href="https://www.coindesk.com/learn/bitcoin-mining-difficulty-everything-you-need-to-know/">Andrey Sergeenkov</a></p></blockquote><p>2 + 0 + 1 + 6 = 9</p><p>This bitcoin mining difficulty update every 2,016 blocks is a palindrome of 6102.</p><p>There are 21,000,000 bitcoin.</p><p>2 + 1 + 6 zeroes = 9</p><p>If you would rather not count “6 zeroes”:</p><p>2 + 1 = 3</p><p>I believe it is no accident there are 21,000,000 bitcoin. I believe the connection between 0, 1, 2 and 6 is purposeful.
This is an opinion editorial by Ella Hough , a student at Cornell University, pursuing degrees in cognitive science and moral psychology.  Recently, I’ve been looking into some of the numbers associated with Bitcoin. While I haven’t exactly come to an overarching conclusion, I find the very common presence of 0, 1, 2, and 6 together fascinating, along with 3 and 9.  The reason for my fascination came after reading the following quote and explanation of Nikola Tesla’s theory that “If you only knew the magnificence of 3, 6, and 9, then you would have a key to the universe.” I believe Bitcoin is the “key” to solving many of the issues humanity faces, but I was curious if math thought so too. Also, possibly irrelevant but still interesting is the lack of 2* or 8 being a solution to any of the equations outlined below.         Note: In all instances throughout this article, I add the numerals until I reach 1 digit.   Let’s use the date this was written as an example: August 9, 2022.  08 + 09 + 2022 = 2039  2 + 0 + 3 + 9 = 14  1 + 4 = 5 Answer = 5 0, 1, 2 And 6 6102. 2,016. 21 and 6 zeroes. 21st century. Question: 0, 1, 2, and 6. What do these numbers have in common? Answer: Bitcoin.  “Executive Order 6102 is an executive order signed on April 5, 1933, by US President Franklin D. Roosevelt “forbidding the hoarding of gold coin, gold bullion, and gold certificates within the continental United States.” Executive Order 6102 required all persons to deliver on or before May 1, 1933, all but a small amount of gold coin, gold bullion, and gold certificates owned by them to the Federal Reserve in exchange for $20.67 (equivalent to $433 in 2021) per troy ounce” — Executive Order 6102   6 + 1 + 0 + 2 = 9 04 + 05 + 1933 = 1942 → 1 + 9 + 4 + 2 = 16 → 1 + 6 = 7  05 + 01 + 1933 = 1939 → 1 + 9 + 3 + 9 = 22 → 2 + 2 = 4 2 + 0 + 6 + 7 = 15 → 1 + 5 = 6 4 + 3 + 3 = 10 → 1 + 0 = 1 2 + 0 + 2 + 1 = 5  “Bitcoin’s mining difficulty is updated every 2,016 blocks. This is why each 2,016 block interval is called the difficulty epoch, as the network determines whether the activities of miners for the last two weeks have reduced or increased the time it takes to mine a new block” — Andrey Sergeenkov   2 + 0 + 1 + 6 = 9 This bitcoin mining difficulty update every 2,016 blocks is a palindrome of 6102. There are 21,000,000 bitcoin. 2 + 1 + 6 zeroes = 9 If you would rather not count “6 zeroes”: 2 + 1 = 3 I believe it is no accident there are 21,000,000 bitcoin. I believe the connection between 0, 1, 2 and 6 is purposeful.
Bitcoin Is Mathematically Perfect With Patterns Of The Universe
https://bitcoinmagazine.com/culture/the-universe-shows-bitcoin-is-mathematically-perfect