Giles Jochim

Mr. Thiel

IB Calculus SL

December 19, 2017

Mathematics behind Bitcoin

Currencies

around the world are always changing and improving upon themselves over their

vast history. 1The first system dates back

to 9000 BC to early man where they would barter excess goods for ones that they

needed like; grains and cattle. Years later

in 1200 BC, cowrie shells were seen around the Indian Ocean as a form of trade

system. Around 1100 BC, China started to

use small replicas that were made of bronze to resemble goods in order to trade. Finally, in 600 BC, King Alyattes of Lydia

(modern day Turkey) made the first “official” currency. For practical reasons they were made into

rounded coins and they would enable the Mediterranean trade world to

flourish. It wasn’t until 2400 plus

years later that a gold coin was minted in Florence. This coin called the Florin would ultimately be

the beginning to international commerce.

After all these years, paper money finally made its first appearance in

AD 1290 when Marco Polo presented the idea of paper to the Europeans. Unfortunately, like many great things, it

took years for paper money to finally catch on in AD 1661. Then in AD 1860, a huge leap for currencies

took place as the industry giants of the Western Union created electronic funds

which were able to transfer via telegram.

The next advancement brought us to the invention that would bring

millions of people into debt. In AD 1946,

John Biggins invented the first credit card called the “Charge-It”. Just twenty years ago the European banks

created the ability for smart phones to do mobile banking. This led us to the next currency in history

that will change the world as we know it.

During

the end of 2008 the economy was dropping.

By January 3rd, 2009, the world began to change with the

introduction of the first cryptocurrency, Bitcoin. This new form of peer-to-peer transaction

cuts out the middleman known as the bank.

In the next nine years the value of one coin would increase from

$0.00076 to $20,042.90 on December 17th, 2017. This 2.6 billion percent increase created an

overall market cap of bitcoin a staggering 350 billion USD. When I personally heard about Bitcoin in

September of 2017, it was just at $3,000 per coin. However interesting this may be, the question

I have been wondering is to what extent does mathematics plays a role in the

bitcoin system?

To begin, the understanding of bitcoin must be developed

and learned. It is essentially a

protocol for peer-to-peer financial transactions and this protocol is

decentralized which means it uses no central bank. Currently there are around 17 million coins

in circulation but there is a maximum amount set at 21 million. However, those

won’t be all released for another hundred plus years because, just like gold,

the difficulty of mining bitcoin increases as there are less and less

available. Due to the limited supply of

coins, bitcoin is somewhat like the gold standard. This leads us to bitcoin mining which is the

equivalent of creating blocks which is like a ledger of every transaction in

that specific time period which goes into the block chain. The block chain is

known as, “a digital ledger in which transactions made in bitcoin or another

cryptocurrency are recorded chronologically and publicly” 2. The block chain gives the security to

transact between peers. More

specifically, the Elliptic Curve Digital Signature Algorithm (ECDSA) provides

the security. It is 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”3. In the terms of bitcoin, the transactions are

“signed” by miners when transferring ownership.

The critical part of mathematics in bitcoin is the ECDSA and that leads

to the question of; how does the ECDSA allow for a peer-to-peer transaction

that is decentralized from all trusted third parties or middlemen?

This exploration will examine the Elliptic Curve Digital

Signature Algorithm and how it created the groundbreaking mathematics that

allows a public key to be created and signed through a private key. Furthermore, it will explore the uses now and

even potential applications of it in the future. The formulas and algorithms are credited to

Dr. Scott Vanstone who lived from 1947 to 2014.4

Understandably,

bitcoin may be very confusing to anyone who is just getting started with this

new advancement in exchanges of currency which reduce barriers globally. The main reason behind this is because

bitcoin’s technology essentially redefines the idea of ownership. Normally, we think of ownership when

referring to anything such as land, a car, or even money as having personal

custody or giving custody over to a bank and other trusted entities.

The

new form of ownership is no longer stored centrally or locally. This means no one person is the owner of

bitcoin. The bitcoin simply lives on a

ledger known as the block chain which is shared through a network of

computers. No one truly owns a

bitcoin. What they have is the

capability to transfer control to someone else.

This is where the Elliptic Curve Digital Signature Algorithm (ECDSA)

comes into play. It uses an elliptic

