Transcript of video lesson.

View video:


At a very basic level, Bitcoin is just a digital file or ledger that contains names and balances. And people exchange money by exchanging this file.

When Bob sells Carol a lawnmower for 5.2 Bitcoins, Bob’s balance goes up by 5.2 and Carol’s down by 5.2. There’s on gold or government issued money backing these numbers. Bob is only willing to trade his real life lawnmower for a higher number in this digital file because he has faith that other people will also trust the system.

So who maintains this ledger and make sure no one cheats? One goal of Bitcoin is to avoid any centralized control [00:30] so every participant maintains their own copy of the ledger. One surprising consequence of this is that everyone can see everyone else’s balances. Although the real system only uses account numbers and not names so there’s some level of anonymity.

If everyone maintains their own ledger, how are all the ledgers kept in sync as money is transferred? At a basic level, when you want to send money you simply tell everyone else by broadcasting a message with your account number, the receiver’s, and the amount. Everyone across the entire world then updates their ledger.

As a quicker side, I’m describing how Bitcoin works [01:00] for power users, people who help maintain the system. You can also just use the system to send and receive money though without maintaining a ledger.

If sending money is as simple as creating a message with some account numbers, what’s to stop a thief Alice from spending Bob’s money by using his account number? Like a pen and paper check, Bitcoin requires a kind of signature to prove that the sender is the real owner of an account but it’s based on math rather than handwriting. When a new account number is created, it comes along with a private key mathematically linked to that account number. If you’ve heard of a [01:30] Bitcoin wallet, these keys are what it holds and what allows you to create signature.

To create a signature, a private key and the text from a transaction are fed into a special cryptographic function. Another function allows other people to check this signature making sure it was created by the account owner and that it applies to that specific transaction. Unlike the handwritten version, these signatures can’t be copied and reused in the future as they are unique to each transaction.

While the mathematical signatures prove who sent the transaction, they can’t prove when it was sent. This turns out to be problematic. [02:00] In our traditional banking system, if Alice wrote two checks but only had enough money to cover one of them, the bank will pay the first person attempting to cash his check but refuse the second because the Alice’s account would be empty. So the order for these checks is critical because it determines who should get paid. Unfortunately, order is much harder to determine in Bitcoin where instead of a single bank, there are individuals all over the world. Network delays might cause transactions to arrive in different orders in different places and fraudsters could lie about time stamps. Two recipients might both think their [02:30] transaction is first and ship a product effectively allowing Alice to spend money twice.

Bitcoin prevents this by providing a way for the entire world to decide on transaction order. As new transactions are created, they go into a pool of pending transactions. From here, they will be sorted in a giant chain that locks in their order. To select which transaction is next, a kind of mathematical lottery is held. Participants select the pending transaction of their choice and begin trying to solve a special problem that will link it to the end of the chain. The first person to find a solution wins and gets to have their transaction [03:00] selected as next in the chain.

So what is this linking problem? It’s based on this special function called a cryptographic hash. As scary as t this sounds, it just mixes up its input and spits out a number but it’s special because it’s irreversible. There’s no easy way to start with an output and find an input that generates it other than by making lots of guesses. This is literally what people are doing in Bitcoin, feeding this function random numbers until the output meets a certain criteria. Besides a random guess, you also input a transaction from the pending pool and chain which is where the linking part comes in. [03:30] So the lottery provides a way for the entire world to decide which transaction is next but the math behind it also helps ensure everyone agrees about past transactions too.

Suppose you join in the network for the first time and request a copy of the transaction chain to get caught out by receiving several different versions, which one should you trust? Ideally, you would trust the one that the majority of people are using. But determining this on the internet is difficult. What would stop a single person from voting millions of times? Bitcoin prevents this by requiring people to [04:00] solve math problems to vote. This causes each vote to have a cost in computing power making it unlikely that a single person or group could ever afford to out vote or out compute the majority of users.

The transaction ordering process described before actually provides the voting system. Part of the linking problem is the transaction from the end of a chain so each guesses effectively a vote for that chain.

But how are all the votes tallied? Because the cryptographic hash function has a well-defined statistical properties, you can look at any given answer and estimate how many guesses it took to find it. [04:30] Just like estimating how many coin flips it will take to get 100 heads in a row. So the links in the chain not only put transactions in order but also act as an effective vote tally which makes it easy to see which chain list people are using.

Finally, how does money get created? Every time someone wins the lottery to pick the next transaction in the chain, new Bitcoins are created out of thin air in order of their account. Solving these problems are commonly called mining as this is how money enters the system. But the main purpose of the math is to make sure that everyone’s ledgers agree. [05:00] The math simply provides a convenient way to randomly distribute money into the world. In fact, sometime around 2140, no more money will be created and participants will only be paid from fees added onto transactions.