Bitcoin Explained: What You Need To Know
This post gives a fairly detailed overview of the Bitcoin system. I have taken the content from chapter two of The Crypto Portfolio.
Bitcoin was the first blockchain based cryptocurrency. It was also the second most searched term in Google in the Global News category in 2017—right behind Hurricane Irma. On that note, I’m guessing you already know a bit about Bitcoin, so I hope this post adds to your knowledge in some way.
Bitcoin is two things:
- A digital form of money that people can use to buy stuff with (bitcoin with a small ‘b’).
- A system that supports the use of that digital money (Bitcoin with a big ‘B’).
Bitcoin as digital money
Digital money is a way to transfer value online. This can be through mobile phone apps, credit cards, PayPal, air miles, gift vouchers, supermarket reward points, online money transfers and so on. With digital money, we don’t need to carry cash around in order to buy stuff; we can buy most things online from anywhere in the world.
Bitcoin is a form of digital money that has no middleman. The next example explains how a simple bitcoin transaction works:
Jim and Jane using Bitcoin as digital money
Jane sells her car to Jim for £5,000 (1.18965 bitcoins at the time of writing) but wants Jim to pay her in bitcoin. To do this, Jim needs either:
- Jane’s Bitcoin address. This is a unique 26 to 35-character sequence made up of numbers and letters. It starts with the number 1 or 3. Or;
- Jane’s QR code. This is a unique barcode for Jane’s Bitcoin address.
To save time, Jim goes with choice two.
Jane now opens a mobile bitcoin wallet app on her phone and gets to a screen that looks like this:
Jane wants to sell her car for GBP 5,000 worth of bitcoin. When she enters GBP 5,000, the app automatically generates a unique QR code for that amount in bitcoin—or BTC 1.18965.
Jane taps the request button at the bottom of her screen. Her phone now gives her the choice to send the BTC 1.18965 payment request (given by the unique QR code) to Jim by text message, email or WhatsApp.
Jim gets a text message from Jane with the payment request link. He clicks the link, which takes him to his own mobile bitcoin wallet app.
When Jim’s app opens, he makes sure he’s happy with the transaction before clicking send.
After about 10 minutes, Jane receives the BTC 1.18965 and hands Jim the car keys.
The Bitcoin system
All bitcoin transactions are recorded and confirmed on the Bitcoin blockchain. This is a public online record (or ledger) of who bought what. Before transactions are confirmed on the blockchain, the global Bitcoin network, made up of computers from all over the world called nodes, records them in real time. Here’s what the latest transactions look like on the blockchain:
The transactions form a chain of ownership (blockchain) on the bitcoin network. So, if Jane buys a motorbike from Tom with some of the bitcoins she got from Jim for the car, those bitcoin transactions are chained together.
Rather than record who was involved, the network produces a hash for each transaction. A hash is a unique encryption code used in cryptography—hence the word cryptocurrency.
Bitcoin transaction hashing is the process where data for each transaction is encrypted into a random string of letters and numbers (or a hash) as shown in the screenshot on the last page.
More on hashing
Hashing is an encryption process which takes inputs and encrypts them (hashes them together) into a random string of outputs. For example, the word ‘desk’ (the input letters) could be hashed into the random output string 400s56xqIk.
The word desk is now encrypted into a hash (400s56xqIk). Anyone looking at the hash (400s56xqIk) would need a specific key to know the input (desk). Without that key, the hash is virtually impossible to decrypt, even with all the computing power in the world!
Four things about hashing make it good for cryptography:
- It’s easy to encrypt a message into a hash, but hard to do the reverse (hashes are ‘one-way functions’).
- The same message (input) will always produce the same hash (output).
- Small changes in the message cause big changes to the hash.
- Two different messages can’t have the same hash.
Bitcoin uses a hashing function called a Secure Hashing Algorithm (SHA). SHA-01 was first developed by the US National Security Agency in 1995. Bitcoin uses a much stronger version of SHA called SHA-256.
The Bitcoin system groups recent bitcoin transactions together into blocks. Every ten minutes on average, a block is added to the blockchain as part of the bitcoin mining process. This is how bitcoin transactions are confirmed without the need for a middleman such as a bank.
Bitcoin mining does two things:
- It confirms blocks of transactions on the blockchain.
- It creates new bitcoins for bitcoin miners.
To confirm each block of transactions on the blockchain, miners compete to solve a complex cryptographic puzzle. To do this, miners use Bitcoin mining software and vast computing power. Once a miner solves the next puzzle, other computers on the network (nodes) quickly verify the solution. A new block of transactions is then confirmed by the rest of the network and added to the blockchain. This process is called Proof of Work (PoW).
Solving the cryptographic puzzle is the hard part. Once a miner finds a solution, it’s easy (and quick) for the rest of the Bitcoin network to verify it.
As a reward for finding the solution to the puzzle, which takes about ten minutes on average, the miner wins X number of bitcoins. At the time of writing, that miner wins 12.5 bitcoins after each block confirmation. This number halves every four years. With this maths, only 21 million bitcoins can ever be mined. This will occur at a decreasing rate.
- Two-thirds of all bitcoins were already mined by 2015.
- 98% Of them will be mined by 2030.
- 8% Will be mined by 2040.
- The rest will be mined by 2140.
This finite supply makes bitcoin scarce, just like gold!
21 Million is not a large number when you consider how many trillions of dollars, pounds and euros are in circulation today. However, each bitcoin can be split into 100 million units to give 0.00000001 BTC or 1 Satoshi. Multiplying 21 million bitcoins by 100 million comes to 2.1 quadrillion Satoshis!
The Bitcoin protocol—the way the bitcoin system was designed to work—adjusts the difficulty of the puzzles over time so that it takes an average of ten minutes to confirm each block. Back in the day, the puzzles were easier, so miners needed less computing power to do this. They’re a lot harder now.
In 2009, you could mine 200 bitcoins with your home computer (CPU). But as the number of miners grew, so did mining competition. Miners soon needed stronger mining equipment to earn bitcoins, so they started using General Processing Units (GPUs) and then ASIC Miners (‘Application-specific integrated circuit’ mining equipment). It later became harder and less profitable for miners to mine on their own, so they teamed up to form mining pools that split the bitcoin profits.
Today, a company called Bitmain in China own two mining pools, Antpool and BTC.com, which together control over 30% of the entire Bitcoin network’s processing power. This is an issue with Bitcoin enthusiasts as it threatens decentralization of the blockchain. Decentralization is important for the future of Bitcoin as it helps ensure fair outcomes of Bitcoin forks.
Bitcoin mining uses lots of electricity. In one of the most comprehensive studies of Bitcoin electricity consumption to date, Marc Bevand asserts that Bitcoin mining consumes 8.27 terawatt-hours per year. This is more than Google, which uses 5.27 terawatt-hours, but less than the global production of cash and coins, at around 11 terawatt-hours. Gold mining burns 132 terawatt-hours.
The Bitcoin Proof of Work (PoW) algorithm
Decrypting each transaction on its own is virtually impossible. But through the Bitcoin PoW, miners can unlock blocks of transactions every ten minutes on average. Let’s now dive deeper into the technicalities behind this process.
To understand the Bitcoin PoW, you first need to understand what makes up a block on the blockchain. The diagram below shows conceptually what each block looks like:
Each block has a block header and a block body. The block body stores the transaction details—you’ll learn more about that in chapter five when we discuss Bitcoin forks.
For now, we focus on the block header. This has all the pieces miners need to solve the mining puzzle, so that they can add new blocks to the blockchain.
The first important thing in the block header is the Merkle root. Think of this as a digital signature for all the transactions within each block. Recall from earlier that each transaction has its own hash. As shown in the diagram opposite, each of these transaction hashes are then hashed together repeatedly to find the Merkle Root:
The next important thing in the block header is the difficulty target. This is a 64-character string of numbers and letters that starts with zeros. The difficulty target sets the difficulty of the mining puzzle.
Each block header also includes a hash of the previous block (hence the word blockchain). This is then hashed together with everything else in the block header to produce a second 64-character string of numbers and letters.
As shown in the diagram over the page, if the value of that string of numbers is less than the value of the difficulty target, the block is unlocked and the mining puzzle is solved.
When miners first try solving the puzzle, the second-string value is higher than the value of the difficulty target. So, miners use something called a nonce to help them lower the value of the second string.
The mining software runs a hash on the block header billions of times, with the nonce adding a ‘1’ to the input value of the hash each time. These tiny changes in inputs to the hashing algorithm cause large changes to the hash output value (up or down) of the second 64-character string.
After ten minutes (on average) of running the above process, a victorious miner finds a value for the second string that is less than the value of the difficulty target (first string). At this point, the puzzle is solved.
The solution to the puzzle is then quickly verified by the network, and the new block (along with all the block’s transactions) are confirmed and added to the blockchain.
The next diagram shows how each block header links with the hash of the last block. This is how the blocks are chained together on the blockchain.
Once a block is mined through the process described above, it goes on the blockchain forever. The screen-print below shows what this looks like on blockchain.info, an online record of the Bitcoin blockchain:
Notice above that the length of time taken to create each new block is shorter than or less than ten minutes. On average, each block takes ten minutes to mine, as the difficulty of solving each block adjusts.
Clicking on the top block—the 491,855th block in existence—displays the transactions in that block. It shows bitcoins being transferred between public Bitcoin addresses, but it doesn’t show who those addresses belong to:
Are Bitcoin transactions anonymous?
Bitcoin transactions are pseudo–anonymous (or disguised). I don’t know who the addresses in the above screenshot belong to, and I’m not supposed to! Saying that, someone with a lot of time on their hands could try searching the blockchain for transaction patterns of a particular public Bitcoin address. If you know someone’s address, you can see all the transactions they have ever made. This makes Bitcoin not as well suited to money laundering as many people believe!
Bitcoin transaction fees
One of the ideas behind blockchain was to lower transaction fees. This has been achieved with some of the cryptos you’ll learn about in later chapters. But as I’ll explain on the next page, Bitcoin fees are (currently) quite high.
Bitcoin developers are working hard to improve the Bitcoin system. Therefore, any current Bitcoin issues discussed in this book could soon be outdated. As with any good cryptocurrency, Bitcoin is constantly evolving with time.
Bitcoin transaction fees are voluntarily paid by bitcoin transaction senders to miners as incentives for including transactions in a block. On top of receiving new bitcoins, the miner who solves the block is also rewarded all the transaction fees of that block. The problem here is that only a certain number of transactions can go in a single block. So, when lots of people are using Bitcoin, the forces of supply and demand for block space pushes up transaction fees.
The average transaction fee goes up with the value and demand and is typically more than $5 per transaction, regardless of the transaction size. This makes bitcoin currently better suited for larger transactions than smaller ones.
Bitcoin transaction speed
The overcrowded blocks described above not only cause high fees for bitcoin transactions but also limit the number of transactions that Bitcoin can process at a time. This can often cause backlogs for bitcoin transactions, which makes Bitcoin slower than it should be.
At the time of writing, Bitcoin can only handle between three and four transactions per second. This is a far cry from Visa, for example, which can process up to 24,000 transactions per second.
Bitcoin blocks have a capacity limit. Therefore, as more people use Bitcoin, the fees go up and the transaction speeds go down. At the same time, Bitcoin becomes more secure with each successive transaction. This tradeoff, as well as Bitcoin’s limited supply, are why many people currently see bitcoin as a secure store of value like gold, rather than a digital currency for small everyday transactions. We’ll talk more about Bitcoin’s security on the next page.
Is Bitcoin secure?
A common misconception is that Bitcoin is easy to hack, but the Bitcoin blockchain is safer than a Swiss bank account. There are two reasons for this:
- Mining secures
- Game theory enforces
Recall that bitcoin miners try finding a hash of the block header that is smaller than the value of the difficulty target. Once the Bitcoin network confirms a block after this process is successful, the transactions in that block go on the Bitcoin blockchain. This is the first confirmation of those transactions.
The blocks are then layered on top of each other over and over in a chain of blocks (blockchain). As time goes on, each new block adds extra confirmations to all the previous blocks before it. In other words, as time goes on, transactions become exponentially harder to reverse. This is why it’s so hard to spend the same bitcoin twice.
After the first block is confirmed on the blockchain, a network attacker would need more than half the computing power of the entire Bitcoin network to reverse the block and any transactions within it. This is known as a 51% attack. While these are theoretically possible, they are highly unlikely to happen.
After six consecutive block confirmations—which takes about an hour at an average of ten minutes per block—it is mathematically impossible for a 51% attacker to reverse any of the transactions in a block.
Nick Szabo, who developed the concept of smart contracts (covered in chapter four), described blockchain as “a fly trapped in amber” in one of Tim Ferris’s most listened to podcasts. Each time a block is confirmed, another layer of amber is added on top of the fly. In this scenario, the fly is a transaction. The more amber is added on top of it, the harder it is for the fly to get out.
51% Attacks can only occur—if at all—after a block has been mined. But what about the potential for a network attack before a block has been mined?
A Finney attack is when a miner tries to spend the same bitcoins twice before mining a block.
Fred uses a Finney attack to download the latest crypto day trading course from Gauranteedcryptoreturns Ltd without paying for it. The course costs 2 BTC because it ‘guarantees’ a 700% yearly investment return!
While mining block X, Fred sends 2 BTC to one of his own Bitcoin addresses. Fred does not broadcast this transaction to the Bitcoin network.
Fortunately for Fred, his mining software solves the cryptographic puzzle of block X before any other miner. Once the network has confirmed Fred’s solution, he will win block X and the bitcoin rewards that go with it.
Normally, Fred’s mining rig would broadcast his victory out to the network straight away. But because Fred is a Finney attacker, he quickly buys the course from Gauranteedcryptoreturns and instantly downloads it.
Fred now broadcasts to the Bitcoin network that he has mined block X. Instead of broadcasting the 2 BTC crypto course transaction, he broadcasts the 2 BTC he sent to himself.
Therefore, the 2 BTC that Fred was supposed to pay the company is not confirmed on the blockchain, so the payment never went through. He has spent the same bitcoins twice.
Fred downloaded the trading course without paying the 2 BTC to the merchant, Gauranteedcryptoreturns, who is the Finney attack victim. But with a name like that, they probably deserved it anyway!
Finney attacks like the one described above are highly unlikely to happen. For a Finney attack to be successful:
- The seller must process the sale before it is confirmed on the blockchain for the first time. After one block confirmation, a Finney attack is impossible. Sellers can easily protect themselves from Finney attacks by waiting for one block confirmation before releasing a sale.
- The product must be instantly downloadable. If the crypto course was posted by mail, the company would have no reason to deliver it after not receiving payment confirmation on the blockchain.
- The timing must be perfect for the Finney attacker. First, Fred had to mine the block. Second, he had ‘buy’ and instantly download the course before the network found out. He would only have seconds to do this.
- The juice must be worth the squeeze. Finney attacks are a lot of work for the miner. The crypto course would need to deliver on its promise of a 700% return each year for the attack to be worth the effort!
Other Bitcoin attacks are Race attacks, Vector 76 attacks and Alternative History attacks. These all try to spend the same bitcoins twice at the expense of the merchant. Merchants can take precautions to significantly reduce the risks of each type of attack happening to them. Like Finney and 51% attacks, they’re also a complete waste of time and resources for the attacker.
Bitcoin and game theory
In the movie A Beautiful Mind, Russell Crowe plays John Nash, the man who invented game theory. In one scene, Nash is sitting at a table in a bar drinking beer with four of his classmates.
A beautiful blonde woman walks into the bar. Nash has an epiphany: if they all compete for her, they will all get shut down. But if they all ignore the blonde and approach the other women standing next to her, then none of them will leave the bar alone.
Nash was referring to a type of game theory where individuals achieve the best outcome for themselves by doing what’s best for the group.
This applies to Bitcoin.
Miners get the best result (bitcoin profits) when they do what’s right for the Bitcoin network. A 51% attack, for example, would cost the attacker billions of dollars in computing power. All the attacker would have to show for this is the ability to double spend one transaction. This is hardly the best result.
Even if the attacker was successful—which is highly unlikely—the Bitcoin network would pick up the crime and at once remove the attacker from the network. So, the attacker would be short billions of dollars for zero results.
The attacker is therefore much better off mining bitcoins the way the network intended. The potential reward of bitcoins and transaction fees incentivizes the miner to play by the rules!
Final words on Bitcoin
Before I took the time to learn about cryptos, I believed in some of the FUD. In crypto slang, FUD means having “fear, uncertainty and doubt” about the future of cryptos.
I was not alone.
When most people first heard about Bitcoin they were equally sceptical and thought it a fad for hipsters, a Ponzi scheme for charlatans, or a money laundering machine for drug dealers and terrorists.
Bitcoin may still be some of those things, but it’s going mainstream fast. Once people understand how it works, they usually become positive about its potential (and that of other cryptos) to change the financial system for the better—not the worse.
Bitcoin was the first use of blockchain. It may not be perfect right now, but it’s a pretty good start!
- Bitcoin is both a decentralized blockchain system (Bitcoin with a large “B”) and a digital form of money (bitcoin with a small “b”). It was the first blockchain and the first cryptocurrency.
- SHA-256 cryptography secures bitcoin transactions. Transactions are grouped together into blocks.
- Every ten minutes on average, transaction blocks are added to the blockchain through the Proof of Work (PoW) mining process, where miners compete to solve cryptographic puzzles. If they win, miners are rewarded new bitcoins and all the transaction fees for the block.
- Transaction fees are voluntary but are driven by the supply and demand for block space. If Bitcoin blocks get overcrowded, and you want a bitcoin transaction to go through on time, you may need to pay up!
- Mining creates new bitcoins. The number of bitcoins in the world increases at a decreasing rate. 21 Million bitcoins can only ever be mined. This will happen in the year 2140. This gives Bitcoin scarcity, like gold.
- Bitcoin is extremely secure. The longer a transaction stays on the blockchain, the harder it is to reverse.
- Bitcoin’s high transaction fees, slow transaction time, extreme security and finite supply make it currently better suited as a store of value, like gold, rather than as a currency for smaller transactions. However, this could change with ongoing work by developers.