curve and a finite field in order for third parties to oversee and verify the

“sign off” on transactions while leaving the ability of making the signature

exclusive to the signer.

The

elliptical curve is the first form of mathematics that shows up in the bitcoin

system. An elliptical curve can be shown

algebraically with the equation:

Or y=

(seen

at right)

The

version in bitcoin’s system of ECDSA uses a=0 and b=7 making the equation:

(seen

at right)

The

reason the elliptical curve is used in the verification system is because of

its unique properties such as:

·

5Any

non-vertical line which intersects two points that are non-tangent on the curve

will always intersect a third additional point on the curve.

·

Any non-vertical line that is tangent to

the curve at one select point will intersect just at one other point on the

curve.

Through these properties,

two operations are able to be used called point addition and point doubling.

Point

addition yields the formula which can be defined by taking the third

intersection point of a line R’ reflected across the x-axis.

Point

doubling gives the formula which is when the tangent line to a set point

P is doubled. This leads to finding the

point R’ and having it reflected across the x-axis as well giving the end value

of R.

These

two operations allow for scalar multiplication which is the equation. P is multiplied a times to equal R. For example allow:

9P

Essentially,

scalar multiplication is able to break down the equation into two point

doubling and two point addition.

Next,

a background of finite fields is needed in order to further the process in

ECDSA. When referring to the ECDSA, a

finite field has an already defined range of only positive numbers. All calculations must fall inside this field,

meaning the numbers outside the range have to be represented like remainders in

order to fit. The way this is shown is

through a modulus or mod operator. For

example, 26/9 has the outcome of 2 with a remainder of 8. In the form of a mod

it can be seen as the following:

The

finite field is 9, and all of the mod operations that are over the field have a

result falling within the range of 0 to 9.

The

protocol for bitcoin must select its own set of parameters for the elliptic

curve equation and for its finite field.

These parameters are set for all who use the protocol. Tranquility Halo states that the parameters

include an equation used, a field with a prime module, along with a base point that must falls on the curve. Additionally, the order of the base point, which 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. 6 In the case of bitcoin, it uses extremely

large numbers for all of these parameters involved in the ECDSA. In order to create security in the bitcoin

system the values of these numbers must be enormous. This will prevent hackers

and it ultimately give a feeling of safety to all who use the system. When the values are extremely large it makes

it virtually impossible to reverse engineer the algorithms.

These following values

are provided by Eric Rykwalder for the case of bitcoin:

Elliptic

curve equation:

Prime

modulo:

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

This

formula goes by the name of secp256k1 and it was proposed for the use of

cryptocurrencies. Furthermore, it is a part of the family elliptic curve

solutions over a finite field.

After going over those equations and

formulas it is possible to begin the understanding of private and public

keys. The private key is a random and

unpredictable number chosen between 1 and the order (see above order for

example). Once this private key is

chosen then the public key can be formed by doing scalar multiplication to the

base point (see above for example). In

this case the equation of can be created to form a public key. Essentially what this is saying is that the

limit of possible private keys known as bitcoin addresses is equal to the

order. The fascinating thing about this

is that the order has possible outcomes. To even begin to understand how vast and

enormous this number is would take a while in itself.

To show how much work goes into

finding a public key I will give an example if a very basic private key translated

into a public key. This will simulate

the same procedure that bitcoin would use in creating public keys from a

private. For this the components of

