Okay but... how does Bitcoin ACTUALLY work?
Introduction
We all know that bitcoin is this internet thing that has gained a lot of traction over the last decade... but how does it actually work? While many people have heard of Bitcoin, you might have also known that it is a digital currency with no government to issue it and that no banks need to manage your accounts and verify transactions. Created by an anonymous founder, under the pseudonym, Satoshi Nakamoto.
People might have heard buzzwords like 'decentralized', 'safe', and 'unhackable', and yet, many people do not know the answer to the question of how it actually works.
Years ago I watched this video on YouTube from 3Blue1brown, a channel by Grant Sanderson on this subject, which heavily inspired this article. So just as he did, I will attempt and reinterpret his explanation of how Bitcoin actually works by walking through step by step how YOU could have made your own cryptocurrency, and how you might have invented your own version of bitcoin.
The reason why this question is important is not to speculate on the future prices or value of any cryptocurrency. But with the growth in knowledge and awareness of 'Web 3', I think it is valuable and important for people to know how the tech works, and why it may be important.
Although this article will go into the smaller, more technical details without using vague analogies of gold mining, it is also important to know that you do not really need this information just to use crypto or bitcoin. Kind of like how you do not need to know the intricacies of the banking system when using Apply Pay, or swiping your card on a machine.
1 Communal Ledgers and Digital Signatures
1.1. Communal Ledgers
Let's start with something easy. The idea of a public, communal ledger.
Let's say that there are a group of employees, who share a company credit card. Bob, John, Jane, and Joe. To keep track of all their expenses, they share a ledger. Maybe on Excel or spreadsheets, where they record all their expenses, and 'I owe yous'.
So if Jane and John share a cab to and from work, and John pays for the $20 ride one time using the company card, Jane now owes John $10 to split the ride equally.
And so this entry would be recorded as "Jane pays $10 to John, for that cab ride on that specific day and time".
At the end of the month, whatever is on the ledger, say it is just that transaction for now, you settle your debts. If you receive more than you have spent, you take your money out, and if you spent more than you received, you pay up and bring money in. And all of this is done and recorded on the common, communal ledger, in which anyone could add a line or transaction. Eh viola! We have our first set of rules to start from.
We will be building on this set of rules later on and throughout the article. Starting from a simple idea, presenting some issues, and adding more and more amendments to address these issues.
Our rules so far:
So now we encounter our first problem. Which is the fact that anyone could just add a line. So in this case, John could just add the line "Bob pays John $5000" and now Bob would be obliged to settle that transaction on the ledger. To address this problem, you could add another rule. Something called a digital signature. This is like a normal signature, used to verify that both parties agree to settle this transaction at the end of the month. So that the person that pays, needs to sign.
This also applies in our modern, non-crypto world. If you really think about it, even today the payer needs to sign a cheque.
1.2. How Digital Signatures Work
When I am talking about a digital signature in this article I am not referring to a digital copy of your actual signature. Because there is an obvious security risk there as they would be easily copied and pasted. Instead, a digital signature is a string of 'bits'. Bits are just long lines of 1s and 0s. (kind of like this - 110011010101). Now what do we do with these bits? Well, this is where a form of special maths called cryptography comes into play.
But don't worry, we will not be doing any boring complex maths in this article, just exploring ideas and seeing how the maths actually works.
However, from this point forward, this is where things get more dense in terms of new information. So try and keep up.
Now to get into how digital signatures work and how to make one, let us get a short brief on cryptography.
1.3. Public keys and Private (secret) Keys
To make digital signatures impossible to forge, every user of this public ledger needs to make what is called a public key, and a private key. Which also looks like some string of bits.
The private key is also called a secret key, so you could abbreviate SK to mean secret key, and PK to mean public key.
Just as the name indicates, SKs should be... well... secret, while public keys can be shared. These two things, along with a transaction (also known as the 'message') could be used to sign and verify every transaction.
Now the message, SK, and PK are just lines of 1s and 0s that are typically 256 bits long.
The public key, also known as the public wallet address, is just a line of 1s and 0s that people could send bitcoin to (which is the transaction, also referred to as 'the message').
You might be familiar with addresses that also contain letters, but this is actually the same as a line of 1s and 0s, just converted into a 58-character line to improve readability. This is done through something called Base58Check. Which is a calculator that converts something denoted in SHA256 Bits, or 160 bits, into something more readable. Typically in base 58, or 64. But there are other applications that make it into other notations. For example, a similar application is used to convert secret keys, into 10, 12, or 20-word phrases.
So now you have your PK and your SK. The SK is used to sign messages on the digital ledger, and the PK is used to verify. So that if John makes the entry that Jane has to pay him $10, Jane can use her SK to sign the message, while anyone could use their PK to verify.
So producing a signature involves a function that consists of a combination of the message itself, and the SK).
The private key (SK) makes sure that only you could be the one to produce that digital signature because it depends on the message produced. The fact that it also depends on the message, means the digital signature changes for every different transaction made.
This is one of the main differences between digital signatures, and actual signatures. In real life, we sign something by hand, and we verify the transaction or payment to see if the unique handwriting is copied or not. For digital signatures, each signature is different, but it could be used to verify whatever transaction is made.
Along with the ability to sign a message and produce a new digital signature, you have the ability to verify using the public key (PK) and the message.
The idea here is that it should be impossible to re-create a digital signature without the private key associated with that message. And everyone could verify the digital signature by taking the digital signature, the message, and the public key, and seeing the output as whether it is true or false.
Now the next question is: when looking at the above formula, it looks easy to guess the digital signature and come up with a "true" figure when verifying.. right?
Well, a digital signature is a random string of 1s and 0s that is 256 bits long. That is 2^256. Which is 2x2x2... two hundred and fifty-six times. Now to "guess" a digital signature and make it so it will be able to come up with a true output means that you have to guess anywhere between 1 and 2^256 possibilities. So how hard could it be?
Well, 2^256 is a massive number. Like really... REALLY big. Let's put into perspective how big this number is.
Atoms are really small. So small, we cannot really see them. If you were to guess how many atoms were in one drop of water - how big do you think that number would be? Millions? Billions? Trillions? Thousands of trillions? Well, it's around 5 sextillion. Which looks like this: 5,000,000,000,000,000,000,000. That is 5, followed by 21 zeros.
Now that's just in one drop of water, which is 5x10^21. So how many atoms do you think there are in the observable universe? Would that number be bigger or smaller than 2^256?
Well, there are approximately 10^78 atoms in the universe and 2^256 DWARFS that number.
So yeah, the point here is you probably cannot guess the digital signature without having the private key associated with that message. So that when you verify that with the public key, you could be extremely confident that the only way someone would have been able to produce the digital signature is if they had the secret key associated with that message.
There is one more loophole though. If Jane signs that she has to pay John $10, and while John cannot forge her digital signature to make a new message, he could still copy that message and paste it so that Jane has to pay him another $10.
To counteract this, every new message/transaction made on this digital, communal ledger, is coupled with a unique ID on the ledger. This way, Jane has to sign each new message generated with a new digital signature each time.
Now we have digital signatures out of the way, we have a new set of rules we could follow:
You could see in our updated ledger system the unique transaction ID on the left and the signatures on the right.
If you have understood the above concepts of public and private keys, with digital signatures, you are well on your way to fully understanding how bitcoin works. So it's all smooth sailing from here, so for the next part, I will be heavily referring to the explanation found in 3Blue1Brown's Youtube video "But how does bitcoin actually work?" because the way he has laid out these core ideas is actually one of the best I have seen in my Web 3 tenure.
2 The Ledger IS the Currency
Now take the above example of the 4 friends, with our new set of rules, and even with the digital signatures there is another problem that we need to solve. Because you would still have some element of trust as John would need to trust that Jane would pay her debts at the end of the month. So say for example Joe enters loads of transactions where he owes millions of dollars to Bob now, and Bob needs to trust Joe to pay up at the end of the month. In this case, Joe could just run away and not pay his debt.
This is only really the problem if people spend way more than they could pay back. To counteract this, you could simply have Bob, John, Jane, and Joe put some money in the put up front, and just track the payments, making sure that no one spends more than they have paid upfront.
So if everyone has put up $1,000, for a total pot of $4,000 you could have the first four entries in the communal ledger be:
1 Bob Gets paid $1,000
2 Jane Gets paid $1,000
3 John Gets paid $1,000
4 Joe Gets paid $1,000
And then you could just add some transactions onto this ledger like before:
5 Bob pays Jane $700 - 101100110...
6 Bob pays Joe $300 - 1111000111...
and once you have another transaction on this ledger that says:
7 Bob pays John $100 - 01100100...
This transaction gets rejected because the transactions with unique IDs 5, and 6 add up his total amount to be $1,000. So according to the history of the ledger, Bob does not have any money left in his account. And so it would be just as invalid as if it was never digitally signed in the first place.
Now notice, that this system relies on the fact that this could only work if you have a record of all the other transactions since the first point. And this is kind of true when it comes to cryptocurrencies, but also equally true to our traditional, modern banking and financial system.
You see, in our system, it's the banks who are in charge of keeping check of all the ledgers. All the transactions, all savings, finance managers, accountants... Every single trader, investment banker, CFO, and banker. They are entire industries built around "I owe yous". But we could do more digging on the 'normal' finance world in later articles, but for now, let's keep on building our communal digital ledger.
If you rely on the system where you have to pay upfront for your communal ledger account, you could technically live your whole life just dealing with this ledger system, without ever needing to settle the accounts. Think about it, you could always make transactions on this ledger and never have to settle up debts. This is how banks work because what you do when you have an account is:
Since we do not really need to deal with actual cash anymore, we could call the US Dollars in the ledger something else. Now instead of dollars, recorded on the communal ledger, we could just replace that and use a different currency. Say, for example, 'CLDs'. And you can just exchange every CLD for a real dollar anytime you want.
So the entries on the communal ledger would look like this instead of using dollars.
1 Bob Gets paid 1,000 CLDs
2 Jane Gets paid 1,000 CLDs
3 John Gets paid 1,000 CLDs
4 Joe Gets paid 1,000 CLDs
And then you could just add some transactions onto this ledger like before:
5 Bob pays Jane 700 CLDs - 101100110...
6 Bob pays Joe 300 CLDs - 1111000111...
7 Jane pays John 1,200 CLDs - 101011011...
Now keep in mind that you could always exchange CLDs with real dollars. And Jane can even give $100 to Bob and Bob can send Jane 100 CLDs in exchange. The entry would look like this when Jane gives up the cash.
8 Bob pays Jane 100 CLDs - 001101100...
Transactions like the one above are not guaranteed by this digital communal ledger protocol. It's kind of like giving someone some cash for them to send you some to your PayPal account. There is still an element of trust here. Transactions outside of this communal ledger protocol are not guaranteed by the protocol itself. Now this is an important, and crucial point to understand, as we will revisit it in a later article.
Now this is the first important thing to understand about cryptocurrencies like Bitcoin, Ethereum, or any other currency. What it is, is a digital communal ledger, where the list of transactions, and the transaction history, IS the currency.
Of course, with cryptocurrencies like bitcoin, money does not come into the ledger with people buying in using cash, but getting into how new bitcoins enter the ledger is something we will come back to in this article later on. But we need to tackle the biggest difference between Bitcoin and the modern world. Decentralization.
You see, in our example of the digital communal ledger, we had everyone put their money in some pot. But there are some questions you might have addressed already.
In the traditional sense, something like a bank would do all of that for you. But in crypto, we do something else. In crypto, everyone who participates in this digital communal ledger system would keep their own copy of the digital ledger.
And when you have a new entry, like:
8 Bob pays Jane 100 CLDs - 001101100...
This entry gets recorded in every copy that Bob, Jane, John, and Joe keep. Bob would have to broadcast that message and make sure everyone else keeps their own record in their own ledger copy.
This is the main difference between cryptocurrencies, and banks or other financial systems. To remove that last bit of trust where you do not have to host it on a website or put the money upfront in a central pot, we need to make a decentralized system, so that there is no centralized (central) point of control where someone is keeping the money stored somewhere, or hosting the website for the ledger.
Now before we go to make an amendment to our new set of rules, let's look at a story of how this was done centuries ago. Because this system was actually used by people on the Island of Yap. But instead of Bitcoin or 'CLDs', they used massive limestones.
3 The Island of Yap - Using Massive Limestones as Money
STORY TIME!
Many hundred years ago, in a land far far away, during the 17th century, there was a place called the Island of Yap. People on this island were using massive limestones, weighing many tonnes at times. The story goes is the people of Yap were using the barter system when it comes to the exchange of goods. But the barter system is not an efficient way to exchange goods or services. Because how many bushels of corn is a horse worth? Or kilos of rice for a fish? So instead, they had these massive limestones in the village called rai stones.
You see, the people of Yap did not use gold or silver coins as a measure of currency, limestones were kind of rare and very sought after in this place. But it was really hard to carry them around, and they certainly did not keep them in their houses, because they were so heavy. Even if you kept it in your house, the moment you would sell it, you would have to carry it again to the new owner's house.
What the inhabitants did is they placed these rai stones and claimed ownership of them. Everyone just knew who the owner was. And every time someone wanted to sell the stone, say, for example, a ship, the owner of the rai stone would declare it so to all the villagers. So everyone knew who the new owner was. But the stone would remain where it is. It did not physically change hands or places, the only thing that changed was who the owner was.
And they were heavy, so you couldn't steal it, or carry it around. Really the only way you could steal one is if you convinced the majority of the village that there is a new owner. Vote by majority.
The key takeaway here is that they had their own version of a distributed ledger, that everyone had kept in an oral fashion. Worked kind of like an 'ancient' blockchain. Interestingly enough, many people, like the author of The Bitcoin Standard, Saifedean Ammous cite this society as the closest example to how bitcoin and blockchains actually work in the modern day.
领英推荐
If you think about it, there are some modern examples of this. Think of valuable artifacts in a museum. Artifacts or art pieces kept in a museum follow the same logic, where everyone knows the owner, but the custody of the object itself is in the museum or in a public place for everyone to see.
4 The Blockchain: Our Modern-Day Yap Limestones
Going back to the example of Jane, John, Bob, and Joe, we stopped at the fact that everyone could have a distributed system where they all kept their own copy of the ledger. And it was up to everyone making a transaction to make sure they broadcast it for all to record in their ledger. Now, in essence, this is how the blockchain works, and this is a reference to what is called Distributed Ledger Technologies, or DLTs. But, if you think about it, this is still not a good system.
The problem with everyone keeping a record of their own ledgers is that, while in a small example of 4 friends it might look easy, but once you try to implement the protocol so it is available to the whole world things get a bit complicated. To understand why, we must look at our list of rules to make this digital communal ledger protocol.
Recall that rule 3 requires that you must have a record of all the transactions. Ever. So if you opened this protocol to everyone in the world, you could immediately see how difficult this task becomes when every user needs to listen to all the transactions and keep a record of all of them... ever.
If Jane sends John 100 CLDs, how and that message gets broadcasted to Bob, how could Bob be sure that everyone else recorded that same message? How could he be sure that would be the case for all the transactions, and that everyone else is receiving the messages, and in the same order? This is where rule number 4 comes in.
And this is really where the genius of Satoshi Nakamoto comes in. How could someone come up with a rule number 4, for how to accept or reject transactions, and in what order, so that you could be sure that anyone else in the world, using this same protocol, has the exact same personal ledger that looks the same as everyone else? And this is the problem addressed in the original bitcoin whitepaper.
5 The Fourth Rule - The Puzzle Solved in the Original Bitcoin Whitepaper
To get into this, we will need to get into the weeds and explore something called a cryptographic hash function. Don't worry, we'll break this all down bit by bit. For now, what we could say is that rule number 4 involves using computational work. Actual computing power. The idea is that if you use computational work as a basis for what to trust, and combine it with a simple cryptographic hash function, you could make it so that it is basically impossible to have a fraudulent transaction.
Again, this is getting technical, and users of bitcoin and crypto do not need to know this level of detail. But it is important, as it is the basis for why bitcoin and cryptocurrencies exist.
5.1. What is a Secure Hash Algorithm?
So how is computing power used to make all this happen? To do this, let us look at a function. The Secure Hash Algorithm - 256. 256 just refers to the number of bits in the line, and Secure Hash Algorithm is abbreviated to SHA. To get into SHA-256 and what it is, it's a function. Kind of like a calculator, where you put a set set of characters in, and it produces a line of 1s and 0s called a "hash" or a "digest". And it looks random, but it is not random, as it will give you the same set of 1s and 0s every time with any given entry.
If I put my name in SHA-256, the digest or hash is: f632b34625c901ef45e0865dc874ab07ba7e34d609e87b41f293d1f073752f3f
This is in hexadecimal form, converted from the original line of 1s and 0s as it was explained earlier in the article.
You could actually encode anything using SHA-256 and test it yourself on this website: https://www.dcode.fr/sha256-hash
But even if you alter the input ever so slightly, the output message completely changes. In the below figure, I have added one S to the input, and the entire hash changed.
Now this is not just any function. This is a Cryptographic Hash Function. Which means it only works ONE way. You could put the input as "Yousef" and get the same result (f632b34625c901ef45e0865dc874ab07ba7e34d609e87b41f293d1f073752f3f) in this function every time, but you cannot take a string of letters or numbers, whether they are in binary or hexadecimal form and guess the input to arrive at that desired output.
Here is where things get interesting, for any given output there are 2^256 guesses you would need to go through. Keep in mind, that there is absolutely no way to reverse-engineer this function. So the only way to get the input for any desired output is to just guess and check.
It's actually fascinating because there is technically no proof that you cannot cut this process out by reverse-engineering the function, but yet, a huge amount of security protocols. Even those that have nothing to do with cryptocurrencies depend on SHA-256.
5.2. Proof of Work: How SHA-256 Is Used To Measure Computational Work
The SHA-256 function is used to prove that a list of transactions on a digital ledger is associated with a large amount of computational work. Let's get into how exactly that works.
Imagine in one of those copies of those digital ledgers that everyone is keeping, someone comes and says that they found a number, in which when you add that at the end of that list of transactions, and combine it with that list of transactions, and put it through the SHA-256 function it produces a hash where the first 30 bits come out as 0s. How would you think they got that special number?
Well, in the previous section, we explained that you cannot put a hash and get the original input from that hash. So you cannot tell the hash function (SHA-256) to GIVE you a number so that it would produce a hash that starts with 30 zeros. The only thing you could do is just make guesses. And because you actually have to use computing power to make billions of guesses per minute, that actually takes a lot of work to get a special number that would produce a hash that starts with a line with 30 zeros.
The actual probability that you will get a hash/digest that starts with 30 zeros is 1/2^30. Which is around 1 in a billion. So chances are, if someone found that number they would have gone through a billion guesses to get that hash. But here is the catch, you could easily verify this, all you have to do, is take that special number, with the list of the transactions and put it through the SHA-256 function yourself, and it will produce the same exact hash every time.
The idea here is that it takes millions of guesses and a lot of computing power and work to get that special number, but anyone could easily verify it at any time. So the idea here is that because that special number is so hard to actually get, but so easily verifiable, you could just check the number + the list of transactions to see if the hash gets 30 zeros on the first line. And because you know that someone had to have gone through that work to get that number, this is what is called a proof of work. And if you change anything in the list of transactions or that special number, it would produce a completely different hash that won't start with 30 zeros. You would have to go through another billion guesses to do that.
Now that you know how proof of work works, let's go back and apply it to our communal digital ledger.
6 Using Proof of Work to Record The World's Largest and Most Secure Ledger
6.1. Organizing Different Blocks of Transactions in Order
So going back to our communal ledger, the main idea of the bitcoin whitepaper that Satoshi initially came up with is that everyone has to trust whichever ledger has the most computational work put into it. Going back to the previous section, this is easily verifiable.
The way this works is you first need to organize a group of transactions into smaller blocks.
In the same way that a transaction is only valid with a digital signature, we could say that a whole block, which is just a list of valid transactions, is only valid if they have a proof of work assigned to that block. So let us also make it so that a valid proof of work means you have to find a number and combine it with the list of transactions in that block so that it produces a hash that has a line that starts with 60 zeros (like it is displayed above in green).
All that is left is to make sure that all the blocks are in the correct order. And all we have to do to achieve that is make it so every new block has to contain the hash function (that special number) of the previous block.
Including the previous hash in every new block, and making it part of that new block makes it so that THAT hash needs to be accounted for, when finding a new special number, that would generate 60 zeros.
What is achieved here is that if you were to change an older transaction, from an older block, or change the order of two blocks, you would change the hash for all the other blocks generated after it. And you would have to go through all the work to generate a new hash that starts with 60 zeros, for ALL those blocks from scratch.
Now I am sure you have noticed that these separate blocks of transactions in the above figure look like they are chained together when including the hash of the previous block... Yes... That's right... this is WHY it is called a blockchain.
6.2. So What are Miners and What Do They Do?
So with the above in mind, let's update our set of rules for our protocol.
Now with the new update on our set of protocol rules, let us make it available to the whole world so that we could have people contribute, and create new blocks.
What that means is that a block creator would receive messages from people making CLD transactions, collect the transactions and group them into a block, and then do a whole bunch of computational work to find a number that would generate a hash that starts with 60 zeros. And once they find that number, they create a new block and broadcast that new block out to everyone else in the world.
But now the question is, why would anyone do all that work just to create a new block? Well, this is where it gets even more interesting, as we are coming to our new rule. To incentivize people to lend their computers to do all that work, we will allow for a special transaction at the very top of every new block that awards the block creator 500 CLDs. Out of thin air.
This special transaction is what is called a block reward. It is different from a normal transaction because it doesn't actually come from anyone. It came out of thin air. There is no sender, and no signature, and because it came from no one, it actually adds to the total supply of CLDs that are in this shared digital communal ledger. This means that the number of CLDs in this digital ledger economy increased with each new block.
Creating blocks is usually called mining. This is the case for a few reasons. If you think of a miner, they are usually picking at rocks or dirt looking for treasure. This is analogous to creating new blocks, which involves a lot of luck, and mindless work into making guesses to find a special number that creates a new hash for a given list of transactions, to introduce newly added resources to the economy.
So from the miners' perspective, creating new blocks is a mini-lottery. Since all blocks are in one singular chain, everyone has to guess really fast to find the new special number to create the next block. Until one lucky miner, finds the new special number that creates the hash which starts with the right amount of zeros, and they get the block creation reward.
Now all the miners do is:
For people just using this system for payments, all they have to do is listen to whole blocks being broadcasted by miners and just update their own personal copies of the blockchain.
The important distinction here is to go back to our rule when it comes to proof of work. If there are two conflicting blocks being broadcasted out, you listen to the longest blockchain, because as we know, the longest blockchain has the most work put into it.
So now that we have our new added rule, let's compile and see what the protocol looks like now.
7 Hacking the Blockchain
So now that we have all the rules, users, and miners put in place when using this protocol, we have now a way to arrive at a method of sending, receiving, and recording money on a digital ledger that everyone in the network could agree on with full confidence, using the SHA-256 algorithm to prove that the work has been done.
When we say things like "everyone in the network can be confident, and agree on a ledger", another way of saying this is that there is consensus in the network using the proof of work model. This is what is meant by a proof-of-work (PoW) consensus model/method. Furthermore, the fact that we only have to trust the computational work put into the chain of blocks finally removes our need to trust a central authority. Because we remove central authorities, anyone can contribute to the blockchain, but no one could hack, or take away from it, which is what makes it decentralized.
The word 'trust' is thrown around a lot. But really what this means is that no one actually has to trust anything. Because the proof of work consensus model we made above already makes this a trustworthy system. In essence, using our rules and our protocol, we have created a 'trustless' solution.
To understand why this is a trustless solution, let's go through a scenario of what it would take to fool someone using the system.
7.1. Double Spending
Imagine Jane wants to send Bob 1,000 CLDs. So she sends Bob a block containing this transaction, but she does not send this block to anyone else in the network.
From Bob's perspective, he has received 1,000 CLDs from Jane, but from John and Joe's perspective, they think Jane still has that 1,000 CLDs since Jane did not broadcast the block to them.
To do this, Jane would have to find a valid proof of work, to create that new block before all of the other miners. Keep in mind, there are millions of miners and computers in this network all competing to find a valid proof of work, and broadcast it to Bob. Although the probability of this happening is already really low, it could still happen.
But Bob is still going to be hearing the broadcast made by other miners for their own blocks. To keep Bob believing the fraudulent broadcast, Jane would have to keep mining new blocks, and continuously find them before all the other miners. To keep adding blocks to this fraudulent fork on Bob's blockchain. Recall that as per the protocol rules, one of the rules is to always consider the chain with the most number of blocks. So all Bob has to do is wait for new blocks to be broadcast by Jane, and all of the miners. Now if by some miracle chance, Jane was able to compete against the resources of all the other miners in the network, and was able to create new blocks if Jane does not have at least half of the computing power as of all the rest of the miners combined, the chances that she will be able to keep this up and create blocks faster than everyone else becomes overwhelmingly small. Because the chain of blocks that everyone else is working on grows faster than the fraudulent one that Jane is working on. So, after enough time, Bob will eventually reject what he is hearing from Jane, in favor of the longer chain that everyone else is working on.
Remember, this is the case because the rule is that we trust the longer chain because the longer chain is a measure of more computational work put in.
8 Now Forget About 'CLDs' & Apply This to Bitcoin
With all of the above said, our decentralized, digital, communal ledger and the protocol created above is exactly how Bitcoin works... apart from a few key differences. The difference is the actual 'monetary policy' imposed on the bitcoin network.
8.1. Bitcoin's Monetary Policy
The difference between Bitcoin and our CLDs is that in our CLD case, we have arbitrarily said that the rule to produce a hash is that the hash should start with 60 zeros. With bitcoin, it is the same, but instead of fixing the number of zeros, the algorithm changes the requirement so that with every block that is mined, it becomes a little harder to make the next one. This is to address new miners coming in and the computing power added to the network. The idea is that it should be just hard enough for the network to produce one block, every 10 minutes, regardless of how much computing power the network has.
The other difference is that all the bitcoin in circulation was actually introduced from some block reward. In the beginning, the reward was 50 bitcoin per block. But for every 210,000 blocks mined, the reward for new blocks gets cut in half.
So the block rewards would be as follows:
Now the block reward system could be a whole article on its own, but for now, I have linked here a spreadsheet you could refer to for the schedule of block rewards.
Another thing about bitcoin, is that you could split it up into smaller pieces. For example, every dollar could be split into 100 smaller pieces called cents. So $0.01 or $1/100 is one cent. But you cannot split it up smaller than that. With bitcoin, the smaller denomination isn't called cents or 'smaller bitcoin', but they are called Satoshis. And it isn't just divisible by 100, bitcoin can be split up into 100 million smaller pieces. That is 1/100,000,000 or 0.00000001.
You might have heard that the maximum amount of bitcoin that will ever exist will be 21,000,000 BTC, or twenty-one million bitcoin. The way this number is actually calculated is that if the block reward is halved for every 210,000 blocks, eventually the block reward will be so small that it would be less than 1 satoshi, which is not possible in the network. You cannot have something that is less than one Satoshi, it is like trying to buy something for less than one cent.
You see, the first 210,000 blocks the reward is 50 BTC, then the next 210,000 the reward is 25 BTC, then 12.5 BTC, then 6.25 BTC, 3.125, 1.5625, 0.78125, and so on....
Eventually, the block rewards would only be a couple of satoshis. Keep in mind, the block rewards are going down, while the difficulty for mining new blocks increases with every new block created. At the point when the last satoshi is extracted from the last block reward, the number of bitcoin in circulation will eventually be 21,000,000. But this does not mean that miners will stop earning rewards. Let's dig into why that is.
8.2. Transaction Fees and Block Sizes
Remember in our last CLD example, we said that one of the really important rules is to group signed transactions together into smaller blocks. Well the way bitcoin does it, is that these bitcoin blocks are limited to about 1 megabyte (MB) of data you could store onto each block. So the question is if many people want to make a lot of transactions, at the same time, and there is a limited number of transactions miners could put into each block, how could miners choose which transactions to include?
The answer is the bitcoin sender could, purely optionally, choose to include a small fee of bitcoin that would be sent to the miner, to incentivize them to include their transaction on the block. If there are a lot of transactions at any given point in time, or not a lot of active miners, the sender might want to put up higher fees than other people trying to make a transaction as an added incentive for miners to include their transaction on their block.
This fee is usually called the gas fee for a couple of reasons. Some people say its called a gas fee because miners get compared to bus drivers, giving bus passes to passengers looking to pay the most for a ticket, and most people say that in the case of bitcoin, miners use actual electric power, which uses a lot of gas because of all the computing power required for the proof of work consensus mechanism. Which they make back through 'gas fees'.
9 Fun Facts with Not-So-Fun Maths
9.1. When will the last bitcoin be mined?
So now that you have an idea of how bitcoin ACTUALLY works, let's look into some facts you may or may not have heard of before.
The way new block generation works, the idea is that a new block is created every 10 minutes. Knowing that for every 210,000 blocks mined, the block reward gets halved, we could estimate when the last ever bitcoin will be mined.
210,000 x 10 minutes ≈ 4 years - so around every 4 years the block reward is halved.
And the last block with a reward will be the 6,929,999th block (refer to the spreadsheet if you do not trust my math on this).
6,929,999 x 10 minutes ≈ 166 years
Since the first block (called the genesis block) was mined by Satoshi himself in 2009, we could estimate the last bitcoin will be in circulation by the year 2175.
As of writing this article, this math, which was done years ago still applies today. The block rewards have halved around every 4 years since 2009, and the current block reward is 6.25 with a total circulating supply of around 19.46 million.
9.2. When Was Bitcoin Founded and Who Is Satoshi Nakamoto?
While I could write an entirely new article on this, for now, here are some quick cliff notes.
The creator of bitcoin is someone called Satoshi Nakamoto. While this is a pseudonym, the truth is... no one really knows who Satoshi is. Whether this person is a man, woman or a group of people, Satoshi wrote the whitepaper for bitcoin titled: Bitcoin: A Peer-to-Peer Electronic Cash System in 31st of October, 2008. And it was emailed to a small group of cryptography enthusiasts.
9.3. Explore The Blockchain for Yourself
While the whitepaper came out in October 2008, the first ever block was mined by Satoshi himself on the 3rd of January, 2009. This first block is called the Genesis Block.
We know this of course because bitcoin is just a public ledger. A history of all the transactions could be found on the ledger, and there are loads of tools you could use to see for yourself.
One of my favorite, more fun explorers is one that a company called IOHK made, where you could see the bitcoin blockchain and visualize it in 3D.
Because we know that Satoshi sent 50 BTC to himself in the first block, we could look into his wallet address and see how much bitcoin he has.
Note that Satoshi has never made any transactions. Everyone is free to send him any amount of bitcoin since his wallet address is public, but he has never spent any of his bitcoin to date.
10 Conclusion
While I would love to keep you by cramming a million more fun facts about bitcoin on here, it may be worth saving that for future articles. There is so much more to dig into when looking at the crypto world, but knowing the pure basics of how bitcoin actually works is a good place to start. If you fully understand this article, you are well on your way to understanding what most people in the industry don't.
In later articles we could explore things like mem pools, other consensus models used by Ethereum like proof of stake, and how that works NFTs, smart contracts, and much more.
Web Developer @ Trolley E-Commerce Dept.
7 个月Great article, but I can't help wondering why would the founder of bitcoin refrain from spending any of his credit.
Sr. Account Executive @ HAUS | Deep Tech PR
1 年Very interesting, Yousef!
Account Director | Web3
1 年?? Could you make a video on this?