How does Bitcoin Work? The Math Behind the Bitcoin


What does it mean to have a bitcoin? How does Bitcoin Work?

Many people have now heard of bitcoin, that’ sit’s a fully digital currency, with no government to issue it and no banks needed to manage accounts and verify transactions.

That no one actually knows who invented it. Yet many people don’t know the answer to this question, at least not in full.

To get there, and to make sure the technical details underlying this answer feel motivated, we’re going to walk through step-by-step how you might have invented your own version of Bitcoin.

How does Bitcoin Work ? - The Math Behind the Bitcoin

We’ll start with you keeping track of payments with your friends using a communal ledger.

Then, as you trust your friends and the world less and less, and if you’re clever enough to bring in a few tools of cryptography to help circumvent the need for trust, what you end up with what’s called a “cryptocurrency”.

Walking the path of inventing your own can help set the foundation for understanding some of the more recent players in the game, and recognizing where there’s room for different design choices.

In fact, how does bitcoin work – one of the reasons I chose this topic in response to the unprecedented leap in attention, investment and… well. How does bitcoin work- I will show you here.

Hype directed at these currencies in just the last year. I won’t comment or speculate on the current or future exchange rates, but I think we’d all agree that anyone looking to buy a cryptocurrency should really know what it is.

How does Bitcoin Work ? - The Math Behind the Bitcoin

One thing worth stressing, by the way, is that even though you and I will dig into the underlying details here, which takes some meaningful time, you don’t actually need to know those details to use a cryptocurrency, just like you don’t need to know the details of what happens under the hood when you swipe a credit card.

Like any other digital payments, there are plenty of user-friendly applications that let you send and receive these currencies very easily.

To start, set aside the thought of cryptocurrencies for a few minutes. We’re going to start the story with something more down to earth: Ledgers, and digital signatures.

If you and your friends exchange money pretty frequently, paying your share of the dinner bill and such, it can be inconvenient to exchange cash all the time.

So, you might keep a communal ledger that records payments you intend to make in the future. How does bitcoin work – At the end of every month, you all look through the list of transactions and tally everything up.

If you’ve spent more than you received, you put that money into the pot, and if you’ve received more than you spent, you take that much money out.

How does Bitcoin Work ? - The Math Behind the Bitcoin

One problem with a public ledger like a thesis that when anyone can add a line, what’s to prevent Bob from going in and writing “Alice pays Bob $100” without Alice approving? How are we supposed to trust that all these transactions are what the sender meant for them to be?

Like a handwritten signature, the idea here is that Alice should be able to add something next to a transaction that proves that she has seen it, and approved of it.

At first, it might seem like digital signatures shouldn’t even be possible, since whatever data makes up the signature can just be read and copied by any computer, so how do you prevent forgeries?

The way this works is that everyone generates what’s called a public key/private key pair, each of which looks like some string of bits.

The private key is sometimes also called the “secret” key so that we can abbreviate it to SK while abbreviating the public keys pk.

How does Bitcoin Work ? - The Math Behind the Bitcoin

As the names suggest, the secret key is something you should keep to yourself. In the real world, your handwritten signature looks the same no matter what document you’re signing.

It looks like a string of 1’s and 0’s, commonly something like 256 bits, and altering the message even slightly completely changes what your signature on that message should look like.

The private key ensures that only you can produce the signature, and the fact that it depends on the message means no one can just copy one of your signatures to forge it on another message.

Hand-in-hand with this is a function to verify that a signature is valid, and this is where the public key comes into play.

All it does it output true or false to indicate if this was a signature created by the private key associated with the public key you use for the verification.

I won’t go into the details how exactly these functions work, but the idea is that it should be completely infeasible to find a valid signature if you don’t know the secret key.

How does Bitcoin Work ? - The Math Behind the Bitcoin

Specifically, there is no strategy better than just guessing and checking if random signatures are valid using the public key until your tone that works.

There are possible signatures without bits, and you’d need to find the one that works. This is a stupidly large number.

In fact, I made a supplemental video devoted just to illustrate what a huge number this is. It is if they knew the secret key associated with the public key.

There’s one slight problem here: If Alice signs a transaction like “Alice pays Bob $100”, even though Bob can’t forge Alice’s signature on new messages, he could just copy

To get around that, we make it so that when you sign a transaction, the message has to include some unique id associated with that transaction.

That way, if Alice pays Bob $100 multiple times, each transaction requires a completely new signature. Alright, great, digital signatures remove a huge aspect of trust in our initial protocol. But even still, this relies on an honours system of sorts.

But what if, for example, Charlie racked up thousands of dollars in debt, and just refuses to show up? The only real reason to revert to cash to settle up is if some people, I’m looking at you Charlie, owe a lot of money.

What you might do is start by having everyone pay $100 into the pot, and have the first few lines of the ledger will read “Alice gets $100, Bob gets $100, etc.

Now, You almost understand how does Bitcoin work and just don’t accept transactions when someone is spending more than they have on the ledger.

How does Bitcoin Work ? - The Math Behind the Bitcoin

Notice, this means you need to know the full history of transactions to verify that a new one is valid. And this is, more or less, going to be true for cryptocurrencies as well, though there is a little room for optimization.

What’s interesting here is that this step somewhat removes the connection between Ledger and physical cash.

In theory, if everyone in the world used this Ledger, you could live your whole life just sending and receiving money on this ledger without ever converting to the real US.

To emphasize this point, let’s start referring to quantities on the ledger as “Ledger Dollars”, or LD for short. You’re of course free to exchange Ledger Dollars for real US dollars, for example, maybe Alice gives Bob a $10 bill in the real world in exchange for him adding and signing the transaction “Bob pays Alice 10 Ledger Dollars” to the communal ledger.

But exchanges like this are not guaranteed in the protocol. It’s now more analogous to how you might exchange Dollars for Euros or any other currency on the open market, it’s just its own independent thing.

Of course, with Bitcoin money doesn’t enter the Ledger with people buying into using cash, I’ll get to how new money enters the ledger in just a few minutes.

Finally, I am sure that you almost understand how does bitcoin work.


Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!