point addition ( will be used.

The example7 is

as followed:

And

point doubling of p to

find r is as follows:

Due to my limited

knowledge of computing the public key from a given private key by using point

doubling and point addition I found a limitation in my writing. In order to continue the explanation of

mathematics involved in bitcoin I found an example8

of a very basic private key which is computed into a public key. The parameters are as followed:

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

The public key will be found first and because this example

has one of the simplest private keys there is it will only involve a single

point doubling operation. The calculation is as followed:

In this situation it is unable to be

divided in a finite field so in order to get around this it must be multiplied

by the inverse which is equal to the following:

The public key coincides with the point

(52, 7). That amount of work was needed

for a private key of 2. You can imagine

the amount of computing needed to do a normal private key. However if trying to reverse engineer this by

trying to get the private key from the public key it is possible. Lucky that is why the actual parameters are

much larger in comparison to prevent this from ever happening. The way the bitcoin system was created makes

this a one-way trip from private to public key.

Now that it is somewhat understood how to go from private to public key

the next step is to “sign” the data or transactions that are sent from one

address to another. The transaction

which make up one block may be of any length.

The first step to signing this block is by hashing the transaction which

will create a 256 bit which is the same as the order seen earlier in the

curve. The algorithm used by bitcoin is

the SHA-256 which unfortunately is another entire idea of math in itself. I would explain it however seeing that it

takes a person a day to do just 0.67 of a hash.

For this situation we will sign the data with z and skip the

hashing. The recipe9

for the signed transaction is made through five steps.

Step

1: An integer “k” that falls between 1 and n – 1 must be chosen.

Step

2: The point must be calculated using

scalar multiplication.

Step

3 Must be

found. If r = 0, then return to step 1.

Step

4: is then found. Again, if s = 0, return to step

1.

Step

5: Finally, the signature is the pair (r, s)

In order for the bitcoin system to

work and be secure, the value of k must be random each time. This will prevent from third parties behind

able to guess it and ultimately hacking into someone’s private key (bitcoin

wallet/address). With the knowledge of

what goes on behind a transaction and the creating of keys, bitcoin is able to

be understood on a larger scale.

Since the creation of bitcoin in the

beginning of 2009 many other entrepreneurs have started to pop up all over the

world trying to improve upon the original bitcoin platform. As of January, there were near nearly fifteen

thousand cryptocurrencies in existence and they will continue to grow in number

over the coming years. Many have tried

to become the next big thing by creating something that is new but what has not

changed yet is the fact that they all use a block chain. More or less, what this mean is all fifteen

thousand are using the Elliptic Curve Digital Signature Algorithm to keep the

system safe, secure, and successful. The

applications of this still extremely new technology will continue to shape the

future as more and more people begin to realize what it is doing to not only a

state or country but the entire world’s economy. One takeaway from this exploration is that

from bartering in 9000 BC to using bitcoin in the 21st century. The constant in society is mathematics. It has improved over the years and it will

not stop any time soon.

Overall, this exploration has gone

over the history of money and how it has improved over the years with math

being the main source of the newest currency bitcoin. Along with a small overview of what bitcoin

is and how it has changed the way the world should see ownership. Finally, it has provided a more in-depth look

at the mathematics that go along with the Elliptic Curve Digital Signature

Algorithm. Through this process the

largest limitation was find more information on such a new form of

mathematics. It required that extra step

to understand how to show what the math was actually showing us. However this may be, it truly opened the

doors to making new realizations of what is going on in the world of math and

how important and equation like can make a difference in society. A simple math equation can create a new form

of currency that millions back and trust now.

Additionally, this has developed a deeper understanding of the

mathematical relationship between public and private keys which was focused on

extensively. Although no full 256 bit

numbers were evaluated, doing the more simple examples shows how complicated

even those are which gives the understanding of how complex a real evaluation

must be. Finally, I hope to have shown

that the bitcoin system is to be trusted and secure and that it will not be

going away for a long time as it has created a new form of currency that will

continue shape the world as we know it.

Bibliography

Bajpai, Prableen. 18. Investopedia. September

17. Accessed Decemeber 20, 2017.

https://www.investopedia.com/terms/b/blockchain.asp.

Burn-Callender, Rebecca. 2014. The Telegraph.

October 20. Accessed December 18, 2017.

http://www.telegraph.co.uk/finance/businessclub/money/11174013/The-history-of-money-from-barter-to-bitcoin.html.

Greg, Tranquility. 2017. Tranquility Halo. November

25. Accessed December 16, 2017.

http://tranquilityhalo.com/category/blockchain/.

Rykwalder, Eric. 2014. coindesk. October 19.

Accessed December 19, 2017. https://www.coindesk.com/math-behind-bitcoin/.

Sullivan, Nick. 2017. Cloudflare Blog. July 28.

Accessed January 23, 2018.

https://blog.cloudflare.com/ecdsa-the-digital-signature-algorithm-of-a-better-internet/.

1 (Burn-Callender 2014)

2 (Bajpai 18)

3 (Greg 2017)

4 (Sullivan 2017)

5 (Greg 2017)

6 (Greg 2017)

7 (Rykwalder 2014)

8 (Rykwalder 2014)

9 (Greg 2017)