Crypto Basics
Below is a group of basic training for cryptocurrency. It will introduce you to what cryptocurrency is, understanding the basics of cryptocurrency and hopefully provides you with a good overall background on why you should be taking cryptocurrency seriously.
Introduction to Crypto
Learn what a cryptocurrency is and why it is important. There are 20 lessons below for you to read, this is a good high level start to understanding bitcoin.
1. What is a Cryptocurrency?
Cryptocurrencies have become extremely popular in recent years. Not just online, but everywhere.
You’ve probably even seen TV commercials about cryptocurrencies being the next big thing. And maybe even your favorite actor or athlete promoting them.
But what are they?
How are they different from traditional currencies? What makes them so special?
What are cryptocurrencies?
A cryptocurrency (or “crypto”) is an umbrella term for a new kind of “digital money” that relies on a combination of technologies that allows it to exist outside the control of central authorities like governments and banks.
Cryptocurrencies are digital.
Cryptocurrencies have no physical form. There are no dollar bills or metal coins.
They are completely digital, meaning they’re literally just lines of computer code.
Cryptocurrencies are borderless.
Regardless of where you live or who you are, you can send it almost instantaneously to others anywhere in the world, without concern for geographic distance and country borders.
Cryptocurrencies are borderless. All you need is a device, like a phone or a computer, that’s connected to the internet.
Cryptocurrencies are permissionless.
Anybody can send and receive cryptocurrencies. You don’t need to register an account or fill out an application. Cryptocurrencies are permissionless.
You don’t even need to give your name. Instead of names and account numbers, all you need to provide is a computer-generated string of letters and numbers known as an “address”.
This address is not inherently tied to any of your personal information, so you can theoretically send cryptocurrencies to other people without ever knowing each other’s actual identities.
Since you can send and receive cryptocurrencies without giving any personally identifying information, cryptocurrencies provide some degree of privacy.
Cryptocurrencies are decentralized.
Unlike traditional currencies, also known as “fiat” currencies, such as the U.S. dollar, cryptocurrencies are not connected to any government or central bank.
For example, the U.S. dollar is issued and controlled by the Federal Reserve (“Fed”), the euro by the European Central Bank (ECB), and the Japanese yen by the Bank of Japan (BOJ).
This means that, unlike fiat currencies, cryptocurrencies are not controlled by a central authority. There is no bank or government behind them. This defining feature of cryptocurrencies is known as decentralization.
If no central bank or government issues or creates cryptocurrencies, then who createsthem?
Units of a cryptocurrency are generated based on predetermined rules written in codewhich are executed by software.
One of the most important aspects of cryptocurrencies is their supply since this heavily determines their utility and value.
Depending on the rules written in the code of the software, cryptocurrencies can be created and destroyed. Some cryptocurrencies have a finite (or fixed) total supply, meaning that there is a maximum number of units that will ever be in circulation, creating scarcity.
Others are launched with an infinite total supply, meaning there is no maximum cap! (Although there might be a limit on the number of new units that can be created within a certain timeframe such as on a yearly basis.)
Cryptocurrencies are counterfeit-proof.
Cryptocurrencies are also designed to be counterfeit-proof.
This is where cryptography is involved and how it’s used to securely record and store transactions.
In cryptography, the prefix “crypt” means “hidden” and the suffix “graphy” means “writing”.
Before computers existed, cryptography was the study of techniques to keep handwritten information safe from prying eyes.
Even Julius Caesar was known to use cryptography to communicate with his generals.
But in the modern age, cryptography is now associated with protecting computer information using fancy math.
Since cryptocurrencies rely on cryptography for their security, that’s where the ”crypto” comes from in “cryptocurrencies.”
What makes cryptocurrencies special?
Cryptocurrencies exist independently from any government, central bank, or other central institution.
In summary, cryptocurrencies are special because:
- They are digital. Cryptocurrencies have no physical form. Everything is done from phones and computers.
- They are borderless. Anyone with an internet connection can send and receive cryptocurrencies. anywhere in the world, with (usually) smaller fees and faster speeds than traditional money transfers.
- They are permissionless and available to everyone. You don’t need to be approved by a bank and have a bank account to use cryptocurrencies. No third party (like a bank) needed to confirm and approve transactions.
- They provide some degree of privacy, which means that you can make transactions without using your name. Different cryptocurrencies vary in the degree of anonymity they provide.
- They are decentralized, which means governments can’t meddle with or control them. No one person or entity owns or controls them. Users can transact directly without the involvement of any intermediary, which for fiat currencies, would usually be a bank.
- They are created by software. The supply of a cryptocurrency is NOT determined by any central bank but based on predefined rules explicitly written in software code. In other words, software replaces the central bank.
- They are counterfeit-proof. This is due to the way the transaction information is recorded and stored.
Due to these special characteristics, cryptocurrencies provide the potential to give people total control of their money with zero involvement from a third party.
Whether crypto can live up to this potential remains to be seen. Its popularity in the financial world is growing and is now considered an emerging asset class.
2. Crypto As A New Asset Class
In the previous lesson, you were introduced to cryptocurrencies and learned why they’re different from traditional currencies.
Aside from functioning as a new kind of “digital money” that’s used to pay for goods and services, cryptocurrencies are more often used as financial assets that people trade or invest in.
The traditional financial (“TradFi”) industry is still divided on whether crypto should be considered a “financial asset”.
The popular argument is that they’re impossible to value because there are no earnings or dividends, but there are financial assets with similar issues like gold and other commodities.
I view cryptocurrencies as a financial asset. More broadly, I view cryptocurrencies as a brand new asset class. (Currently, a very speculative asset class.)
Asset classes are categories of investments that have similar characteristics and behave in a similar way such as stocks, bonds, commodities, real estate, and cash(fiat currencies).
And now there’s…crypto!
Crypto represents the first truly new asset class in decades. 🤯
Rather than just being used as a means of payment, like to pay for food at a restaurant, most cryptocurrencies are used to make speculative trades or held as investmentsby people who expect their value to rise.
Similar to the forex market, which is the financial market for fiat currencies, there’s now a crypto market, a financial market for cryptocurrencies, where both traders and investors can make money.
But while the forex market is open 24 hours a day, 5.5 days a week, the crypto market is open 24 hours a day, 7 days a week. It never closes!
Traders make bets (“speculate”) on short-term price direction, while investors buy and hold in hopes that certain cryptocurrencies gain wider user adoption and increase in value over the long term.
Adding crypto helps investors diversify their portfolios. And more experienced crypto investors even generate passive income from different cryptocurrencies they hold.
Since cryptocurrencies are financial assets that you can invest or trade, they’re also referred to as “digital assets” or “cryptoassets” or “crypto assets“.
Examples of Crypto
The first cryptocurrency was Bitcoin and it remains the biggest and most well-known.
There are also other well-known cryptocurrencies like Ethereum, Cardano, Solana, Dogecoin, Polkadot, Litecoin, Cosmos, and many others.
Some are similar to Bitcoin. Others are based on different technologies, or have new features that make them totally different from Bitcoin.
The term “cryptocurrency” is actually misleading because, unlike Bitcoin, most cryptocurrencies do not function as actual currencies.
Today, there are now THOUSANDS of cryptocurrencies that have been created, with each trying to offer new or improved functionalities from earlier cryptocurrencies or to serve a totally different purpose or use case.
Unfortunately, many are actually useless or even worse, outright scams, but a lot of people still buy them.
Gullible noobs entering the crypto world hear about “A coin that will not only change the world but change the galaxy!”
They think: “I must buy this Galaticoin!”
They buy the dubious coin and give away their money without understanding the underlying technology.
The cryptocurrency ends up being worthless.
Some people are jumping into the crypto market with the wrong mentality. They believe that it’s a sure bet….that the money they put in will just automatically grow.
With this mentality, it’s not surprising why a scam artist or shiller sees today’s cryptocurrency market like how a tiger sees a herd of one-legged deer.
Lots of delicious opportunities.
Don’t be a one-legged deer.
That’s my mission…
“Don’t let you become a one-legged deer.”
3. Getting Started With Bitcoin
Today, there are thousands of different cryptocurrencies out in the crypto market.
And when prices have surged in the past, the total value of all these cryptocurrencies has exceeded $2.9 trillion, with daily trading volume of over $130 billion.
In other words, the crypto market has grown rapidly and it’s now pretty big. (But still nowhere as huge as the forex market.)
For crypto noobs, just trying to figure out where to begin can feel overwhelming. 😅
So rather than try to learn about the entire crypto market all at once, and get overwhelmed, I’m going to start with Bitcoin.
Since Bitcoin was the original cryptocurrency, the technical breakthroughs that allowed Bitcoin to emerge underlie all other cryptocurrencies.
Understanding Bitcoin, like what it is, where it came from, and how it works provides a solid foundation for being able to navigate the entire crypto space.
Many of the concepts needed to understand Bitcoin can be applied to other cryptocurrencies.
So if you can get a firm enough grasp of Bitcoin to not be mystified by the topic….which is my aim….then you will have a much easier time understanding the rest of the crypto world.
I will start with a gentle introduction to Bitcoin and assume you have little to no technical knowledge.
What is Bitcoin?
Let’s start with a very simple description of Bitcoin….
Bitcoin is a decentralized digital currency, based on an open-source software design, that is used to transmit value between pseudonymous users.
All transactions, after being confirmed by miners using PoW as the consensus mechanism, are stored on a distributed ledger, called a blockchain. Changes to the blockchain are append-only and are synchronized about every 10 minutes across thousands of nodes located all over the world over a P2P network. All information stored on the blockchain can be viewed publicly, in real-time. Cryptographic techniques such as public-key cryptography, hash functions, and digital signatures are used to keep the blockchain secure and immutable so it can be accessible to everybody but hackable to nobody.
Got all that? 🤔
I’m kidding!
But give yourself a pat on the back for actually reading all that and not scrolling past it. (You didn’t scroll past it, right? 👀)
Have no fear. Do NOT be intimidated or discouraged.
This is the BEGINNER’S guide to Bitcoin and we assume zero technical knowledge.
So this is NOT really how we’re going to start learning about Bitcoin.
But as you can clearly see, the crypto world is full of technical jargon!
Jumping into crypto introduces a large number of terms that most people will be unfamiliar with.
The crypto world seems to have its own language and those wishing to learn about the topic can quickly become overwhelmed with all the jargon, acronyms, and other technical terms.
But if you really want to understand cryptocurrencies and how they are different, it’s really important that you do familiarize yourself with certain core foundational concepts.
My goal is to cover terms and phrases that you may initially not know, but do need to know.
Together, we will blast jargon into smithereens so you’re able to easily speak the language of the crypto world with ease.
I’ve also found a lot of inconsistencies in how certain terms are used or defined on the interwebz.
I want to establish a common vocabulary with clear definitions of concepts and terms.
This will help make sure that every time a buzzword or jargon phrase appears throughout our course, it is used consistently and correctly.
I can’t stress enough the importance of learning the concepts behind all this ridiculouswonderful jargon.
How else will you impress your dinner date or wow a crowd at cocktail parties?
Do you give a nervous smile or chuckle when someone mentions crypto because you’re clueless?
Those days will soon be over.
By the end of this course, you WILL be able to understand the geeky definition of Bitcoin that I wrote earlier in this lesson. 🤓
(If you scrolled past it earlier, scroll back up!)
You’ll be knowledgeable enough to be able to approach unfamiliar crypto terminology with confidence.
You’ll go from “crypto clueless” to “crypto competent”. 💪
Now back to Bitcoin….
4. What is Bitcoin?
What is Bitcoin?
Depends on who you ask. If it’s Warren Buffet, he’d say it’s “probably rat poison squared“. (But then invests in a digital bank that focuses on crypto.) 🤔
Unless you’ve been living under a rock or never leave your sofa and just binge-watch Netflix shows all day long, you’ve probably heard of bitcoin.
Bitcoin is known as the original cryptocurrency.
The first of its kind.
Bitcoin is a new kind of “money”, a digital currency that’s designed to let you store, send, and receive “money” online without any banks or other financial institutions.
Unlike fiat currencies, such as the U.S. dollar or the British pound, Bitcoin is not controlled by any central bank or government. Instead, rules that govern its use and supply are controlled by software.
In 2008, Bitcoin was created by a mysterious person calling himself, “Satoshi Nakamoto”.
To this day, his true identity remains anonymous. Nobody knows (at least publicly) who Satoshi Nakamoto is.
Since he’s the creator of Bitcoin, I also like to call Satoshi Nakamoto the “Bitcoin God”.
The Bitcoin God could be a man, woman, group of people or even a highly intelligent space alien. Nobody knows!
What we do know is that on Halloween (October 31) in 2008, Satoshi Nakamoto published a white paper titled “Bitcoin: A Peer-to-Peer Electronic Cash System”.
It was a 12-page summary of the Bitcoin God’s creation. The white paper provided a technical overview of Bitcoin and described how it would all work operationally.
A white paper is a document written by a creator(s) of a crypto project that explains the project’s purpose and provides technical information regarding its underlying technology.
In early January 2009, the first version of Bitcoin software, version 0.1, was released on an obscure mailing list.
The software controls the creation and use of bitcoins and imposes a fixed supply of 21 million. Bitcoins are created through a process called “mining” which now involves specialized computers competing to win a number-guessing game where the winning “miner” is rewarded with brand new bitcoins.
About 19 million of those have been created (or “mined”) so far with the last bitcoin expected to be mined in 2140.
Bitcoin’s fixed supply is in contrast to traditional fiat currencies, such as the U.S. dollar, which can be created at will and in unlimited quantities by central banks.
Bitcoin devotees believe that since there is a limit on the number of bitcoins that will ever exist, this scarcity is where Bitcoin gets its value.
Satoshi Nakamoto made Bitcoin’s source code open to the public and encouraged others to continue developing Bitcoin.
Open source software means the source code is not proprietary. Any developer can view the source code and modify it.
Over time, the original source code was then refined by other software developers, many of whom worked on a voluntary basis similar to the volunteers that write and edit the pages of Wikipedia.
In late April 2011, Satoshi Nakamoto sent one of the software developers a brief email saying, “Yo! I’m out! ✌️”
Just kidding, The real message was, “I’ve moved on to other things.” And then he disappeared, never to be heard from again.
And the rest is history.
Wait. What? He/she/they/it just bounced?!
Yep.
Satoshi Nakamoto ghosted the Bitcoin community! 👻
I don’t know how it feels to be ghosted but I’m sure some of y’all do and I’m sure it feels horrible.
But it’s all good though, the disappearance of its creator wasn’t fatal to Bitcoin.
After more than a decade, Bitcoin continues to run strong, allowing users from around the world to transact in bitcoins with each other.
The first known exchange rate for bitcoin was in October 2009. With $1, you could buy 1,309 bitcoins! 😱
It wasn’t until February 2011 when the price of bitcoin reached parity with the U.S. dollar, where $1 = 1 bitcoin.⚖️
As confidence in Bitcoin grew, so did the demand for the cryptocurrency, which increased its price.
In 2013, bitcoin went from $13 to $1,157! A gain of 8,800%!
In 2017, probably when Bitcoin finally lost its status as an “underground” currency, started the year at $1,000 and almost hit $20,000…before crashing hard.
But Bitcoin has proven that it’s hard to kill.
In November 2021, bitcoin’s price reached an all-time high at $69,000. 🚀
What’s crazy is that Satoshi Nakamoto still owns over 1 million bitcoins! But while the Bitcoin God is now a bazillionaire, becoming rich wasn’t the reason for creating Bitcoin.
In the next lesson, you’ll learn the actual reasons why Bitcoin was made.
5. Why Was Bitcoin Created?
What exactly is Bitcoin?
Depending on who you ask, the word “Bitcoin” can have many different definitions.
And as some start explaining what Bitcoin is, that’s when you’ll typically start hearing tech jargon spewed out.
Words like “blockchain” and “protocol”.And phrases like “peer-to-peer networks” and “distributed ledgers”.
OMG! Jargon overload! 🤮
It’s easy to feel like you’re drowning in a sea of terms. Trying to accurately describe “Bitcoin” can get technical and complicated really fast! 🤯
So rather than go that route, I think a better approach is to start with the PROBLEMS that Bitcoin was trying to solve.
Once you understand that, everything will become much clearer for you and you’ll be able to grasp the technical concepts faster and follow along much more easily.
Why was Bitcoin created?
According to the Bitcoin white paper, Satoshi Nakamoto wanted to create:
“…electronic cash that would allow online payments to be sent directly from one party to another without going through a financial institution.”
Translation:
“Physical cash allows me to transact directly in the REAL WORLD with another person without the need of a bank. I like this freedom. I want this same freedom ONLINE. So I need a digital version of cash or digital cash. ”
Satoshi’s answer: Bitcoin.
The concept of creating a digital version of cash that can be sent around online without a “trusted intermediary” sounds simple but before Satoshi Nakamoto created Bitcoin, all previous attempts were unsuccessful.
This had never been done before.
Let me explain why using an example.
Let’s say that Ursula the Unicorn bakes and sells cupcakes.
These cupcakes are special. They sing. They’re waterproof.
They are singing waterproof cupcakes!
And each cupcake only cost $1. With air delivery, via unicorn, included for free.
Molly the Mermaid wants to buy one cupcake from Ursula.
So they meet up and transact with cold hard cash.
Here’s what happens:
- Molly gives the $1 bill to Ursula.
- The $1 bill is now physically owned by Ursula.
- Ursula trusts that the $1 bill is unique and real.
- The $1 bill is unique and real because it can be verified since it’s issued by a central bank.
- Due to these properties, the $1 bill is used as a medium of exchange…meaning other people are willing to exchange the $1 bill for stuff (“goods and services”) they want.
- Ursula gives the cupcake to Molly.
Now let’s say that Molly is soooo far away that the distance would be even way too far for even Ursula to fly and deliver the cupcake herself. She’ll have to ship it via an air courier service like FedEx or UPS.
Ursula wants Molly to send payment first….online.
But how will Molly handle payment?
How can Molly send cash over the internet?
There lies the problem with cash.
Cash is money in the PHYSICAL form of currency, such as paper banknotes (dollah dollah billz yo!) and metal coins.
But we have a problem….
You can’t send physical cash over the internet!
Buyers and sellers have to be physically present at the same location in order to transact in cash, which isn’t always possible.
Since cash is physical, how do you transfer it online?
By digitizing it…by making it digital.
But if it’s digital, that means it can be easily reproduced (digital counterfeit).
So how do you prevent people from spending their digital money twice (or more)?
So that’s one problem.
There’s another problem.
Molly wants to use cash because she already has some in her wallet. But if she wants to send cash electronically (in digital form), now she has to rely on a financial institution like a bank.
But what if Molly didn’t have an account with a bank? Sorry Molly, no cupcakes for you then.
Fortunately, in this story, Molly does have a bank account.
But when we’re dependent on such financial institutions, this poses a threat or risk.
For example, let’s say the greedy sharks who run the bank love cookies and hate cupcakes.
So the bank, not being a fan of cupcakes, may abuse its power and decide to block Molly’s transaction. The bank will not allow any transactions related to cupcakes!
Say what?! Heartless I tell you!
Or the bank may charge extra fees for non-local transactions.
Or even worse, the bank sees unicorns as evil, along with anybody who does business with unicorns as automatically evil also.
So even though Molly is a mermaid, she’s seen as “evil” because she’s trying to buy cupcakes from a unicorn!
As a result, the bank may freeze Molly’s account and now Molly can’t even access her money. Molly the Mermaid is locked out!
The bank is holding Molly’s money hostage. The bank is the single entity in control of all of her money. Since there is a single entity in charge, this is considered centralized.
“Centralized” means one point or source of control.
Molly just wants her cupcake and is frustrated.
“If I were able to use cash, I wouldn’t have to go through my bank! Gosh, darn it! This sucks!”
“I wish a digital form of cash existed.”
“That I’m in total control of.”
“I want to be able to use this digital form of cash just like the cold hard cash in my tail where I can spend it however I want with whoever I want without needing the approval of any person, company, or institution.”
So Molly basically wants two big things:
- Digital money that can be used online like cash….
- That is decentralized.
Decentralization is the exact opposite of centralization. With decentralization, there is not one single entity in charge.
Decentralized is where control and decision-making is shared among participants.
In terms of money, “decentralization” means that you don’t have to go through an intermediary like a bank or other financial institution.
This would give you the freedom to spend digital money any way you please without the risk of your transactions being blocked or your money being frozen or taken away from you.
Molly wants decentralized digital cash.
But this is actually extremely difficult to accomplish!
Let’s learn why…
6. What Problems Did Bitcoin Solve?
What makes Bitcoin so revolutionary?
Why is it often hailed as a game-changer in the world of money?
As mentioned in an earlier lesson, a mysterious figure who called himself, Satoshi Nakamoto authored a white paper titled, Bitcoin: A Peer-to-Peer Electronic Cash System.
The paper revealed details of creating “electronic” cash” (digital currency) free of control from any organization or government.
During Satoshi Nakamoto’s research though, he discovered there have been multiple attempts in the past to create a digital currency.
There were early pioneers such as b-money, Bit Gold, ecash, E-gold, Hashcash, Liberty Reserve, and RPOW. But they didn’t work out for two main reasons:
- Centralization. These digital currencies were controlled by a central authority which introduced a single point of failure. Having centralized control also created other types of risk. An entity in control could decide to do something shady like create secret amounts of additional money for personal use. Or the system gets hacked and users’ money gets stolen, or the government forces the entity to shut down which means everybody’s money is now worthless.
- Double Spending. There wasn’t a foolproof way to know whether the currency was being duplicated or double-spent (the digital version of counterfeiting money).
So even before Bitcoin was a twinkle in Satoshi’s eye, several attempts have been made to create decentralized electronic money, or digital cash, in the past, but they all failed.😔
For a while, it seemed impossible.
Unlike a photo, PDF, or other documents. you can’t simply attach some money to an email and send it to someone.
Why?
Because whenever you do a transfer of VALUE between two people, you need to make sure that a real transfer has taken place.
For example, let’s say you ran into the Gingerbread Man and were able to get a photo of it.
You want to buy the photo from me so nobody else can have it.
If I send the original digital photo to you, I can simply attach the photo to a text message and send it.
You will receive the photo.
But now, there are TWO copies of the photo. The one attached to the text message and the original file that I have stored on my computer.
What has happened is that I’ve sent you a COPY of the file of the photo, not the original file.
When it comes to sending digital photos, this may not be a big deal (unless you’re a celebrity who loves to take nude selfies and your phone gets hacked).
But when it comes to sending digital MONEY, this is a very big deal.
Let’s return to the cash transaction example involving Molly the Mermaid and Ursula the Unicorn from the previous lesson.
Imagine if Molly scanned her one-dollar bill and named the digital image, “one-dollar.jpg”.
When something is in digital form, it’s easy to copy and duplicate it…as many times as you want.
Where is the value in that?!
Molly can create an infinite number of digital copies of “one-dollar.jpg” and spend it as many times as she wants.
This issue is known as the” double spend” problem.
And if multiple people own the same exact “one-dollar.jpg” image file, then….who is the actual owner?
If you’re trying to spend money digitally, how can you prove that the money transferred is really gone from its original place? That there was an actual change in ownership?
If Molly gives Ursula $1, how can Molly prove that she wasn’t then going to give the same $1to somebody else?
When it comes to digital payments, the net value of all transfers needs to be equal to $0. For example, when Ursula sends $1 to Molly, Ursula should lose $1, and Molly should gain$1.
Before Bitcoin, the only way to send money electronically was through a bank or a payment company like PayPal. (And as mobile phone usage grew, fintech mobile apps like Venmo or M-Pesa.)
Basically, we had to rely on a central authority.
Here’s what happens:
- Molly starts with $1 in her account, and Ursula has $0.
- Molly tells the bank to transfer $1 to Ursula.
- The bank adjusts Molly’s and Ursula’s account balances.
- Molly’s and Ursula’s account balances exist as numbers on a computer.
- Molly and Ursula trust the bank to keep their bank account balances up-to-date and accurate.
If you noticed, there is no physical cash changing hands.
Instead of the physical $1 bill, Ursula and Molly rely on the bank to do a digital transaction on their behalf.
What is a ledger?
The bank keeps track of the accounts of both buyer and seller.
How does a bank keep track of its account balances?
The bank uses a ledger.
The ledger serves two functions:
- The ledger serves as a method for proving ownership, which is done by reading historical data preserved in the ledger.
- The ledger documents any transfer of ownership, which means that new data is produced and written to the ledger.
In a traditional bank transaction, when Molly sends a payment to Ursula, the central authority (the bank) looks at the ledger to make sure that Molly has the funds and then decreases Molly’s bank account balance and increases Ursula’s bank account balance.
Basically, for electronic (non-physical) transfers of money, you need a recordkeeping system.
That’s what the ledger does. It keeps a record of transactions.
In this example, the ledger recorded that Molly transferred $1 (unit of currency) to Ursula. And now Molly has $0.
This prevents the double spending problem.
For online transactions, without these intermediaries, we could theoretically just “copy and paste” money and it’d be impossible to know which transactions were legit or fraudulent.
While relying on central authorities or intermediaries solves the “double spending” problem, this requires you to TRUST them.
Double spending is the process of making two payments with the same funds in order to deceive the recipient of those funds. With physical currency, this isn’t possible. You can’t give two people the same $5 bill With online payments, you must trust a third-party to make sure funds are sent and received properly. Banks, credit card companies, and payment processors validate the transactions themselves and minimize the risk of double spending.
For example, you must trust that your bank maintains your account balances in their ledger accurately and they don’t run off with your money or allow governments to confiscate your money.
Your transaction could also potentially be “censored” by the government, where the bank is pressured to block or reject transactions for political or other reasons.
Having to rely on and trust banks and other third parties are known as the centralization problem.
So to quickly summarize, we currently have two problems with digital money:
PROBLEM #1: Double Spending
The risk of someone being able to spend digital money twice (or more) since anything in digital format can be easily duplicated. This new amount of currency that didn’t previously exist is also known as counterfeit or fraudulent money.
PROBLEM #2: Centralization
In order to solve the “double spending” problem, you have to rely on a third party to maintain and keep track of the change in ownership of funds. But this exposes you to the risk of your digital money. being stolen, confiscated, frozen, or blocked by the third party. You lose control or ownership of your money.
Satoshi Nakamoto figured out how to solve both problems!
Allowing money to move the way text messages or emails do between any two people and without any central intermediary requires a unique solution.
Satoshi’s solution created a NEW way to use money in a digital form that is counterfeit-proof and can be sent directly from one person to another (“peer-to-peer”) without having to go through a financial institution.
No more banks or other intermediaries. No more need to ask permission or get approval from them if you want to transfer money.
But how?
How the heck do you prevent double spending of digital money if you do NOT have a central authority, like a bank, maintaining a ledger and keeping track of who owns what?
Who then maintains the accuracy of the ledger?
Well, if you don’t want to rely on traditional financial institutions, you have to start from scratch and create a totally new SYSTEM.
If you want to skip the bank entirely, you need a new system for tracking value and the transferring of value from one person to the next.
Not wanting to rely on banks or governments means you can NOT be part of any existing financial system.
Why?
Because the money used in existing financial systems is based on conventional currency, also known as “fiat money” such as dollars, euros, yen, pounds, and pesos. And all of these currencies are controlled by their governments which means they are all CENTRALIZED.
That’s exactly what Satoshi Nakamoto wanted to avoid. He didn’t want to rely on a central authority or administrator to manage the ledger.
This means that the system needed to be able to be operated by anyone, without the need to gain permission from some kind of gatekeeper.
The Bitcoin God wanted to use digital money that is DECENTRALIZED.
This decentralization would allow it to be a global form of money, meaning money that transcends national boundaries or governments.
It would be able to operate outside of any government regulation and central banks, which means it is not under the control of any single person or organization.
It would be global, state-free money.
This would allow anyone to make online payments to anyone, anywhere in the world at any time.
If this money had a slogan, it would be this:
“Regardless of where you live in the world, you can spend your money whenever you want on whatever you want with whomever you want.”
Nobody, no company, no authority, no government could stop the transaction. (This is also known as being“censorship-resistant”.)
Satoshi Nakamoto basically wanted an online currency for the internet that would function just like physical cash (“digital cash”), that could NOT be controlled by anyone.
So what did he do?
He went to work to create a brand new system that would do just that.
This new system would be designed to manage the ownership and creation of its own unit of currency.
This new SYSTEM would allow anybody with an internet connection to send, receive, and store this “digital currency.”
This currency would exist independently from any government, central bank, or other financial institution.
This new system would be an alternative to the traditional financial system, which is built around banks.
Since there are no banks, you would not need a bank account. All you would need is a “wallet” which anyone can create. (I’ll discuss wallets in a later lesson.)
Although many of the concepts and technologies underlying Bitcoin already existed in 2008, no one had ever put all the pieces together.
Satoshi Nakamoto took components from the previous attempts of creating decentralized digital cash and was able to combine them in a new and original way.
This new system was basically a successful Frankenstein of different technical innovations he borrowed from earlier attempts at cryptocurrencies and electronic cash in the decades before Bitcoin was launched.
Satoshi Nakamoto named this system, Bitcoin.
Bitcoin vs. bitcoin?
What’s the difference between uppercase “B” and lowercase “b” in Bitcoin?
Bitcoin (capital “B”) is the system that automatically manages the ownership and creation of its own digital units of currency called bitcoins (lowercase “b”).
As a Bitcoin user, you’d say that you have a certain amount of “bitcoins”, similar to how you’d say you have a certain amount of British “pounds”, Nigerian “naira”, Indian “rupees”, or U.S. “dollars”.
“BTC” has been the generally accepted currency code for bitcoin. So 1 bitcoin = 1 BTC.
One bitcoin is divisible to eight decimal places. So it’s possible to own 0.00000001 BTC.
Think of “Bitcoin” (capital “B”) as the brand name for the new system (or concept) that Satoshi Nakamoto created to move “money” around on the internet. And that “money” is denominated NOT in “dollars” or “euros” but in its own unit of account called “bitcoins”.
Why he would name the currency (lowercase “b”) as the same name as the system itself makes it obvious that he never worked in marketing. But at least now YOU know the difference!
There are several components that make the whole Bitcoin system work, so whenever I’m talking about a specific component of the Bitcoin system, I will use “Bitcoin” (capital “B”). For example, “Bitcoin wallet”.
The entire Bitcoin system is run by software that Satoshi Nakamoto created.
The Bitcoin system creates bitcoins and keeps track of the change of ownership of bitcoins.
Let’s imagine that when a $1 bill is freshly printed, the Federal Reserve, the U.S. central bank, starts tracking its change of ownership.
Whenever the $1 bill changes hands from person to person, the Federal Reserve records this on a file. The dollar bill’s entire history of ownership is constantly tracked in sequential order from its creation.
This is basically what the Bitcoin system does. But instead of creating and tracking U.S. dollars (USD), it creates and tracks bitcoins (BTC), its own unit of account.
If you send bitcoin to someone, that transaction becomes an official entry in a file that’s automatically and permanently recorded, so that bitcoin can’t be spent twice.
The file stores all past transactions permanently so that there is a complete historical trail of ownership. This is very powerful since it proves who the current owner is without needing a third party.
And there is NO central authority, like the Federal Reserve, storing and maintaining the file.
Instead, it is stored publicly by a network of computers across the world. This file is replicated and stored on thousands of independent computers and is constantly updated whenever bitcoins change owners.
Every time a transaction occurs, it is batched together with other transactions, and every couple of minutes, the ledger is updated on every computer across the network.
This means that there are thousands of identical copies of this file.
Whenever bitcoins change ownership, the transaction is recorded on EVERY one of the thousands of copies of the file around the world.
The Bitcoin system is constantly comparing all copies of the file to make sure they all have matching transactions. This ensures that all copies are kept in sync.
This “file” is Bitcoin’s ledger.
If you think about it, ANY system to keep track of digital money is just a RECORDKEEPING system.
The way banks works….keeping a central ledger…is one type of recordkeeping system.
When a single entity (like a bank) has control of all financial records, it is considered to be a central ledger.
Bitcoin is a brand new type of recordkeeping system!
Satoshi Nakamoto’s design is what allows Bitcoin to function as a recordkeeping system SEPARATE from the banks and operate totally OUTSIDE the traditional financial system.
Bitcoin does not use a central ledger. Bitcoin’s ledger is a different type of ledger known as a distributed ledger.
7. What is a Distributed Ledger?
What is a distributed ledger?
The first step to understanding how Bitcoin works is to become familiar with the concept of a “distributed ledger“.
In the previous lesson, I explained how Bitcoin is a new type of recordkeeping system that Satoshi Nakamoto created to be able to move money around on the internet.
Bitcoin is a new kind of system that creates digital money designed to achieve two major goals:
- Prevent the double spending problem
- Achieve the first goal without a centralized financial institution like a bank.
Bitcoin achieves these two goals by using an innovative approach on how it keeps a record of transactions and constantly maintains its accuracy.
What is a ledger?
In order to understand Bitcoin’s approach, let’s review how digital transactions work with a traditional bank.
In order to prevent double spending, a ledger is needed.
The ledger keeps track of account balances.
Before Bitcoin, this ledger was always stored by a centralized financial institution like a bank.
Let’s dig a tad bit deeper into WHY a bank is even needed in the first place.
A cool way to explain this is to show an example that attempts to perform a digital transaction without a bank and see how a potential sh*tshow can occur.
Rather than rely on a bank, what if Ursula and Molly keep their own copy of the ledger on their own computers?
This ledger is simply a text file stored on their computer’s hard drive.
When Molly the Mermaid pays Ursula the Unicorn for her magical cupcakes, they both update their digital ledgers (the text file).
If Ursula and Molly both trust each other and promise to keep their ledgers accurate, then this approach could work.
But what if Ursula and Molly do NOT trust each other?
What if Ursula is shady and edits her ledger to show that she never received payment from Molly and tries to ask for another $1?
Imagine Ursula accusing Molly of not paying and showing proof by taking a screenshot of her ledger and sending it to Ned.
Molly rejects her accusation and claims she is lying and shows proof by sending a screenshot of her ledger that clearly shows that $1 was transferred to her.
Whose ledger is correct?!
This will be a never-ending argument. They will never come to an agreement on who is telling the truth.
This is why you need a trusted third party like a bank.
The bank handles the record-keeping of transactions so all parties can agree on who really owns what.
But we don’t want to rely on a bank. We need a different solution.
Here’s an idea…
What if they share the ledger with another friend?
So let’s add Pablo the Polar Bear.
Now we have a network of three friends, instead of just two.
When Molly pays Ursula, everyone’s ledgers get updated at the same time.
In this scenario, if Ursula tries to accuse Molly of not paying, by showing her ledger with a $0 balance, it will be different from Molly’s and Pablo’s ledgers.
Ursula will have a tougher time proving she’s right because Molly can ask Pablo to share his screenshot of the ledger with both of them.
Two out of three ledgers show that Ursula has a $1 balance.
Their ledgers do not agree with her ledger.
Seeing that a majority of all ledgers show that Ursula has a $1 balance, Molly and Pablo come to a consensus and agree that their ledgers are the correct ones and Ursula’s ledger is incorrect.
Sensing defeat, Ursula confesses that she tampered with her ledger.
Now everybody is in consensus that Molly really did transfer ownership of her $1 to Ursula, which means that Ursula does indeed have a $1 balance.
In hopes that both Molly and Pablo would still buy cupcakes from her in the future and to win back their trust, she deletes her ledger and asks them for a copy of their version of the ledger so all three ledgers are back in sync.
This is an example of a distributed ledger.
Not just one person holds the ledger, it’s distributed across multiple people in differentlocations.
(Technically, since the ledger is stored on a computer, it’s distributed across multiple computers which are owned by the people. 🤓)
What is a distributed ledger?
A distributed ledger works because everyone is holding a copy of the SAME ledger. The more trusted people that hold the ledger, the stronger it becomes.
A “distributed ledger” is a ledger that is replicated and stored across multiple locations instead of a single central location.
With a distributed ledger, there is no more need for a bank to keep records. Instead, everyone (collectively) is the bank!
This is the approach that Bitcoin takes.
The core idea behind Bitcoin was to create a single distributed ledger of transactions that is accessible to everyone, where anyone in the world can view balances and submit transactions at any time, but where the ledger is not controlled by any single person, corporation, or government.
In other words, a “distributed ledger” that is “permissionless” and is maintained on a “decentralized” basis.
In reality, this is easier said than done. Let’s see why….
In the example above, because they were all friends, Pablo the Panda held a copy of the ledger, even though he wasn’t part of the transaction.
Without him though, there would be no agreement on the correct ledger. And shady Ursula might attempt more dishonest transactions.
But what if they weren’t friends? Why would Pablo make the effort to store a copy of the ledger on his computer and help validate transactions with no benefit for himself?
While keeping track of transactions on a distributed ledger with just three people on a network is pretty manageable, what if there are thousands of people who want to join the network and send each other money?
You can start to imagine the challenge that arises.
Bitcoin’s network is entirely public, and anyone can participate. While a public ledger allows for many more participants. which potentially strengthens the ledger, it also opens itself up to more shady participants trying to corrupt the ledger.
When a lot of people have a copy of the same ledger, it makes it hard to cheat. But it doesn’t mean cheaters still won’t try.
Within those thousands of people, there are probably going to be a bunch of shady Ursulas so you’re going to need a lot of Pablos to ensure an accurate ledger is used by everyone.
What if there were more people like Ursula? What if there were thousands of shady Ursulas editing their ledgers?
Unlike Ursula, Molly, and Pablo who may know and trust each other, with a totally open and public network like Bitcoin’s, you pretty much can NOT trust anybody.
So with a distributed ledger, the challenges are this:
- How do you incentivize other people who aren’t making transactions to hold a copy of the ledger on their computer and constantly check to make sure transactions are accurate and nobody is cheating?
- And if you have copies of the same ledger floating around on a thousand different computers and no one is in charge, how do you make sure all copies are identical, are updated synchronously, and reflect only honest transactions?
In other words, how do you get a bunch of people who don’t know each other, who don’t trust each other to coordinate and come to a consensus on which ledger is accurate and true?
Consensus is defined as a general agreement on the answer to the following question:
“Which version of the ledger does everyone follow?”
With thousands of people all holding their own copy of the ledger, some of which, like Ursula, may have made malicious edits, what is the consensus mechanism needed to get everyone to agree on the “correct ledger” to keep a copy of and follow?
What makes Bitcoin special is how it figured out how to get these thousands of computers to AGREE in real-time which ledger to hold.
Satoshi Nakamoto figured out a technical solution to overcome these challenges of using a distributed ledger and it was considered a game-changer!
In order to understand HOW, we’ll need to look under the hood of Bitcoin. In the next lesson, we’ll start with a high-level overview of the Bitcoin system.
8. The Bitcoin System and Its Components
What is Bitcoin?
While “Bitcoin” is usually mentioned as a cryptocurrency, it’s more than that.
Bitcoin is actually a system.
Like with any system, the Bitcoin system is a collection of elements or componentsthat work together as a whole.
Let’s take a look at the different components of Bitcoin.
The Bitcoin system is basically just a bunch of computers that “talk” to each other over the internet.
To be able to talk to each other, Bitcoin software is installed on each computer.
The Bitcoin software is open source which means anybody can look at the source code.
Open source means that the software is not owned by anyone or any company. It is free to use and modify. Open source software is code that is designed to be publicly accessible. This means that anyone can see, modify, and distribute the code as they see fit.
This software, known as the Bitcoin client, was created by Satoshi Nakamoto in late 2008.
The original implementation of the software is now known as Bitcoin Core. Satoshi Nakamoto served as the original maintainer of Bitcoin Core until he disappeared in late 2010,
Since then, a bunch of other individuals, called “Core developers” have taken over and now maintain the software.
What does the software do? It runs the Bitcoin protocol.
A protocol is a set of rules or procedures that govern a system. So the Bitcoin protocol is the set of rules that define how the Bitcoin system operates.
For example, there’s a rule that specifies a predetermined amount of bitcoins to ever be in circulation. Another example of a rule specifies what determines a transaction to be valid.
This protocol, or rules, can be described in writing, but in Bitcoin’s case, are expressed in computer code. This computer code is then compiled into software.
Compiled just means that the human-readable computer code written by a programmer(s) is translated into computer-executable machine code.
Anybody can download and install this software.
Because Bitcoin Core’s code is open source, there are now multiple implementations of Bitcoin’s code. But Bitcoin Core remains the most popular, and used as the reference version by other Bitcoin software.
Currently, this software is installed on thousands of computers spread out across the world.
These computers are called Bitcoin nodes.
If the computer (“node”) is connected to the internet and starts running the software, it becomes part of the Bitcoin network.
Once nodes are connected to the Bitcoin network, they start communicating and sharing information with each other.
All right, let’s list out components of the Bitcoin system that’s been mentioned:
- Bitcoin software
- Bitcoin protocol
- Bitcoin nodes
- Bitcoin network
We’re still missing components, but no worries. all will be covered slowly in later lessons.
For now, let’s draw a “map” of the Bitcoin system of what you’ve learned so far.
The “map” looks pretty small right now but just you wait!
As you learn more concepts, we will see it grow! Be prepared to be amazed! 😎
Let’s now learn more about the Bitcoin network.
9. What is a Network?
Instead of a governing body or central organization (like a bank) managing transactions, Bitcoin is run by a network made up of thousands of computers running some software that handles the sending and receiving of bitcoins.
This network of computers is called the Bitcoin network.
Before we dig deeper into the details of the actual Bitcoin network, let’s take a step back first and review what a “network” is.
What is a network?
What’s a network? Or more specifically, what’s a computer network?
A network is just a bunch of computers linked together allowing them to exchange data with each other.
There are two basic ways a network can be arranged:
1. Client-Server Network
The first type of network is known as a “client-server network”.
A client-server network is when there is one centralized computer (called the “server”) that acts as a hub to which other computers (called “clients”) are connected.
Data is requested by computers known as “clients” (such as PCs or even smartphones) and are served by computers called “servers”.
This is the type of network configuration used by banks and popular payment apps like PayPal, Venmo, Apple Pay, and Google Pay.
In conventional digital banking, your laptop or mobile phone acts as an electronic “client” interacting with a central server operated by your bank.
This “hub-and-spoke” network configuration is highly efficient but it’s fragile since the server is a “chokepoint” and becomes a centralized single point of failure (“SPOF”).
If the server goes down, the entire network goes down.
2. Peer-to-Peer Network (P2P)
The second type of network is known as a “peer-to-peer network”.
Where’s the “server”? There is none.
Instead of “servers” and “clients”, computers are simply known as “nodes” since they can function as both client AND server.
A peer-to-peer network, also known as a P2P network, is created when two or more computers are connected and exchange data with each other without going through a separate “server” computer.
In a P2P network, computers are able to “talk” to each other directly.
Instead of a “hub-and-spoke” configuration, a P2P network is structured like a “spider web”.
A popular example of a P2P network is the internet itself.
For folks with a tad bit of gray hair, you may have remembered a famous music-sharing software called Napster. Napster deserves credit for popularizing the use of software that runs on a P2P network. BitTorrent is another one.
In a peer-to-peer network:
- Everyone is connected to each other, so it’s a network.
- Everyone on the network is equal, so they are all considered peers.
Each peer is equal to the others, and each peer has the same rights and duties as the others. Peers are both clients AND servers at the same time.
What the heck does this have to do with Bitcoin?
Remember…Bitcoin runs on a computer network which is known as the Bitcoin network.
And it’s configured as a peer-to-peer (P2P) network!
Why is this important?
In the next lesson, I’ll explain why. 🤔
10. What is the Bitcoin Network?
What is the Bitcoin network?
The Bitcoin network is a peer-to-peer (P2P) network.
From the words of the Bitcoin God himself:
“A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution.”
The Bitcoin network is made up of computers running the Bitcoin software (also known as a Bitcoin client).
The software running is what makes the whole thing work.
Any computer on the Bitcoin network can “talk” with each other directly.
This is different from a client-server network where every computer on the network must first go through a central server.
In the real world, P2P networks don’t look as pretty and organized as above. Not every computer can connect directly with each other because….the world is too big.
So let’s keep it real….
Since there is no central server in a P2P network, it is a decentralized network.
Centralized vs. Decentralized Network
A decentralized network consists of “peers” that can run independently of each other.
Why does this matter?
There are two main reasons:
1. No Central Point of Failure
If one computer goes down, the network continues to run like it never existed. This is different from a centralized network.
In a centralized network configuration, like the client-server network, if the central server goes down, the entire network goes down with it.
This means that the Bitcoin network can not be shut down. Because there is no “server” to take down.
Each computer on the Bitcoin network is independent. If one fails, the network will still run successfully.
2. Decentralized Consensus
When using electronic money to make a payment, like with a bank transfer from your checking account, your transaction has to go through a trusted “middleman” or third party to settle the transaction by deducting funds from one account and adding them to another.
If this middleman settles the transaction, then the transaction is considered valid.
If I transferred you some money, you and I agree the money has actually transferred from my account to yours because we relied on a trusted intermediary or central authority…..the bank.
So in this case, “consensus” on whether the transaction is valid requires centralization.
Bitcoin is different. It uses decentralized consensus.
The idea is that instead of relying on an intermediary, ALL the computers on the Bitcoin network have to come to an agreement by “consensus” on which transactions are valid.
Basically, the middleman is replaced by a network of computers.
HOW all of these computers actually come to a consensus will be explained in a later lesson.
For now, let’s take a look at how the Bitcoin network works.
11. What Does the Bitcoin Network Do?
What does the Bitcoin network do?
As mentioned in the previous lesson, the Bitcoin network is made up of computers running the Bitcoin software. These computers or “machines” are known as Bitcoin nodes.
Bitcoins nodes basically gossip. They love to talk to each other.
But instead of talking about recent drama from the Kardashians, they communicate about what’s going on around the network.
This is done by sending each other messages.
In Bitcoin’s case, each message contains information about a new transaction.
Nodes form a network by connecting and sharing transactions with one another.
This sharing of information (“transaction data”) is what allows all the computers on the network to stay up-to-date, which is pretty important if you want to run a digital currency on the internet.
Who is part of the Bitcoin network?
Any computer that is running a Bitcoin client software is part of the network.
Got an active Internet connection? Then you can join. Anybody can join the Bitcoin network!
Aside from an internet connection, you’ll just need to download and install the software(Bitcoin client) and let the application run on your computer all day long.
Once it’s up and running, the computer will be known as a Bitcoin “node” on the Bitcoin network.
There are no jocks or mean girls who will bully you and try to keep you out. Got a Bitcoin client software up and running on your computer? Welcome to the cool club. You now got node status yo.
In computer geek lingo, a “client” is a piece of hardware or software that connects to a server.
For example, an internet browser like Google Chrome or Apple Safari is a “client” since it connects to a website’s server to request its content
In the context of Bitcoin, a client is a software that connects to other clients in apeer-to-peer manner.
Because all these clients talk to each other, they form a network where each client is a node. There is no Bitcoin “server” for Bitcoin clients to connect to. Every Bitcoin client is, at the same, a server also.
To avoid confusion, this is why the term “node” is typically used in place of “client”.
The Bitcoin network is just a bunch of connected nodes from all over the globe. And there are over 15,000 of them!
Here’s a map showing the geographical distribution of Bitcoin nodes:
When you read Bitcoin (and other cryptocurrencies) described as being “managed by peer-to-peer networks of computers running software,” this is what they mean.
Think of the Bitcoin network as a leaderless network of independent computers (“nodes”) that operate autonomously based on the Bitcoin software.
12. What is a Bitcoin Node?
The Bitcoin network is a peer-to-peer (P2P) network of “nodes”.
In previous lessons, you learned what a network does and what a P2P network is.
But what exactly is a Bitcoin node? What does a Bitcoin node do? How does a Bitcoin node work?
A Bitcoin node, or more specifically, a Bitcoin “full node”, is simply a computer that runs the Bitcoin software (known as a “Bitcoin client” or “Bitcoin client software”).
It could be a desktop PC or laptop as long as it has enough hard drive storage to store historical data.
The terms “node and “full node” are often used synonymously, but there’s actually a difference between the two. That’s because there are two types of nodes: “full node” and “light node” (or “lightweight node”). Full nodes form the backbone of the Bitcion network, while light nodes depend on full nodes for functioning. Since light nodes can’t function on their own, I consider them more as a “barnacle” or a “parasite” since they need to attach themselves to a full node. Going forward, unless specified, when I use the word “node”, I mean “full node”.
What does a Bitcoin node do?
A node does three things:
- Follow rules
- Share information
- Keep a copy of confirmed transactions
1. Follow Rules
Each node (a computer running the Bitcoin software) has been programmed to follow a set of rules.
This is called the Bitcoin protocol.
A protocol is a set of predefined rules that dictates how the network operates, and that all network participants must abide by in order for the network to function.
Each Bitcoin node is autonomous. If you have a computer that runs a Bittcoin client, the network doesn’t “tell you what to do”. Instead, the Bitcoin client already knows what to do, and it makes its own decisions based on the Bitcoin protocol (rules).
Because the rules are predefined and coded into the Bitcoin software, this prevents any disagreement on the Bitcoin network.
By following these rules, a node is able to check the transactions it receives and only relay them if everything is legit.
If there are any problems, the transaction isn’t passed on.
A transaction that does not follow the rules will be rejected by the P2P network of computers.
For example, one rule is that a person must own an equal or greater amount of bitcoins than they are trying to send.
If your node receives a transaction where someone has tried to send more bitcoins than they own, the transaction won’t be passed on to other nodes.
If any member of the Bitcoin network attempts to broadcast false information, all nodes on the network will immediately recognize it as invalid and reject it.
Because each and every node can verify all information on the network itself, there is no need to trust other members of the network. This makes Bitcoin a trustless system.
2. Share information
The primary job of a node is to gossip….to share information with other nodes.
This “information” a node shares are transactions.
There are TWO types of transactions that nodes share:
- Fresh transactions: transactions that have recently entered the network.
- Confirmed transactions: transactions that have been “confirmed” and written to a file. These transactions are not shared individually but are first packaged into BLOCKS before they are shared.
A node shares both “fresh” transactions and blocks of “confirmed” transactions.
What’s a block?
Let’s pretend you go to your local coffee shop and after you pay, you get a receipt that signifies a “transaction” with the barista. You really love going to this coffee shop and after multiple visits, you now have a stack of receipts. You bundle them together. That’s a “block“.
So in Bitcoin, transactions that are bundled together is called a “block”.
Don’t worry too much about blocks or the differences between fresh and confirmed transactions right now. It will all become clear in later lessons.
3. Keep a copy of confirmed transactions
As mentioned above, each node also keeps blocks of “confirmed” transactions.
These are held together in a file called the “blockchain“.
What’s a chain?
For the purposes of this lesson, a “chain” just means that when you create a new block(another bundle of transactions), you hook it onto the previous block. And once hooked, it’s permanent. You can’t “unhook” it.
It’s forever attached to that previous block. So using the coffee shop example I mentioned earlier, imagine a chain of multiple bundles of receipts…that’s a “chain of blocks” or a blockchain.
Fresh transactions travel around the network until they are added to the blockchain, which is just a ledger of confirmed transactions.
There is no single blockchain. Every node has its own copy of the blockchain.
All nodes do their best to stay in sync. If some nodes have outdated copies of the blockchain, other nodes who have the most recent copy of the blockchain will share their copy with them.
The cool thing about each node having its own copy of the blockchain is if one (or more) nodes go offline, the Bitcoin network can continue to still operate! The more nodes that are running, the more difficult it is to shut down Bitcoin.
The network is NOT dependent on any single node. There is no central point of failure. In order to actually kill Bitcoin, every single copy of the blockchain must be destroyed.
Every node is independent. Nodes (computers) can leave and rejoin the network at will.
If a node disconnects from the network and returns, the computer will just download the freshest copy of Bitcoin’s blockchain and it becomes a node again.
Nodes are a critical part of the Bitcoin system. Without nodes, there is no Bitcoin network.
And without the Bitcoin network, there is no blockchain since nodes are needed to store copies of the blockchain.
And with no blockchain, there is no Bitcoin system.
Summary
So far, you’ve learned that the Bitcoin network is:
- a leaderless peer-to-peer network of nodes (computers running Bitcoin software),
- in which every node independently checks that all rules are being followed,
- verifies fresh transactions and
- stores a copy of the blockchain (the ledger of confirmed transactions).
Because every node is doing the same work, there is no central point of failure. There is no centralized server.
In order for fresh transactions to be ADDED to the blockchain, they go through a process called “mining” which is done by a special type of node known as “miners“.
But in order to learn how Bitcoin mining works, we need to take a quick detour.
13. What is Hashing?
Before diving into the subject of Bitcoin mining, we need to take a quick detour and learn about a certain concept that’s foundational to cryptocurrencies.
In order to truly understand how Bitcoin and other cryptocurrencies work, it’s crucial to first understand the concept of “hashing“.
When you see the word, “hash”, some folks might think of hash browns, a popular American breakfast food, while other folks like Snoop Dogg, might think of the cannabis concentrate product. 🌿
In this lesson, I will be talking about a different kind of hash!
It’s a technical concept, but one you must be familiar with so I will break it down for you nice and easy.
Being familiar with the concept of hashing is also needed to understand how Bitcoin mining works (which is the next guide) so please don’t skip over these lessons. 👁️
What is hashing?
Hashing is a method of cryptography that converts any form of data into a unique string of text of fixed length.
Cryptography is the practice and study of techniques for secure communication from outside observers. In the internet era, cryptography is used to protect computer information or “data”.
If it wasn’t already obvious, the “crypto” in cryptocurrencies stands for cryptography.
Hashing is a fundamental part of cryptography. And plays a huge role behind the “crypto” in cryptocurrencies.
In simple terms, hashing means inputting text of ANY length through a hash function which produces an output of a FIXED length.
Any piece of data can be “hashed”, no matter its size, type, or length.
The hash that is produced is always the same length.
In the examples below, using the SHA-1 hash function, regardless of the length of the “input”, the “output” is always 40 characters long.
Here’s a quick comparison of the three examples:
INPUT | HASH |
---|---|
Hello | f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 |
School of Crypto | 1c8780d0b70c5ef42a534846cc042629cf07a440 |
I love crypto | ba73ab65568cd125c2d27a22bbd9e863c10b675d |
Notice that even though the “inputs” varied, all three hashes were still 40 characters long.
In this specific example, the fixed length is 40 characters long, which is determined by the specific hash function used (“SHA-1”), which will be explained later.
For now, just know that other hash functions may output different fixed lengths. Most have fixed lengths that are longer than 40 characters.
A hash acts as a digital fingerprint.
A unique piece of data will always produce the same hash.
For example, if you run “Hello” a million times through a hash function, the above hash is what will appear a million times.
For the word, “Hello”, its SHA-1 hash will always be:
f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0
And only “Hello” will ever produce that hash.
Any change to “Hello” even if it’s just changing it to “hello” and the hash function will produce a totally different hash value.
This is why hashes are known as digital “fingerprints“.
Just like your fingerprint is unique to you, a hash is unique to a specific input of data.
A hash can’t be reversed.
The INPUT into a hash function is called a “preimage” But to keep things simple, I just stick with “input”.
The OUTPUT of the hash function is called “hash value” or “digest” or simply as a “hash”.
A hash function is designed to act in a one-way manner.
Since a hash function is a one-way function, the output, the “hash”, can’t be used to reveal the input, the “preimage”.
This means that if all you see is the hash, you will NOT be able to decipher the original data (the “preimage”) that the hash represents.
Hash functions produce irreversible hashes.
Irreversible means that if you only had the hash you couldn’t use that to figure out what the original piece of data was. This allows the original data to remain secure and unknown.
What is a hash function?
A hash function is a mathematical operation that converts input data of arbitrarylength into an output of fixed length that is executed using a certain algorithm.
An algorithm is just a step-by-step set of instructions for performing calculations that are done by a software program.
It doesn’t matter if the input is a single letter, a word, a full sentence, a page from a book, or an entire book, That’s the arbitrary part.
Each input will produce a unique output expressed as an alphanumeric string of fixedlength.
Alphanumeric just means that something consists of both letters and numbers.
A useful hash function conceals any clues about what the input may have looked like.
For example, it needs to be impossible to determine whether the input was long or short or contained numbers or letters. Also, changing just one character in the input should result in a radically different output.
Popular Hash Functions
All hash functions work in a similar manner. You input data, and the hash function “scrambles” the data and outputs a hash.
Common hash functions include:
- MD-5: Message Digest 5 (MD5) is a common hash function. In the past, it was considered secure but nowadays, hackers have discovered how to decode the algorithm and are able to do so in seconds.
- SHA: Secure Hash Algorithm (SHA) is another type of hash function. There are several variations of SHA grouped into four families: SHA-0, SHA-1, SHA-2, and SHA-3: In general, the higher the number, the more recent the release and the more secure the algorithm.
For our purposes, the only hash function you need to know about right now is the Secure Hash Algorithm (SHA). More specifically, the SHA-2 family since it contains a special member in the family named SHA-256.
SHA-256 is a hash function that converts a string of text into another string that is always the same length: 64 alphanumeric characters long. This is equivalent to 256 bits, which is where the “256” in its name comes from.
It’s special because it’s the hash function used in several parts of the Bitcoin system, which you’ll learn about in later lessons. For now, it’s important to just know that SHA-256 is a type of hash function and the one used by Bitcoin.
Whether the input is a page from a Harry Potter book or the entire series of Harry Potter books. the output of the SHA-265 hash function will always be the SAME length displayed as 64 alphanumeric characters.
Let’s now take a look at how hashing works in crypto.
14. How Does Hashing Work?
How does hashing work?
In the previous lesson, I introduced the concept of hashing and relevant terms. Now, let’s learn how it works!
Hashing is a mathematical operation that is easy to perform, but extremely difficult to reverse.
The hashing process turns a piece of data into binary code, which is just a bunch of 0s and 1s.
Then it breaks up the numbers and applies some secret “jumbling”, which is done by something called the “hash function”.
How does hashing work in crypto?
When used in Bitcoin and other cryptocurrencies, the end result is typically a 64-digit long string of numbers and letters.
Because the conversion is done by a cryptographic algorithm (the “hash function”), the jumbling formula is unknown so the 64-digit string can’t be reversed.
A string is a sequence of characters.
Strings are like sentences. They are formed by a combination of characters.
Think of a hash as a bunch of random letters and numbers.
A unique piece of data will always produce the same hash.
For example, every time the string above is run through the hash function, it will always produce the same hash.
But what happens if we make just a tiny change to the string? (Highlighted in yellow.)
The sentence ends with a question mark instead of a period.
Even though it was a TINY change in the sentence, the hash is TOTALLY different.
You can see how using hashes can be used to detect tampering since even a small change to that input to the hash function results in a totally different output.
It’s very important you remember this point because, in a later lesson, you’ll see how this is used to prevent previous transactions from being tampered with.
The hash function is ONE-WAY only.
You can’t take an existing hash and try to reverse it to find the input string.
So if all you know is the hash, there’s no way to know what the original input is. You can’t “reverse engineer” or hack the hash.
Lastly, the length of the output (the “hash”) does NOT grow with an increase in information in the input. A hash function takes input data of ANY length and returns a value that has a FIXED length.
If you put the entire text of a Harry Potter book, which has over 76,000 words, the hash output will STILL only be 64 characters long.
And again, if you misspell even a single letter in the Harry Potter book, and ran it through the hash function, it would produce a totally different hash from above.
This would allow you to instantly know that the book had been modified without you having to manually inspect the entire book! Pretty neat huh?
15. Examples of Hashing
So far, in earlier lessons, you’ve learned what hashing is and how hashing works.
But in order to truly understand just what these specialized programs do, it’s helpful to see actual examples in action!
Let’s see how the hashing process works using an actual hash function.
Since SHA-256 is the chosen hash function of Bitcoin, let’s use it for our example.
This is our first example input:
SchoolofCrypto is cool as ice.
When put through the SHA-256 hash function, this sentence creates the following hash value, also known as a “digest” or simply as a “hash”:
A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57
You can see that the digest is a combination of letters and numbers. And it is exactly 64 characters in length.
Aside from that, there’s really not much else you can learn from looking at this digest. There are no patterns or clues as to what the input is. It just looks like a bunch of gibberish.
The output may seem random. But there’s no way you could guess the input just by looking at the output.
If you run the input through the SHA-256 hash function again, you will get the exact same output (“hash”) again.
The same input will ALWAYS produce the same output.
Now, let’s make one subtle change to the first example’s input and see what happens:
SchoolofCrypto is cool as lice.
Notice that the letter “l” has been added to the beginning of the word “ice” to spell “lice”. have been
Here’s the new digest:
B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95
Now let’s compare the two:
INPUT | DIGEST |
---|---|
SchoolofCrypto is cool as ice. | A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57 |
SchoolofCrypto is cool as lice. | B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95 |
You can see that this is a radically different result from the first digest!
Even though the inputs were practically identical, changing a single character generated a completely different output.
Lice are pretty disgusting so let’s make one more change to the input:
SchoolofCrypto is cool as rice.
Now let’s see what happens:
FCA7032BE8CF7F3C0DD75B8DEB77412E452EA5E2275BAA4125123CD639ED2C9A
A totally different input once again!
Now let’s compare all three:
INPUT | DIGEST |
---|---|
SchoolofCrypto is cool as ice. | A58E12FAC905B8F84EA2F64F888191A4B66A67CC45F8E7B7B0F94C37A134CB57 |
SchoolofCrypto is cool as lice. | B8784EAEB1FC50719B2041FB1AEE30FF91516529CCB65B4B446CC4D5F6B4EB95 |
SchoolofCrypto is cool as rice. | FCA7032BE8CF7F3C0DD75B8DEB77412E452EA5E2275BAA4125123CD639ED2C9A |
It’s worth emphasizing that literally any input can be put into a hash function.
Regardless of the length of the input, the output will always be the same fixed length and it will always appear completely random.
16. What Is Hashing Used For?
What is the purpose of hashing?
The main purpose of hashing is to verify the integrity of a piece of data.
Since the hash generated is UNIQUE to the input data, it acts as a unique “fingerprint” of the input data.
This makes a hash useful for verifying the integrity of data sent through insecure communication channels like the internet. Data integrity just means that the data has not been altered in an unapproved way.
The hash value of received data can be compared to the hash value of data before it was sent to determine whether the data was altered.
If I post both the message and the hash value I generated from it, you can generate a hash value from the message that you received and compare the hash values.
Using a very simple example, let’s say we’re about to meet up for lunch, and right before I head out the door, I remember our last time together…
While your personality was really nice, your smell was not nice at all. 😬
So I want to send you a message, “Please wear deodorant.”
But before I send this, I run it through a hash function (SHA-256). The hash is:
33ebb528eab107766343d0ac591952bb68ee959d45b7a8b399628e662f3bc1ef
I send you this hash first.*
THEN I send you the actual text message.
Once you receive my message, you think, “WTF? Did he really just say that to me? Or was the message intercepted during transit and the original message was altered?”
So you run the message through the same hash function.
33ebb528eab107766343d0ac591952bb68ee959d45b7a8b399628e662f3bc1ef
You then compare your hash versus the hash that came before the text message.
If both hash values are the same, then this proves that:
- The message was sent correctly.
- That your armpits really do stink!
- The message has not been deliberately altered by someone between me sending it to you and you receiving it.
Of course, in the real world, it is our computers that do all this for us.
And hopefully, you keep your armpits smelling fresh. 😅
*Technically, before I send you the hash, it should be protected in some way, but I wanted to keep the example simple. How the hash stays protected during transit will be covered in a later lesson.
Real-World Example of Hashing: Online Passwords
This might surprise you, but you probably encounter hashing in your daily life….whenever you log in to check your email. 📧
When you create an email address and password, your email provider likely does not save your actual password.
Instead, your email provider runs the password through a hash function and saves the hash of your password.
Every time you attempt to log in to your email account, your email provider hashes the password YOU enter and compares this hash to the hash it has saved.
Only when the two hashes match are you authorized to access your email.
Let’s see why they do NOT save your actual password…
If actual passwords are stored, and hackers get into their system, they can steal them. This is definitely not good for users who use the same password for multiple websites!
A solution is to hash the password…
By hashing a password, the company protects user information. Even if a hacker breaks into the system, they won’t have access to actual passwords, just the hashes.
Remember, hashes are irreversible so it’s impossible for the hacker to figure out what the actual password is just by looking at the hash. Hashing ensures that the data is stored in a scrambled state, so it’s harder to steal.
Whenever you log in, your email provider doesn’t store the plain text password, all they need is the hash.
When you enter your password, it is run through the hash function.
The output is matched against the hash that is saved in the database.
If the hash values are the same, the password is correct.
The wrong password entered would produce a different hash than the one saved. The hashes would NOT match, so your login attempt would FAIL.
So as you can see, a hash function garbles data and makes it unreadable. Even if a hacker gains access to your email provider’s server, the details stored can’t be unscrambled.
17. What is Bitcoin Mining?
What is mining in Bitcoin?
“Mining” is the process of confirming transactions and adding them to the blockchain.
Nodes that participate in mining are known as miners and form a critical part of the Bitcoin network. As part of the mining process, new bitcoins are created, which are “paid” to miners.
A nice way to better understand mining is to first see how BItcoin would work if it did NOT have mining.
Here’s how it’d work.
Let’s say this is a file.
It is stored on a computer.
Think of this file kind of like a Word doc.
And let’s call this file, the “blockchain“.
A blockchain is a distributed ledger of “blocks”.
I’ll dive deeper into blockchain in a later lesson, but for now, just know that each block contains a bundle of transactions.
Now imagine this is the Bitcoin Network.
These are all computers, connected together across the internet, and they’re running the Bitcoin software.
They’re all sharing a copy of the same file, which is the blockchain.
If you want to send a bitcoin to someone, or transfer ownership of a bitcoin to someone else, you would initiate a transaction.
The transaction is just a line of data (in purple).
When you initiate a transaction, it gets sent to a node of the Bitcoin network.
If Bitcoin did NOT have mining, the way this would work is that this computer would record the transaction straight to the blockchain, the shared file.
Then the computer would pass on that transaction to the other nodes it is connected to and they will write the transaction data to their own file.
Those nodes would pass the transaction to every node they’re connected to and would also write the transaction data to their own file.
And so on….
This would continue until the transaction has propagated the ENTIRE Bitcoin network.
And every node has written it to their file.
So that’s a simple way of having a shared file or a shared “ledger” of transactions or a “distributed ledger”.
Notice how ALL computers now have the purple line (transaction) stored on their file(blockchain).
When all the nodes have updated their copy of the file, the ownership of the bitcoin will have changed from one person to the next person.
And that’s an example of a simple Bitcoin transaction. Congratulations!
But we have a problem…
There’s a problem that needs to be solved if we were to do it this way.
Let’s say you want to sell your bitcoin to this purple dude.
So you create a transaction to send bitcoin to the purple dude.
Then you send this transaction to the node on this side of the Bitcoin network.
But let’s say you’re the shady type, and since you can’t help it, you try to do something shady.
Because it’s a network of connected computers, you create a SECOND transaction that sends the SAME bitcoin to a different person like this red dude (on the right side).
Then you send this transaction with the red dude into another node on the network.
WTF?!
You’ve just inserted TWO separate transactions into the network that involves trying to spend the SAME bitcoin!
You can do this because it’s a network of computers located in different places all over the world.
What a sneaky jerk. Congratulations! You are shady as hell!
So what will happen from here is that these two transactions will start propagating across the network.
Some nodes will receive the purple transaction. Other nodes will receive the red transaction.
In the illustration below, when a computer tries to pass on its red transaction, this computer has already received the purple transaction spending this bitcoin so it would reject it
Which is good, but here lies the problem…
Now you have two CONFLICTING transactions on the network.
Remember, every computer on the network needs to all share the SAME EXACT file.
Some computers can’t hold a file with the purple transaction, while others hold a file with the red transaction. They all have to pick one.
ALL computers have to pick the red transaction OR the purple transaction.
If Bitcoin were to operate this way where transactions are written directly to the file, you would create this DOUBLE SPEND problem.
Bitcoin solves this problem!
So how do the computers come to an agreement on which transaction is the legit one?
Mining is the solution.
Bitcoin solves this problem of not having conflicting transactions written to the blockchain, the shared “file”.
And this is where mining comes in.
18. What is a Mempool?
Bitcoin answers the question, “Which transaction to keep?”
The way Bitcoin answers this question is brilliant.
Here’s how…
Every node on the Bitcoin network shares information about new transactions.
Transactions made on the Bitcoin network are NOT directly added to the blockchain. They are first collected and stored in what’s called the”memory pool”.
EVERY computer running the Bitcoin program creates a temporary storage area for transactions called the “memory pool”. Also known as “mempool” for short.
Each Bitcoin node has its own mempool, where it stores the queue of transactions that it has checked and considers valid.
Broadly speaking, a mempool is an organized queue where transactions are stored and sorted before being added to a newly created block.
- The memory pool holds “fresh” or unconfirmed transactions (stored as individual transactions).
- The blockchain holds “archived” or confirmed transactions (packaged in “blocks”).
All bitcoin transactions are simply “unconfirmed” transactions and only exist in the mempool before they’re “confirmed” and added to the blockchain.
In the Bitcoin network, all full nodes have a memory pool.
Let’s say you initiate a transaction on this side of the network (purple transaction).
And then go over here, and use the same bitcoin and insert the red transaction in this computer.
If you notice, these two transactions are NOT written directly to the file. Both transactions are simply stored in the memory pool of each computer first.
So both transactions will propagate across the network.
This computer will REJECT the red transaction because they’ve already received the purple one.
So now BOTH transactions are on the network.
But they are NOT written to the file yet, so the file still hasn’t been updated.
What will happen then is all of these computers will work and try to get their transactions from their memory pool onto the file.
They will compete to be the first ones to get their memory pool transactions added to the top of the file.
Let’s say this computer (in yellow) is the first one to be able to do it.
It adds its transaction from the memory pool into the file:
And when it’s done that….
It will pass their updated copy of the file to everyone else they are connected to….
And they will update their copies.
In the illustration below, this node here receives the updated file that contains the purple transaction spending the same bitcoin.
What happens to the conflicting red transaction in its memory pool?
Since the same bitcoin has already been spent in the purple transaction, it will kick out the red transaction from their memory pool!
This node will then pass on the updated file.
And the other node(s) will do the same thing…it will kick out any conflicting transactions in its memory pool.
All computers now have the updated file.
So that’s how you solve the problem of having two conflicting transactions on the network.
You literally just have a “waiting area” (mempool) for pending transactions and nodes compete and try to add their transactions to the file.
In this example, the purple dude would receive the bitcoin…
But when yo shady self tries to spend the same bitcoin with the red dude, it’s not going to work.
This process of nodes competing to try and get their transactions from their memory pool onto the file (“the blockchain”) is called MINING.
19. What is a Bitcoin Miner?
What is a Bitcoin miner?
Does it involve any picks, shovels, or caves?
NOPE.
In this lesson, I will explain what a Bitcoin miner is.
Here, we have the Bitcoin network again that contains conflicting transactions mentioned in the example. from the previous lesson.
Some nodes contain a “purple ” transaction while others contain a “red ” transaction.
But both transactions are trying to spend the same bitcoin.
How do the computers come to an AGREEMENT on which transaction is the legit one?
This is where “mining” comes in.
Let’s go inside this computer and take a deeper look. 👇
This node is a “miner“.
What is a Bitcoin miner?
A miner node is a Bitcoin full node that does additional work by confirming transactions.
All miners are nodes, but not all nodes are miners. A Bitcoin miner can’t operate without running a node. But a full node is not necessarily a miner.
While a full node will receive, store and broadcast transactions to other nodes, a miner node will do the same but it will also try to create new blocks of transactions and then attempt to broadcast them to other nodes who will then either accept or reject the new block.
As you’ll see in the next lesson, due to the way “mining” works, a miner requires the use of specialized hardware.
If you’re curious, here’s an example of a mining machine. Isn’t it beautiful? 😍
How does a Bitcoin miner “mine”?
Let’s now go deeper and take a look inside a miner and see how it “mines” the transactions from the memory pool onto its file (the “blockchain”).
We’re now looking inside a miner’s memory pool.
It has the purple transaction in there.
But with a memory pool, you can have more than one transaction in there.
So let’s pretend there are more fresh transactions.
For example, this memory pool contains four transactions. (In reality, a memory pool can hold thousands.)
So what does miner do with all these transactions in its memory pool?
It will create a container called a “candidate block”.
Which is just a container for transactions.
The miner will fill this candidate block with transactions from the memory pool.
What is a candidate block?
Think of a candidate block as a temporary block that’s created using transactions selected from the memory pool.
This temporary block is called a “candidate block” because it’s not yet a valid block. Only blocks that have actually been added to the blockchain (which is what the miner is trying to do) are considered valid blocks.
So what this miner will do is fill this candidate block with transactions from the memory pool.
Like so…
Since space is limited, only a limited number of transactions can be included in each block. Miners are incentivized to prioritize the transaction with the highest fees.
And then, it will try and add this “block” of transactions to the file (the “blockchain”).
So how does the candidate block actually get added to the blockchain?
Let’s take a closer look at the candidate block…
20. How Bitcoin Mining Works
How does Bitcoin mining work?
In the previous lesson, you learned what a Bitcoin miner is, how it stores fresh transactions in its memory pool, and then starts the “mining” process by creating a candidate block.
If what I just wrote sounds like a foreign language to you, I strongly recommend you start with the first lesson of my Beginner’s Guide to Bitcoin Mining.
If you’re still with me, let’s take a closer look at the candidate block…
Just like you can be separated into two basic parts with a head and a body, a candidate block can be broken down into two parts:
- Block header (yellow area)
- Block body (gray area)
If we look closer at a candidate block, it actually does NOT just contain transactions.
When a miner creates a candidate block, it includes a “block header” (yellow area).
The “body” of the block (gray area) holds the transactions.
Aside from a candidate block containing a bunch of transactions, it also contains some metadata that provides a “summary” of the block.
Metadata is just data that provide information about other data. In this case, the metadata provides information about the block itself. This information is known as the “block header”.
Inside the block header, there are several pieces of data.
For the purpose of this lesson, I’m going to simplify what’s inside the block header.
Timestamp
The first piece of data inside the Block Header is the “Timestamp”.
The timestamp indicates when the block was created.
Previous Block Hash
The next piece of data is called the “Previous Block” or more specifically, the “Previous Block Hash”.
The Previous Block Hash is the block hash of the prior block in the blockchain.
In order to understand what this means, we need to take a look at the file.
Now that we’re looking inside the file, we can see that the data is structured in a specific way.
Let’s visualize this as the blockchain.
The candidate block that the miner has created has to be added on top of the most recent block.
Let’s say the most recent block is the one colored in blue.
Since the Block Hash of block colored in blue is the most recent block in the file (the “blockchain”), then that’s the block that the miner wants to build on top of.
Think of the Block Hash as like a custom-generated ID number for a block.
So what the miner will do is add this as the “Previous Block Hash” in the Block Header of its OWN candidate block.
“Transaction Summary” Hash
The next piece of data is what I’ll call the “Transaction Summary” Hash.
As the name suggests, it provides a “summary” of all the transactions in the block expressed as a string of characters.
Without going into specifics, what happens is that all the transactions in the block (highlighted in red) are put into a hash function and hashed in a certain order and you end up with a single hash.
This hash is what is used as the “Transaction Summary” Hash.
What this hash provides is a unique “fingerprint” based on all the transactions included in a block.
This helps to ensure that transactions haven’t been tampered with.
This “Transaction Summary” Hash is actually known as the “Merkle Root“. 🤓
Remember, one tiny change in data will totally change the hash. This means if someone were to try to alter any transaction in the block in the future, it would cause the “Transaction Summary” Hash to change and be totally different from the original value that’s in the Block Header.
Basically, changing the transaction would create a totally different “fingerprint” and wouldn’t match the original “fingerprint”.
This change would let everyone instantly know that a transaction(s) was tampered with.
Block Hash
So far, the Block Header contains three pieces of data:
- Timestamp
- Previous Block Hash
- “Transaction Summary” Hash
The next step then is to put this Block Header data into a hash function.
This will produce a random number called the “Block Hash”.
(Although a more accurate name would be the “Block Header Hash” since it’s the hash of just the block header, not the entire block.)
Just like the Previous Block Hash mentioned earlier, think of the Block Hash as a custom-generated ID number that will be assigned to the candidate block.
In order for the miner to get its block added to the blockchain, it must find a Block Hash that meets a certain requirement.
If it can NOT meet this requirement, then the block will NOT be considered valid and the miner can’t add its block to the blockchain.
More specifically, the Block Hash must be a number that starts with a certain number of zeros.
How many zeros exactly?
It varies. The software of the Bitcoin system determines the minimum number of zeros that the Block Hash should begin with.
Originally, the requirement was for only a small number of zeros, but as more and more miners joined, the Bitcoin software started requiring a greater number of zeros.
A miner must generate an output (the “Block Hash”) that satisfies the output threshold set by the Bitcoin software.
This “threshold” just specifies the numbers of zeros that the Block Hash must begin with.
It’s like the “limbo” dance.
The lower the threshold, the more zeros that are required.
The more zeros that are required, the higher the difficulty to find a “correct” Block Hash.
This is because more leading zeros means fewer possible solutions, which means more time is required to “find” a correct Block Hash.
Finding a value that starts with three zeros like “000123…” is much harder than trying to find a value with six zeros like “000000123…”
Here’s a recent example of an actual valid Block Hash:
0000000000000000000586b367c292dfd274bf2e67575cf8b4d00735fc1df6ff
Notice how many zeros it starts with.
The “certain number of zeros” comes from what’s called the “mining difficulty”. This is automatically adjusted up or down by the software running the Bitcoin network. The difficulty changes based on the number of miners. The more computers that are mining, the greater the difficulty and the more zeros are needed at the start making it harder to find the winning nonce.
A Block Hash can be interpreted as a very large number and must be below a certain threshold. This is why block hashes start with a series of zeros followed by an alphanumeric string. Some blocks have as many as twenty leading zeros, while earlier blocks have as few as eight. The number of zeros required roughly demonstrates the difficulty of mining at the time the block was published.
What happens if the Block Hash doesn’t start with the required number of zeros?
Then the block can NOT be added to the file (the “blockchain”).
Fortunately, the miner can have multiple attempts.
But if a miner ran just the Block Header containing just the Timestamp, Previous Block Hash, and “Transaction Summary” Hash through the hash function again, it would always get the same result.
The miner needs to alter the data somehow before trying to hash the Block Header again.
Bitcoin provides a way!
The Nonce
In the Block Header, there is an extra field called the “nonce” (light blue box)
There is a special part of the Bock Header that miners can populate with an arbitrary number.
The miner is free to put any number it wants in.
The nonce is completely separate from the transactions in the block. Its only purpose is to allow miners to fill it with a number, and change the number if the Block Hash doesn’t meet the requirement of starting with a certain number of zeros.
By using a nonce, a miner can manipulate the output of the hash function to “guess” the desired output.
Since the other pieces of data in the Block Header can’t be changed, the only piece of data that can be altered is the nonce.
So if the first hashing attempt of the Block Hader fails, the miner changes the value of the nonce.
You can think of this process as like trying to find the combination of a combination padlock.
There are no shortcuts possible when trying to find the combination of numbers that unlocks it. You have to try every possible combination until at some point, you find the correct one by chance.
You have to guess over and over until you get lucky!
And just as it’s extremely easy and quick to check that a lock combination is the correct one (it either unlocks or doesn’t), it is extremely easy and quick for the miner, and for other nodes after, to check that the nonce is indeed the right one.
The miner is also competing against other miners. The first miner to find a nonce that results in a valid Block Hash is granted the right to add its block into the blockchain and is rewarded for doing so.
For example, let’s say the Block Hash needs to start with at least four zeros.
The only way to find a Block Hash with the required number of initial zeros is to randomly pick a nonce value and run the Block Header through the hash function.
In this scenario, the miner starts with “0” for the nonce value (light blue box).
If that fails to produce the desired result, then all the mincer can do is to try again with a different nonce.
The miner changes the nonce, then starts over again until it manages to find a Block Hash with at least the required minimum number of zeros. In this case, four zeros.
Remember, even though you’ve only made a small adjustment, with a hash function, even the tiniest change will produce completely different results.
So the miner’s first attempt was to use the number “0” in the nonce. It then runs the Block Header through the hash function and sees if the Block Hash starts with four zeros.
As you can see, the Bloch Hash only starts with two zeros so it does NOT meet the criteria needed to add the block to the blockchain.
If the output is not valid, the miner keeps trying with different nonce values.
Since the value of “0” didn’t work, the miner can change the value of the Nonce to“1” (light blue box) and then run the Block Header through the hash function again.
As you can see, the Block Hash starts with no zeros so this doesn’t work either.
Since the value of “1” didn’t work, the miner can change the value of the Nonce to“2” (light blue box) and then run the Block Header through the hash function again.
In this case, the Block Hash finally starts with four zeros and meets the criteria.
It’s a successful Block Hash result! 🎉
As you can see, it’s unpredictable which nonce will produce a Block Hash with the correct number of zeros, so the miner has to keep trying different nonces to find the right value.
Miners can mine for long periods of time with no guarantee that they will ever find a correct nonce. Most never will!
The nonce is used as a counter, where its value is just constantly incremented until either it finds the correct Block Hash or some other miner does.
It’s like a number guessing game!
You’re simply trying to find a hash that begins with a certain number of zeros by changing the value of the nonce.
Miners do this repeatedly….HOPING that the result will produce a Block Hash that meets the criteria.
The more powerful their computers are, the more “guesses” they can make.
This “guessing” process is known as mining.
The “winning” miner is rewarded with a set number of bitcoin (plus transaction fees) called the “block reward.”
One miner wins the block reward roughly every 10 minutes.
Block Reward
Since miners expend so much time and energy to “guess” the correct nonce and confirm transactions on the Bitcoin blockchain, the Bitcoin software rewards them for their effort with:
- Newly created bitcoin When a miner confirms transactions, they are bundled in a block and added to the Bitcoin blockchain. For every new block that gets added to the blockchain, new bitcoins are paid out to the miner. This is known as the block subsidy. The specific amount of bitcoins is based on an issuance schedule determined by the protocol at the time of the block creation. Currently, the new issuance is 6.25 BTC per block and will decrease to 3.125 BTC per block around May 2024.
- Transaction fees. When people transact with bitcoin, they pay a fee to the miners to incentivize them further to confirm their transaction. When a miner confirms a bundle of transactions, it also collects all the fees from each individual transaction.
Mining is a monotonous and repetitive process:
Take a Block Header with the nonce, hash it, see if the hash starts with a certain number of zeros, and if not, repeat the process with a different nonce.
I’m getting sleepy just thinking about it. 😴
So when you read or hear that mining involves ‘“solving complex mathematical problems”, now you know that’s not a correct description.
There is nothing complex about mining! The process itself is pretty simple. You’re just trying to guess a correct number as fast as possible or just fast enough to be the FIRST miner to guess right so your candidate block is the one that gets added to the blockchain. That’s it!
“Hash rate” indicates the “guessing power” of a mining computer. The more hashes you can guess per second, the higher your hash rate. For example, 1 trillion (1,000,000,000) guesses per second is equal to a hash rate of 1 terrahash (TH/s).
Just because the process is simple, it doesn’t mean it’s easy. That’s why it’s called “mining”. You’re trying to “dig” up the correct number which requires a lot of effort, similar to actual mining in the real world.
Now that the miner has found a nonce to be able to generate a Block Hash that meets the requirements (starts with at least 4 zeros), the block is added to the miner’s copy of the file (the “blockchain”).
Remember how the blue block was the most recent block in the miner’s blockchain? Not anymore.
Since the miner was able to guess the correct nonce, it was able to add its block to the blockchain (colored in green).
So from a high-level view, the file on the miner’s computer has been updated (denoted in green).
And then, the node will transmit this block to nearby nodes to which it is directly connected.
The nodes will check it, verify it, and make sure the Block Header produces a Block Hash that meets the criteria. In this case, the Block Hash needed to start with four zeros.
These nodes will update their file (the “blockchain”) by adding the block to the file.
THEIR file will be updated and now be the same version as the winning miner’s (greenfile).
All the transactions in their mempool that are part of this winning block move from “fresh” (or “unconfirmed”) to “confirmed” status and are now permanently added to the file.
Any conflicting transactions will be kicked out.
Thanks to the process of mining, only the purple transaction will make it into the blockchain.
Then these nodes will pass on the block to other nodes.
Once the new block is accepted by a majority of miners, all miners start over and create a brand new candidate block and the mining process repeats itself.
Mining acts as a sorting mechanism for transactions across a network of computers, where “mined” blocks have the final say on what belongs in the blockchain.
The Block Hash from this newly created block will now be used by miners for the “Previous Block Hash” in their candidate blocks.
The Block Hash acts as the “chain”.
Miners must now include the previous block’s Block Hash in the new block they are creating.
For example, this means that to mine block 101, miners need to know the hash of block 100.
Until block 101 has been mined, block 102 can’t be mined.
This forces miners to focus on block 101 which in turn includes the hash of block 100. No miner can skip ahead.
But instead of having each block have a “block number” each block refers to the previous block by its Bock Hash.
This implies that every block is linked to each other and this is what creates a “chain of blocks” known as a blockchain.
This “chain of blocks” is held together not by block numbers, but by block hashes.
Why You Can’t Cheat Bitcoin
Let’s say everyone is working on block 101.
But one miner wants to alter a transaction in block 80.
It would have to make its changes and redo all the computations for blocks 80-100 AND also do block 101.
That’s 21 blocks of expensive computing!
Not only that, but the miner would have to do it all before the other miners on the Bitcoin network finish the current block (block 101) that they’re working on. This is basically impossible.
It is very hard to get away with tampering with any transactions that already form part of the blockchain.
This is what is meant when blockchains are described as immutable.
Proof-of-Work (PoW)
The process of mining is often referred to as a “Proof-of-Work” or PoW.
PoW is known as the “consensus mechanism” that Bitcoin uses to get all nodes to agree on the “official” copy of Bitcoin’s blockchain. It is how Bitcoin is able to reach a consensus without the need for dispute resolution or intervention from a central authority.
The term “proof-of-work” just refers to the fact that it takes “work” to find a block hash below a certain threshold. And once you do, anyone can verify it which provides the “proof”.
The process of “guessing a nonce” and then running the block header through the hash function is being used as a way to prove that you have performed a required amount of “work” on your block.
The first miner to produce a valid hash is allowed to add a new block to the blockchain and they receive a reward of bitcoins.
If a surge of miners joins the Bitcoin network, the PoW will adjust to make it more difficult to find a valid block hash. If this increased difficulty discourages too many miners and they stop mining, the difficulty will be decreased to make it easier to mine.
This process, known as the difficulty adjustment, occurs roughly every two weeks, and it ensures that new blocks are added to the blockchain roughly every 10 minutes, no matter how many miners join or leave the network.
Difficulty adjustments are made based on the speed at which miners are creating new blocks.
By adjusting the difficulty of mining, Bitcoin can ensure new bitcoins are created at a predetermined rate, regardless of the amount of computing power participating in the network.
The difficulty adjustment is important because it ensures that miners can’t mine too much of the supply of the bitcoin too fast.
The specialized computer hardware and electricity required to mine also means that attacking the network is prohibitively expensive. This ensures the security and integrity of Bitcoin’s blockchain.
Anyone with enough computing power to attack the network is better off mining honestly and earning the block reward (new bitcoins plus transaction fees).
Summary
Congratulation! You now know how “mining” in Bitcoin works!
- Miners search for an acceptable hash that will be the “Block Hash” by choosing a nonce, running the hash function, and checking the output.
- If the hash doesn’t have the right amount of leading zeroes, miners change the nonce, run the hash function, and check again.
- When a miner is finally lucky enough to find a nonce that works, and “wins”, the block gets sent out to other nodes (including other miners) in the Bitcoin network, each of whom can then run the hash function with the winning miner’s nonce, and verify that it works.
- If the solution is accepted by a majority of the nodes, the block gets added to the blockchain and the winning miner gets the block reward.
- All miners “reset” and start working on a new candidate block, using the recently mined block’s hash as a reference in their Block Header (as the “Previous Block Header”).
- This process where miners try to “guess” or find a correct nonce is known as a “Proof-of-Work” (PoW).
Now that we’ve learned about miners and mining, let’s update our map of the Bitcoin system:
Huge thanks to babypips.com
Let's Learn Together!
If you're ready to learn, we are read to teach. All my students benefit from our cryptocurrency experience and teaching. If you're looking for a teacher that has the knowledge and can fast track you into the cryptocurrency space then you've come to the right place!