Introduction

- As you know, he is one of the go-to minds in the space, considered an expert by both the industry and the mainstream media. He's one of the most well-known educators in Bitcoin, and the author of the four books, including "Mastering Bitcoin," which is considered one of the best technical books available on the market. He's a fellow of the University of Nicosia, where's he's taught eight sessions of the free Bitcoin course, Massively Open Online Courses. He's the co-host of Let's Talk Bitcoin, the longest running English-speaking podcast in the Bitcoin space. He's testified before the Canadian and Australian senates on the impacts of regulating Bitcoin. He's a strategist, a visionary, a highly sought after public speaker, and a board member of the c4 organization that brought us all here today. He invented the Bitcoin Diet, which involves discovering Bitcoin, studying it for 18 hours a day, forgetting to eat, losing 26 pounds (laughs) and then recovering. It's a not a diet that he recommends, but an innovator nonetheless. And he's inspired many in the space. This industry has been changed significantly because of the impact that he's made. And he will inspire many of us, he's inspired many people who are already here to quit their day jobs and pursue full-time work in the Bitcoin industry. So, consider yourself warned and help me welcome Andreas Antonopoulos. (applause) - Thank you so much. That was a lovely introduction, thank you so much, Ann. All right, welcome everyone. I'm going to switch away from the podium mic so I can move around a bit. And I'm also gonna try and move around up here in front, if that's okay with the camera, so let me know if that's okay. And, oh yeah, it is? Fantastic. So, welcome. We're gonna be doing the Certified Bitcoin Professional Prep Course. Now, this is not everything you need to cover for your exam for the CBP. Specifically, there will be additional sessions in this conference, including Dirk's session on cryptographic basics, that you'll see later today, and others, where you can supplement your education, as well as a study guide on the Crypto Consortium website. This will give you about 80% of what we need to cover. I welcome questions throughout the session. Just raise your hand if you have a question, I'm gonna repeat it, and then we'll continue with the presentation. We're not gonna do Q&A at the end, we're just gonna mix it in, because I'd like to explain things as we go, and make sure we've covered everything comfortably. Everybody ready to learn, apply, grow? - Woo! - Yes. - Or just learn? (laughter) So lemme switch to this mic, see if it works. Can you hear me still? - Yes. - Yeah. - Fantastic. Can the camera see me here?

Course content

(laughter) Fantastic. All right, this is what we're gonna be covering today. We're gonna be covering the history of Bitcoin, keys, addresses, units, issuance, blockchain explorers, and all of the rest of the things you see on this slide. We've got an hour and a half, so there's plenty of time for questions as we go through. Now, the first and most important warning is do not send crypto to the addresses in this presentation. All right? We have burned the private keys on purpose. Despite the presence of this warning, people have now sent more than two Bitcoin to addresses in my book, that are lost forever. Or, if you like, gifted to the rest of the economy through deflation. (laughter) All right.

History of bitcoin

So, you probably know the mythology and history of Bitcoin, and where this amazing technology and invention came from. It all started in October of 2008, when Satoshi Nakamoto published a white paper on a cypherpunk mailing list. We now know that when Satoshi published this paper, they had already been working on the software. Satoshi wrote the paper after writing the software, once they were convinced that the software would work. But the paper was published first. So an interesting little historical tidbit there. You may notice, though, when I talk about Satoshi Nakamoto, I refer to Satoshi as they. This is not necessarily a plural noun, they. It's a indetermined pronoun. So, they, because Satoshi could be male, Satoshi could be female, Satoshi could non-binary, Satoshi could be alien. Satoshi could be a group of people. Satoshi could be the name of a committee or a project. We don't know. It does not matter at all. In January, the software was released, and on January 3rd, the first block, the genesis block, was mined. Interesting fact also, the genesis block was not mined with a client, it was mined using some other software, manually, effectively, mined, by a custom script, and is included in every piece of software that uses Bitcoin, there is a copy of the genesis block and its fingerprints. That is what Bitcoin is. Bitcoin is a blockchain that originates from that genesis block. Seven days later, Hal Finney, a world-renowned cryptographer who unfortunately passed two years ago, joins the network, and starts mining. At this point, there are two miners on the network. So in terms of decentralization, the Bitcoin network is much more decentralized today. When people say, "Oh, it's too centralized, "there's only a few miners," well, at first there was one. That was centralized. Then there was two, that was a bit less centralized. And actually if you look at it historically, we're getting more decentralized over time. Almost 10 months later, in October 2009, the first fiat exchange that has been recorded was made on a exchange where $1 bought 1,000 Bitcoin. Presumably from a miner. And then almost five months later, or six months later, pizza day. Laszlo Hanyecz went out and said, "I would like to make a commercial transaction "to establish a baseline value for Bitcoin "in a commercial realm." And Laszlo Hanyecz arranged for someone to buy pizza with bitcoin. Now, this did not mean that he got Domino's Pizza to accept bitcoin. No, this is a much simpler transaction. He persuaded someone to use their credit card to call Domino Pizza and deliver two pizzas to Laszlo's house. And in return, Laszlo sent 10,000 bitcoin. 10,000 bitcoin for two pizzas, which now makes this the most expensive pizzas ever purchased in the history of humanity. Laszlo has some regrets. (laughter) But without commercial activity like that, we wouldn't have the network we have today. In December of 2010, just about two years after first appearing on the scene, Satoshi Nakamoto posts the last message and vanishes. Satoshi Nakamoto has not appeared again since. Several other people have appeared claiming to be Satoshi Nakamoto, and failing to provide the most basic and simple evidence of that, which is to sign a message using one of the keys in the first few blocks. What does signing a message using one of the keys in the first few blocks prove? Does it prove that someone is Satoshi Nakamoto? - No. - No. It proves that someone has the keys that Satoshi Nakamoto used to mine, which they may have acquired using different means. What it proves is they might be Satoshi Nakamoto. But if they don't sign a message with one of the keys in the genesis block, what does that prove? It proves they aren't Satoshi Nakamoto, because Occam's razor, the simple answer is probably correct. Now, the word Bitcoin means many different things, and therefore some of the confusion that arises in the space comes from vocabulary. Bitcoin is a network, Bitcoin is a blockchain, Bitcoin is a currency, Bitcoin is a system, Bitcoin is an invention, Bitcoin is a white paper. Bitcoin isn't a company, Bitcoin isn't a trademark, Bitcoin isn't an organization. Bitcoin is a disorganization. A very powerful disorganization. If you see it with a capital B, usually, or sometimes, that means the network, the system itself. A decentralized peer-to-peer network that creates consensus without needing a central authority. That is Bitcoin the system, proper noun, capital B, right? Bitcoin with a lowercase B is a currency. So the money is called bitcoin with a lowercase B. It's not bitcoins, right? Because bitcoin applies for both singular and plural purposes. I have lots of bitcoin, or I have no bitcoin. I have one bitcoin, I have three bitcoin. Nowhere do I say bitcoins. If you spell bitcoin with a space, B-I-T space C-O-I-N, welcome to the space. Please don't write an article for your newspaper yet. (laughter) It's too obvious that you just joined. Blockchain. Blockchain is one component of the technology infrastructure of Bitcoin the system. One component. Not the most important component, not the most revolutionary component. In fact, that technology pre-existed. In fact, most of the technologies used in Bitcoin pre-existed. Hashes, hash trees, cryptography, public key cryptography, digital signatures, proof of work, all of these things existed before Bitcoin. The invention is to take all of these things together and leverage proof of work as a mechanism for consensus that allows us to control a blockchain in a decentralized manner, when no one has ultimate control over it. Can you build a consensus algorithm different than proof of work? Yes. Can you build a blockchain that is not decentralized and doesn't use proof of work? Yes. Blockchain is not the most interesting technology in Bitcoin, and this is often misunderstood. Blockchain is like the transmission in your car. Very important, absolutely necessary to keep moving, but no one said, "Oh finally, "with the invention of the internal combustion engine "in the automobile, we now have the ability "to build transmission-based vehicles." Nobody said, "I like cars, but I'm more interested "in the technology behind cars, transmissions." In the blockchain space, a lotta people make the statement, "Well, Bitcoin's interesting, but..." But means I haven't understood it yet. Bitcoin's interesting, but I'm more interested in the technology behind Bitcoin, blockchains. These newfangled automobiles are interesting, but I'm more interested in the revolutionary technology behind automobiles, pneumatic inflatable tires. If we could combine pneumatic inflatable tires with the steady traditional propulsion mechanism of horses, we could really do something interesting.

User stories

(laughter) We're gonna go, for the rest of this course, based on some fundamental user stories. This is a technique I use in my books, too, in order to help move the narrative forward so we can understand. Ultimately, this technology is about people, right? Money is a social structure, and these blockchain systems, these networks, are social structures that technology enables, and therefore, people are important. In this particular case, we're going to use three people. Alice, Bob, and Catalina. Alice lives in Europe. She's new to Bitcoin. In this course, we'll see her buy her first bitcoin, and we'll talk about how that works, and use it then to buy a book from a United States publisher called Bob. Bob lives in the US, runs an online bookstore, and has a lot of customers outside the US who make payments in different currencies, including bitcoin. Catalina is an Argentinian web developer with clients all around the world, and one of her clients is Bob. And now we'll follow their stories through this book. We're going to use these stories to illustrate three different transactions, how those transactions work, what they're made of, and gradually explore the various technologies behind Bitcoin, using these transactions as a reference. First of all, Alice uses cash to buy bitcoin from a Bitcoin ATM. Then Alice uses bitcoin to buy a book from Bob's web store, and what a great choice of book. Bob then uses bitcoin to pay Catalina's invoice for web design.

Alice buys bitcoin from a Bitcoin ATM

So let's start with Alice buys bitcoin from a Bitcoin ATM. How many here have used a Bitcoin ATM, ever? Okay, wow, quite a few. Very good. So how do you get your first bitcoin? And that's the question that comes up a lot, especially with newbies, right? And the common answer most people will say is, "Oh, go and sign up for an account on this exchange," and they mention an exchange, "and use your bank account or your credit card "to buy bitcoin." That is an acceptable answer. It's not a good answer.

How do people acquire bitcoin?

So let's look at some good answers. First and foremost, earn. Get paid in bitcoin. Most people don't even think about this one, right? What are the benefits of using your labor, the products you make, the services you offer, the skills you have, to earn crypto? This doesn't just apply to bitcoin of course, but any form of money. The huge benefit of earning crypto instead of buying it is privacy. If you go and offer someone a haircut, or drive a taxi, or wash a car, or paint a painting, or set up a web serve and you get paid in bitcoin, are they going to ask you for your driver's license, passport, birth certificate, grandma's maiden name, social security number, passport number, proof that you're not Iranian? No. You're gonna get the job done, you're gonna get paid in crypto. So you just earned your first crypto, and it's private. It's a private commercial transaction between two individuals. Privacy matters. Secondly, what is the exchange fee you pay when you earn bitcoin? Zero. That is the best exchange fee to pay, zero. Nobody's gonna charge you a fee. In fact, in many countries, you might actually get a premium for that. You don't always have to be self-employed to do that. Many companies offer an opportunity to get paid directly in crypto, either as your whole salary or as part of your salary. I currently employ 11 people, some as employees, some as contractors. Several of them get paid partially or wholly in crypto. Some bitcoin, some Ether, some a mix of the two. Bit of US dollars in the mix, maybe some euro. Just mix it all up and pay your people. So you can earn it a variety of ways, including as part of your wages. There's also companies that can help you do that, even if your employer has no idea what this is bitcorn thing is that you keep talking about. (laughter) So what they can do is they can become a payroll provider, where, just like you take some of your payroll out and put it towards a savings account or a retirement account, and your employer is quite happy to deposit to a different bank account. Well, some of these providers will take that and convert it instantly to bitcoin and send it to you. So, your employer doesn't even know that you're getting paid in crypto. You're just having it converted each time. That does carry an exchange fee though, and all of the identity requirements. Of course, you can buy crypto from an exchange. And that's one way of doing it. You can buy bitcoin from a Bitcoin ATM using cash. In Europe and many countries around the world, Bitcoin ATMs are completely anonymous. You don't need to provide any ID to buy or sell bitcoin. Some of them are two-way. You can send bitcoin in and it spits cash out. Very useful if you're a tourist in a foreign country. Much better way to get cash in the local currency than using an exchange. In the US, 99% of Bitcoin ATMs will require you to identify yourself by providing some kind of identification document, and they will charge you quite a bit. This is because of state-based regulations on money transmission. You could also buy directly, using cash, from just people, right? And you could do that using an intermediary service, like local Bitcoins. And what they will do is they will make sure that the bitcoin is in escrow, so that neither party can run away with the money and not pay the other party. Now obviously, meeting someone at the Starbucks to exchange some amount of cash in order to exchange it for magic internet money may be risky, right? You wanna do this in a public space, exactly the same way you would if you were buying or selling something on Craigslist or eBay, and you had to meet the other person in person, right? Don't go to an alley. You know where one of the best places to trade crypto is? A police station or a bank. They don't care. In fact, some police stations around the country have Craigslist zones, where you can go right under the cameras and do your transaction next to the police station so everybody feels safe. Well, you can use one of those. And finally, you can trade your belongings for bitcoin. Sell your car for bitcoin, has anybody done that? Yes, I have. (laughter) I sold a Mini Cooper at 11:00 p.m. on a Saturday night when all of the banks were closed to a person who wasn't in the state at the time. In a completely different state, paying for his cousin to buy the car. Three confirmations, here are the keys. That was enough for me. Sell your house for bitcoin. All right. So what Alice is going to do is she's going to use one of these techniques to get bitcoin, and the preferred technique she's going to use is a Bitcoin ATM. Now, reminder, Alice is in Europe, right? So, she's going to use euro. And she's going to put 80 euro in cash, let's say four 20 euro bills, and feed them into this little machine over there. You see it has a little slot? That's for feeding in the cash. And then she's going to receive from the Bitcoin ATM 0.026845 bitcoin. When I did these slides, that was the exchange rate. We'll talk about that in just a second. Everybody clear so far? Okay, quick note, 'cause I notice some of you are trying to take notes or take pictures of the slides, the slides are available at bit.lee/ all lowercase amacbpprep. Amacbpprep, they're publicly viewable, you can go to that link, download them to Google Slides. And by the way, CC BY-SA, Creative Commons Attribution-ShareAlike, as long as you link back to the originals, you can do whatever you want with these. You can publish them, you can sell them, you can create webinars, you can do whatever you want. Everybody clear on that? Everybody got that?

Bitcoin ATM Vending Machine

Bit.lee/amacbpprep All right, so this is the Bitcoin vending machine. On the left hand side, you see four pictures of 20 euro bills, which I'm pretty sure is illegal in lots of countries, to take photos of money and put them on a slide, but there you go. And those are not real money, but Alice is using real money, and she feeds that real money into the ATM, and the ATM spits out bitcoin. How does it spit out bitcoin? On the right hand side, you see that little transparent partition? In there is an LED light and a camera, and that is the mechanism that this ATM uses to read a QR code off of Alice's smartphone, all right? So, it's a passive device. The way it sends bitcoin is by reading Alice's destination address through that camera. So Alice shows the ATM a bitcoin address, which we'll talk about in a bit, and that way, the ATM will complete the transaction by sending that bitcoin to that bitcoin address.

Bitcoin's "Price"

So how much bitcoin is 80 euros? How do we know how much bitcoin is 80 euros? How does anybody know what the value of bitcoin is? How many dollars is 80 euros today? Anybody know? How would you find out? (audience speaking indistinctly) You look at an exchange rate. Okay Google, what is 80 euros in bitcoin? - [Google] 80 euros equals 0.01 bitcoins. - So we can find out quite easily. (laughter) That's not magic technology. How does Google know? An exchange. A marketplace. So, bitcoin doesn't really have a price. People talk about the price of bitcoin, or the value of bitcoin. But the thing is, commodities have prices. A banana has a price. A bitcoin doesn't have a price. It has an exchange rate, because it is money. Money doesn't have a price. Money has an exchange rate, right? You don't say, "How much does a euro cost?" You say, "What is the exchange rate "between a euro and a dollar?" Here's one site that can help us find out that information. Bitcoinaverage.com There's many sites like this. You could go to a specific exchange and ask that exchange what the current price is. Here you can see Kraken, Bitstamp, GDAX, which is Coinbase, Bitfinex. And they're all advertising a price, or exchange rate, for bitcoin. Do you notice something about this? Are the prices or exchange rates different? Which one's correct? - All of them. - All of them. Very good. There is no one price. The price is something that is determined in real time, on different markets, based on the activities of buyers and sellers of cryptocurrency, who are trading it in real time. So what does bitcoinaverage.com do? It's right there in the name. It takes all of those numbers and it calculates a rolling, weighted average. Weighted by what? Volume weighted. What does volume weighted mean? Well, if somebody trades one bitcoin on Coinbase for a certain price, and somebody else trades 100 bitcoin on Bitstamp for another price, which price matters more? - 100. - The 100 bitcoin, right? The volume matters. You shouldn't be able to change the average of an entire market with a small volume. So volume weighted means that each one of the averages is multiplied by the volume of transactions or trades that is happening on each exchange, to arrive at a global average of price. Lots of different sites do this. CoinMarketCap, CoinCapitol, BitcoinAverage. And, of course, the exchanges have a pretty good view of what's happening in your area or country in that market. There may be significant discrepancies between regions. In some countries, people will find the bitcoin is more expensive. I have this question come up often. People will say to me, "Why is bitcoin 20% more expensive in India?" Bitcoin is not 20% more expensive in India. Rupee's are discounted 20% in India. The reason you can't buy bitcoin for the same price as in the United States is because once you buy it with rupees, the person who sold you that bitcoin cannot export those rupees from India, and you can export the bitcoin. Which means that their money is less portable and your money is more portable. And when you trade less portable money for more portable money, the person who gets the less portable money demands a premium, right? Does that make sense? Right. How do you know that's true? Really simple. You go to India, and you say, "How much is a bitcoin?" And they give you a price in rupees. And then you say, "Oh no no no, how much is this in dollars? "I have cash." And then they give you the exact same price as it is on Coinbase in the US. If you have dollars in India, the price you'll get for bitcoin is the dollar price. Which proves that it's actually rupees that are 20% discounted, not bitcoin is 20% higher. Is this making sense to everybody? And you can do that experiment with different values or systems. You could buy bitcoin with gold in India, and trust me, they'd give you a really good price for that.

Price discovery and markets

So this is how price discovery happens. Have you all heard the expression price discovery? Not so many. Okay, why do we use the term price discovery? Price discovery is used as a term in economics because it's the assumption that everything that has some kind of value, right, has a price or exchange rate, which is not set by markets, but it is discovered by markets. So markets are a mechanism for finding out what the real value of something is. How much is a banana worth to you, right? If you create a market for bananas, the market will discover, on average, how much a banana is worth in whatever thing you're trading it for. So we talk about price discovery because in economics, the idea is that the market doesn't tell you what the price is because the market is setting the price. The market is trying to figure out, to discover, what the actual value of this thing is. And the way markets do that is by looking at market movements. Has anybody seen this chart before? This is called an order book chart. Now what this chart shows here is, right at the middle is the price at which the most recent trade happens, right there. I don't have a laser pointer, so I'm gonna use my shadow puppet system. (laughter) At $3,745 US, a trade happened here, where some of the people who were selling and some of the people who were buying, in green, met each other, and were happy to do a trade. The line you see going up to the right in red is all of the orders of people who were trying to sell bitcoin, and the price they want to sell that bitcoin at. So somewhere here, you see that little spike? At about $3,780 someone is willing to sell 30 bitcoin. So someone has put an order on this exchange, and they're like, "I will sell you 30 bitcoin for 3,780." Who's gonna buy that? Well, now, yes. (laughter) In retrospect. On that day, in that market, right, nobody was willing to buy that. How do you know? Because here's where the buy orders are. Someone else is going, "Well, at 3,710, I'm willing to buy. "Who's gonna sell me? No one. Right? So there's a difference of opinion. This difference of opinion is called a spread, right? It's the spread between what is known as the bid price and the ask price. If I'm selling bitcoin, I'm asking. So my order is called an ask order. And if you're buying bitcoin, you're bidding to buy bitcoin, and your order's called the bid. This is how stock markets work, this is how bond markets work, this is how commodities markets work. If you wanna buy pork belly, you say, "I'm willing to buy 10 tons of pork belly at $30," and somebody else says, "I would sell it to you, "but I want, you know, $32." As the market moves around, people change their orders and change their prices, until they meet a buyer. So the current price of any commodity in an open market is the average of the prices that people actually agreed and traded on over the past period of time. So if lots of orders got fulfilled at a specific price, that's what's gonna show up up there. So this is the mid-market price for the last trading period. And they might do that average over a matter of minutes, seconds, or whatever, depending on volume. Everybody clear? Any questions so far?

Bitcoin ATM calculates the exchange rate

All right, so now we know how everybody knows the exchange rate at this moment. The ATM is internet connected. In order to fulfill Alice's trade, the ATM is going to go on the internet and use some price provider. It might be a site like bitcoinaverage.com, that takes the price from lots of exchanges and averages it. Or it might be a specific exchange price for the country in which the ATM is operated, which would make sense, because that exchange most likely represents the local market's price discovery, vis-a-vis the local market's currency. Whatever it is, 80 euros at one bitcoin being 3,000 euros means that Alice receives 0.0 blah blah blah blah blah. Yeah? So how does Alice receive the bitcoin? We talked about this earlier. There's a little camera in there that's looking to take a photo of the bitcoin address.

Bitcoin, private key and bitcoin address

Now at this point, if you're new to the space, all of this is very very confusing. Because there's a lot of terminology you've probably heard. You've heard the term key and you've heard the term address. And then you've probably heard some adjectives like private, public, and those are usually combined with those two other words. Private key, public key. Public address. Bitcoin address. Public bitcoin address. What are these things, right? Public key cryptography is the basis for all of these things, but it's very very confusing at first. It's a rather esoteric area of math. So what we're going to do is use an analogy, okay? Think of a series of lockers. They're in a public space. Maybe this is a bus station or a train station, or the main square in your city. And lining the walls are all of these lockboxes. And these lockboxes are pin-coded, right? So there's a little pin code keypad on the front. The other thing that's unique about these lockboxes is they all have a little slot at the top. And that slot means that you can drop something into the lockbox, yeah? Okay, so if you drop something into the lockbox, who can open it? Whoever has the pin, yeah? Okay. How many lockboxes can one person own? All of them, right? How many people can access a single lockbox? Millions. You could have millions of people who have the same pin number for the same lockbox, and they can all open it. You could have a company representing thousands of customers that has one lockbox and a pin number, and holds that lockbox on behalf of its thousands of customers. So if I say there are a million lockboxes in Bitcoin that have money in them, how many people are using Bitcoin? We have no idea. When you next read that article that says Bitcoin ownership is concentrated among X number of addresses, shock, horror, and dismay, what is the meaning of that statistic? It's bullshit. No no, better, it's bullshit with a clickbait headline that tugs at your heartstrings in order to make you feel dismay over this unequal distribution of income. Addresses are not people. People are not addresses. Lockboxes can be owned by millions or a single person could own millions of lockboxes. So, again, we've got these boxes, they're in a station. This image is not perfect, because it misses something really interesting that happens in Bitcoin. All of the lockboxes are transparent. You can actually see inside, whether there's money in there, and you can count it from the outside of the box. You can't touch it, you can't open it, but you can see it's there, right? And that's the fundamental technology of Bitcoin. There's one more tiny little detail. You see that label, that white label in the top right corner of the box? All of the boxes are numbered. Well actually no, sorry, it's this label, two. That's lockbox number two. So in a blockchain system, that would be the address. So the address is a publicly identifiable number. Simply enough, that's what an address is, a number. That tells you which lockbox you need to use. When Alice is exchanging currency, euros, for cryptocurrency, bitcoin, what she's telling the ATM by showing a QR code is, "My lockbox is number three." The ATM then puts bitcoin through the public slot into that lockbox, and now Alice, being the only one who has the pin code to that lockbox, can access that bitcoin. There are really only two components that we care about. The address, which identifies which lockbox people should put money in, that you control. And the pin number that controls the lockbox, that allows you to spend from it. The pin number is the private key. And the lockbox number is a bitcoin address. Any questions so far? Now, if you saw these lockboxes in a public train station, and they were transparent and there's money inside them, you're probably thinking, I need to get me one of those pins. So the first question that comes to mind is can I figure out the pin number from the number on the front of the lockbox. Not if we want the system to be secure. So, a bitcoin address tells you nothing about the private key. It's a very important consideration. Can you ever find the private key from the bitcoin address? No, you can't. They have a mathematical relationship, but that mathematical relationship is one-way. The bitcoin address is generated from the private key, not the other way around. You cannot go backwards. Almost everything in cryptography is based on this fundamental idea, which can be summarized as you cannot go backwards. Also known as one-way functions in math. Any questions? Okay, how else would you figure out a pin? - Brute force. - Brute force, excellent. And what that means is you go up to the pin code, and you go, "Let's see if they're really stupid." One, two, three, four, five. (laughter) Okay, that didn't work. Beep beep. Zero zero zero zero zero. (laughter) No, that didn't work either. Now how long are the pin numbers in Bitcoin? - 256 bits. - 256 bits. And for those of you who are not computer scientists, what does that mean in decimal? 77 digit pins. 77 digit pins. So you could try nine nine nine nine nine nine nine nine nine nine nine nine nine nine nine nine nine 77 times. At the end of it, you've got a callous on your finger, your hand is sore, and you didn't get the pin. And now you have to try again. How long would it take you to try all possible combinations of a 77 digit number? - A lifetime. - Our brains are not good at doing this, because these numbers have no physical equivalent unless you start talking about cosmology. Ten to the power of 77, or a number with 77 digits, is the same number as the number of atoms, atoms, in the entire visible universe. Every star you see, every piece of matter on Earth, in our sun, in our solar system, in the galaxy, in all the galaxies in the entire universe, and you count the tiniest bit of matter, which is an atom, and you can fit that in a 77 digit number. So how long would it take? Forever. All right, so, practically speaking, we talked about a bitcoin address being a number. And that number identifies Alice's lockbox in the giant set of lockboxes out there. Now what did I say at the beginning of this presentation? Don't send money to this! (laughter) This is a real bitcoin address, you can scan that QR code. Please don't send money to it. This is a form of a bitcoin address. It starts with a three. We'll talk about that a bit later. And it follows a series of letters. Now, I said previously that a bitcoin address is a number. And now you see this, and it looks like gibberish text. Why? The reason is that it is a number that is not convenient to encode in decimal. So how big would this number be if I wrote it out in decimal, meaning zero to nine, digits zero, one, two, three, four, five, six, seven, eight, nine. Using just those digits, how long would this number be? 77 characters long. Instead, it's 36 characters long. Why? Because if you also use letters, you can write things in a more compact way. And this system of letters and numbers is called Base58. It's called Base58 because it is a 58 sa-decimal system. (chuckles) That's not a real word. It means its a system where each digit in the number is represented by one of 58 characters, not 10. So it's not decimal. It's not hexadecimal, as you may have heard of hexadecimal. Hexadecimal uses 16 characters to represent numbers, not 10, as in decimal, right? And Base58 uses 58 characters. Why 58? 26 lowercase plus 26 lowercase would be 52. Plus 10 numeric digits would be 62. There's four missing. The reason there's four missing is because certain characters will actually cause problems. For example, a lowercase L and an uppercase O are often mistaken for zero and one, respectively. So, in using a 58 base system and removing those characters that may be ambiguously or easily confused, it makes it easier for humans to read this and transcribed it accurately. You never need to read it and type it out. I've been in Bitcoin since 2012. I can count maybe two or three times that I've had to type out a bitcoin address on a keyboard very, very carefully. Because we use QR codes to do the same thing. A QR code is simply a barcode. And if you scan that barcode, what does it contain? This. Just this. Sometimes it has a little prefix. Bitcoin, colon, and then that. Just to help the system identify what it is. Any questions so far? Does everybody hate computer scientists for inventing Base58? And not explaining it in high school? Okay, very good. It's a bit confusing, but trust me, this is a number. It's just written with different digits than zero through nine, so that it's more compact. So, Alice shows the code to the ATM. The ATM photographs the QR code, extracts the data within the QR code, which you can do with any QR code reader, doesn't have to be Bitcoin specific. And in return, receives a bitcoin address, which is in the QR code. If you use your camera on your phone, not in Bitcoin Wallet, just your camera, just the camera app. On Androids, it's called Lens, and it reads barcodes. I think on iPhone it's just automatically, you just tap on the barcode. And then, oh, get the shadow out of the way. And then you go and you scan this. Very good. And I have Bitcoin, colon, three seven blah blah blah blah blah. It's just a barcode. There's nothing magical about this. This is what I'm trying to demonstrate. There's nothing magical about the barcode. The barcode is just a way of writing that bitcoin address in a way that a computer can read it very very easily. One of the nice things about barcode technology is that there's more information in those dots than is needed to encode that. So that even if some of them are missing, or smudged, or the ink has faded, the cameras can actually still read the underlying information. They can reconstruct it from the rest of the dots. Which is useful, right? Because otherwise it doesn't scan. All right, so the Bitcoin ATM then sends Alice bitcoin. What do we mean when we say sends Alice bitcoin? Well, it doesn't send, and it doesn't send to Alice, and it doesn't send bitcoin. So that sentence is completely wrong. (laughter) As we'll see now. We use that, as people, to communicate the action that makes sense to us. The ATM sent Alice some bitcoin. Only the ATM didn't send it. Because bitcoin doesn't move. Bitcoin is always on the Bitcoin network. It's not in my pocket. It's not in my phone. It's not on the wallet. It's on the blockchain, always. And what the Bitcoin ATM is sending is not to Alice. It's sending to 37LRvHjJdhdEergQ. Does the Bitcoin ATM know that that belongs to Alice? Does it have to belong to Alice? I want you to think carefully about this right now. Let's say I wanted to buy a t-shirt. And there's a store that accepts bitcoin. I go on the store with my phone, I say buy this t-shirt, put it in the cart, check out, pay with bitcoin, great. What does the store show me? A bitcoin address, right? All right. So I walk up to an ATM, I show the bitcoin address, I put cash in, and I just paid for the t-shirt. I'm not even sending the bitcoin to me. Does the Bitcoin ATM know any different? Right? My cousin in Bogota needs some cash to buy a motorbike. They text me their bitcoin address. I put it in a QR code, I go to the ATM, I show the bitcoin address, I put cash in, I sent money to my cousin in Bogota. Does the Bitcoin ATM know any different? The address doesn't have to belong to that person, yeah? An artist is playing onstage. On their guitar, they have a QR code. I'm in the audience. I take a photo of the QR code on the guitar. I walk outside of the concert, go to a Bitcoin ATM, show the photo to the Bitcoin ATM, put money in, I just contributed to that artist. So think about this a bit. The Bitcoin ATM is not sending money to Alice. The Bitcoin ATM is constructing a transaction to pay the bitcoin address that Alice showed, which may or may not belong to Alice. And there's an amount in there. 0.026845 bitcoin. Actually, that's not true. The Bitcoin ATM is actually sending 2,684,500 satoshis. Because bitcoin doesn't exist. Nowhere on the Bitcoin network, on the Bitcoin blockchain, in the Bitcoin system, is there such a thing as a unit of a bitcoin. Everything is satoshis. What is a satoshi? A satoshi is the smallest unit, but it's also the only unit that actually exists. Everything in the system is measured in satoshi. If I say, "The Bitcoin ATM sent 0.02 bitcoin," that is technically incorrect. The Bitcoin ATM divided the amount by 100 million satoshis to show you that it was 0.02 bitcoin, but it actually sent two million satoshis.

Bitcoin units

The only unit that exists in the system is the satoshi. Everything is stored as satoshi. One bitcoin is 100 million satoshi. How many bitcoin will be mined in the Bitcoin network ever? Anyone? (audience speaking indistinctly) None, 'cause there are no bitcoin. (laughter) 21 quadrillion satoshis is the upper limit that will never be reached. The Bitcoin network will mine less than 21 quadrillion satoshis by the end of its operation. Make sense? Because we're mining satoshis. We're sending satoshis.

Converting units

We're receiving satoshis. Now, humans do not think in eight decimal places. Many humans I know, especially those educated in the public schools of this and other countries, don't operate in two decimal places, or even zero decimal places. (laughter) So for the convenience of humans who don't like trying to do division, we use other units. Now, this is a concordance table, and you can read it from the left, and say one bitcoin is 100 million satoshi, yes? Go down to the bottom. One satoshi is one satoshi. One satoshi is 0.00000001 bitcoin. Understand how to read this? So there's a couple of other units that you may have heard of. Millibit is from the prefix milli, which means one thousandth, and is part of the international metric system used by every civilized country in the world (laughter) ex, oh, never mind. (laughter) And a bit is one millionth of a bitcoin, or 100 satoshi. So if you think of a satoshi as a penny, a bit is a dollar, right? Does that make sense? 1.75 bits is 175 satoshi. And you can do these conversions relatively easily. You just move decimal points around. Now, for many people, it's very difficult to think in long decimal places. So even when I said, "Alice receives 0.02685 bitcoin "for her 80 euros," you get confused as you're reading that, as to how big or small that is related to a bitcoin. If you think of it instead in terms of two million satoshi, it's much easier to think of that, right?

Alice buys a book from Bob’s online store

It's two one hundredths of a bitcoin. Story number two. Alice buys a book from Bob's store. Now Alice is gonna do another transaction where she's going to send 0.01123458 bitcoin to buy a book from Bob's web store, and Bob is going to ship a book to Alice. There's gonna be some exam questions at the end. Pay attention here. I'm just kidding. (laughter) Now, there is a laptop, and with that laptop, Alice is looking at Bob's web store. And on the store, Bob has a book available for $40 US. And that book then has its price translated to 0.01123458 bitcoin. How does Bob translate the price? Do you remember from our previous conversation, anyone? (audience speaking indistinctly) An average, bitcoin average, or some other exchange, or a marketplace has the price discovery. Now, interesting question here. Why is Bob pricing the book in dollars and not bitcoin? Is it because he's a dirty fiat nocoiner? (laughter) (audience speaking indistinctly) There's two reasons, and this is important. The first reason is that, for the vast majority of people out there, if you say, "Hey, this is about 1.1 million satoshis, "is that good for you?" They're like (makes confused sound). (laughter) Is that a lot, is a little, what is it now? You know how the joke goes, where the kid says, "Dad, I want a tenth of a bitcoin for my allowance." And the dad goes, "What?! "You want $1200 for your allowance? "I can't give you $1100, that's ridiculous! "No kids your age gets $800." (laughter) Volatility. (laughter) Bitcoin is not a good unit of account. And the reason it's not a good unit of account yet is because the market is small, and as a result, it's still volatile. And it's volatile enough that it makes it impossible to price things. When we started this conference and planned this conference, bitcoin was $3,600. I had people complain and say, "Why aren't you pricing your tickets in bitcoin?" It's like, "Because you would've paid three times the cost "if you bought the ticket now instead of six months ago." That doesn't seem logical, right? And if you wanted a refund, what am I supposed to do? Give it to you at the current price? (laughter) At the previous price? In dollars? Or in bitcoin? It's a problem, right? We don't use bitcoin as units of account. So one reason is volatility, difficulty for a consumer's understanding the price, because bitcoin is not good at pricing yet. The other reason, which is equally important, is Bob is running a business in a particular jurisdiction, in this case, the United States. Bob has to do accounting. Bob has to pay taxes. How does Bob pay taxes if he doesn't know the price of the things he's buying and selling? Guess what, the IRS does not accept bitcoin. Right? Yet, thank you. They accept dollars. The very meaning of the phrase legal tender is that it is accepted for payment of debt to the government. Bitcoin is not legal tender. Now if I'm Bob and I'm trying to do accounting, it's a lot easier for me to say, "I sold the book at $40." $40 today, $40 tomorrow, $40 next week. I'm getting different bitcoin amounts, but that doesn't matter, because the value of the bitcoin at the time that I sold the book was $40. That makes my accounting very easy. I do all of my accounting in US dollars. I have to. And I say this not just in terms of Bob. I run a business where I do bitcoin payments and bitcoin receivables, and I have to price everything in US dollars, not because I'm a dirty fiat nocoiner, but because I have to pay my taxes and report my income to the US government, right? So that's why the price is in dollars, even though the payment is accepted in bitcoin and converted in real time at the moment of payment. As you can see here, Alice, who has a rather large hand, (laughter) is scanning (chuckles) - [Audience Member] She's got a small phone. - It's the only clip art I could find. (laughter) Is scanning the QR code in order to make a payment, right? Often, it's a lot easier to use a mobile wallet on your smartphone, even if you're making a payment to a website that's on your laptop. Why? Because I can't scan the QR code on the laptop screen with the laptop camera that's on the laptop screen. Now, if you think I haven't held up a handheld mirror (laughter) and tried to align, I have. It worked. It was a pain, but it worked. But critically here, one of the things that new users have a problem with is this concept of, "Hang on, the bitcoin address is on my laptop. "If I pay for it with my smartphone, will my smartphone "know how to send the money to the website?" Because they think that what a wallet is doing is sending the money to the other device. The website, the other smartphone, the wallet. It's not. It's constructing a transaction that is depositing money into a public address. Bob's store doesn't care how money arrives at that address. Bob's store is watching that address and waiting for a payment to come in. When that payment comes in, it knows that, somehow, Alice made that payment. Why? Because it actually produced an address for Alice's cart. So in a store situation like that, the store generates a unique address for every customer's purchase, for every cart. When money comes in to any of the addresses that the store is watching, it can see which cart that corresponds to, mark that cart as paid, and then tell Bob to ship. That's how web stores work in the cryptocurrency space. So does it matter how Alice got money into that address? Does she have to use the same device? No, she could pick up her laptop, go up to an ATM, hold the screen like this, and put money in, right? This is a difficult concept for people to recognize. Because it doesn't match what we do with credit cards. You can't go and enter the credit card on your smartphone to pay something you just bought on a website.

Alice's wallet constructs a transaction

So this is what it looks like from Alice's perspective. She scans the QR code, her wallet shows her that there's a payment of 0.01123458, which is 39.73. Hang on, I thought it was $40. - [Audience Member] That was two seconds ago. - This was taken maybe a couple seconds later. Did the price change? Not necessarily. What's happened here is that Alice's wallet may be using a different provider for pricing than Bob's store, right? Does it matter? No, because the price that Bob has charged her is the price that Bob's store is accounting in bitcoin. Which means Bob is charging her 0.01123458, whatever Alice's wallet thinks that is, which in this case is actually 39.73. Everybody understand why this is happening? By the time Alice sends this to Bob, the store may see a different US dollar price, but it doesn't matter. Bob has effectively committed to that exchange rate for a period of time, during which he'll do the transaction in order to sell that book. Alice then constructs that transaction. Now, this is a different type of address that Bob's store uses. Do you see that? It starts with bc1qz3a8. Has anyone seen an address like that? Does anyone know what that kind of address that is? Shout it out. (audience speaking indistinctly) Bech32. I got you, that was a trick question. Nobody knows how to pronounce bech32, so I ask people to shout it out just so we can see what happens. (laughter) Bech32! Beesh32! (laughter) Bech32 is the name of this kind of address. It is what is known more broadly as a native segwit address, we'll talk about that in some of the other courses that are gonna follow. But suffice it to say, that's just a bitcoin address. You know that from the bc1q that is the prefix to all of these addresses. This does not use a Base58 encoding. It actually uses a 32 character encoding, with some very interesting properties for error correction. Doesn't matter. All you need to know, a lot easier to read because it's lowercase, no uppercase characters being used, and it's the new format that most Bitcoin wallets are moving to. And so, Alice presses the send now button. Done. Hang on a second. What's that fee thing? No one told me there would be fees! (laughter) I was promised a free lunch.

Transaction basics

We'll talk about that in just a second. So, we looked at a transaction previously. You remember? We looked at the transaction that the ATM constructed in order to give Alice her 0.02 bitcoin that is about 40 euro. Or sorry, 80 euro. And any transaction is composed of two parts. Inputs and outputs. Inputs are what you're spending, outputs is what you're paying to. So if you look at the transaction from the ATM, the ATM consumes the inputs and created an output to Alice for 0.026845 bitcoin. Alice now uses that input to construct an output to Bob for 0.01123458.

Transactions and change

All good so far? Great. But here's the problem. When you consume bitcoin in an input of a transaction, it is spent in its entirety. Yes? Someone here says, "Give me $18." I pull out a 20. How do I give $18 out of a 20? I can't. It's indivisible. I can't take 10% of the bill, tear it off, and give the other person nine tenths of a $20 bill, and say, "Here, this is about $18." (laughter) No, it's now $0 'cause you tore the bill, you maniac. The same thing applies to bitcoin. The input is an indivisible chunk of bitcoin. When you spend it in a transaction, you spend all of it. Alice gives the entire input. But she needs change, right? So if someone says, "Pay me $18," and I have a 20, I except them to give me $2 back. And the change is actually created by Alice's wallet. So Alice's wallet creates a transaction where the input is the chunk of money that the ATM gave her, indivisible, two million satoshis, and the outputs are one output to Bob to pay for the book in the precise amount, and one output back to Alice's wallet, a different address in Alice's wallet called the change address. It's just another address. With the rest. Think of it as Alice opens the lockbox, pulls out a two million satoshi chunk, right? And then has to spend all of it, so she puts $40 worth in Bob's lockbox, and the rest of it in her own lockbox as change, in a single transaction.

Alice's transaction on the blockchain

So far so good? Everybody with me? All right, this is the actual transaction on the blockchain. All of these are real transactions. You can go look at them, and I encourage you to do that as homework, in order to understand these things better. I'm using a block explorer called blockstream.info, and you can use this bit.ly link, which is case sensitive, meaning the A and the T are capital. Otherwise you go to a page about a small city in Texas called Alice. (laughter) Alice, Texas, is the all lower, don't go there. It's fine, I mean, you can, but, capital A, capital T. If you type that in, it's actually gonna take you to this blockchain explorer page where you can see this transaction. One input, two outputs. So far so good? So what have we learned? Bitcoin history, keys and addresses, markets, exchanges, pricing, units of account, inputs, outputs, and change, and using block explorers.

Transactions and fees

Now let's talk about some of the more advanced topics in the time that's remaining. So, we saw this transaction where Alice pays Bob for the book. That transaction had two outputs. Who among you did the math to try to add it up? Nobody? Good. And if you tried to add it up, if you add up 0.01123458 and 0.0155808, the answer is not 0.026845. It's less. There's a chunk of money missing. That chunk of money is 2,962 satoshis that is missing from this transaction. It's not missing. It's a fee, and it's paid to miners. So, where in a transaction are the fees? Nowhere. The fees are the money left behind on the table to tip the miners. You pay at the restaurant, the waiter brings you change, you put some of it in your pocket, your change address, and you leave some coins on the table and walk away. That's the tip. That's how bitcoin transactions work. Alice spent her ATM input, spent some of it to Bob, put some of it back in her own wallet as change in her pocket, and left some on the table, 2,962 satoshis, and that money will be collected by the miners as a fee for this transaction. What happens if you don't include a change address? (audience speaking indistinctly) Well, let's do the math. The input is 0.02684500, the outputs are 0.01123458, the fees are ouch. A million five satoshi. 1.5 million satoshi. Ouch. (laughs) So in today's money, that's maybe about $150 fee on a $40 purchase.

Transaction fees

Alice is a big tipper, what can I say? Habit she picked up in Vegas, who knows. Why do we have transaction fees? The answer is really simple. Space for transactions is limited. It's limited by physics, it's limited by technology, but it's also artificially limited by software. We do not want blocks that are enormous, because enormous blocks means costs for everybody processing blocks, which then gets externalized. In economics, there's no such thing as a free lunch. If you're not paying fees, someone's paying fees. You're either paying them in terms of inflation, you're paying them in terms of giving cartel advantage to a monopoly by centralizing access and control, or you could just pay fees. If we have to decide how transaction gets into block, and which transaction should, and which transactions shouldn't get into a block because we have limited space, there's really only two ways to do that. One is to specify in the software which are good transactions and which are bad transactions. What I euphemistically call a dictatorship of developers. Think about it. If developers gets to decide what is a valid transaction that should be prioritized versus which transaction is wasteful, or spam, or for an irrelevant application that they don't particularly need, we just created a dictatorship of developers. They decide which applications are now allowed on the network, simply by controlling that function. There's only one way to correctly price the scarce resource of transaction space, or block space, in a way that doesn't give anyone control, and that is a market. So fees operate as a market in order to give the freedom of the sender of each transaction to decide for themselves how important this transaction is, and how much of a priority it has in their perspective. And in doing so, they have to compete against all of the other people who are trying to get their transaction into the block. And that competition for block space is the market for fee price discovery. Now, when transactions are transmitted into the bitcoin blockchain, they're not automatically included in the very very first block, because there's more transactions than fit in a block, usually. So what they do is they go into a holding space, and this holding space is called the mempool. There is no single mempool. Every system on the Bitcoin network has its own mempool, a picture of what it thinks remains to be confirmed or entered into the blockchain. This is the queue. This is where all the transactions are lining up, waiting for their chance to enter the blockchain. And as they're sitting in this queue, they're advertising themselves to miners, going, "I have lots of fee, pick me!" Right? If you look at this with colors, the red color at the top actually corresponds to this transaction up here, one transaction that at this time was paying 2,000 satoshis per byte. Why? Who knows! Because to the person who sent that transaction, that transaction was so urgent that they were willing to pay an enormous fee. Meanwhile, there is 8,333 transactions waiting with just over one satoshi per byte. And those transactions are less important. Some are even not paying any transaction fee. Those don't get confirmed almost at all. It's actually difficult to do that nowadays. But with one satoshi per byte, you will get your transaction confirmed, most of the time, eventually. I do payroll. In fact, I have to do payroll in three days. And some of my employees get paid in bitcoin. I'm going to put a one satoshi transaction fee on my payroll. Why? Because nobody cares if it arrives in eight hours, instead of three hours, instead of six minutes, right? None of my employees are gonna be, "I need my payroll in 10 minutes. "First block, please, come on, chop chop, tick tock. "I got shoppin' to do." Compared to the banking system, 12 hours to get your paycheck from the moment it's cut by a company? That's super fast, right? Now, if I want to get into any block within the next 12 hours, I'm going to be a cheap ass about it. So I'm going to use the lowest fee. Now what do you think these things are, these gaps here? What do you think this is? - A block. - That's a block. I have a nice little picture to explain that. There's a miner. (laughter) The miner is making a block. How do they make a block? They look at the pool of everything waiting in the queue and go, "I'll take these." And they take a big chunk off, this is a simplification of the algorithm. There's no big yellow digger involved. (laughter) And this is not an endorsement of Volvo. (laughter) But what the miner is effectively doing is skimming the most highly paying transactions off the top until there's no more space in the block they're trying to make, and they filled it. Why? Because they're trying to maximize their profit. So they take a chunk out. And you see that in a mempool, all of those transactions that drop out of the mempool, the reason they drop out is because they just got confirmed in a block. And now the rest of them are waiting. Now at some point during the day when you look at the mempool, you'll see that it gets all the way to the bottom. And that means that all of the transactions that were outstanding, it just goes flat. Great, everybody got in. Sometimes some of those transactions stay there for days. There's Alice's transaction on the Bitcoin blockchain. It was confirmed at height 560344. You can see that block on the blockchain. What does it mean it was confirmed? It means that the transaction was included in the block. So let's look at that in a bit more detail. Alice creates the transaction somewhere around here. At some point, a block is mined. When that block is mined, and that's block 560344, Alice's transaction is included in that block. Three minutes later, another block is mined. 20 minutes later, another block is mined. Blocks get mined, on average, every 10 minutes. On average is one of those tricky English phrases that doesn't mean what you think it means. On average every 10 minutes does not mean every 10 minutes. Just like the average American family has two and a half children. Have you seen a half children? (laughter) And which way would they cut it? (laughter) Left to right? Top to bottom? Who gets the bottom part? Definitely not a good plan. On average every 10 minutes means that sometimes it takes 40, sometimes it takes an hour, sometimes it takes 30 seconds. Over weeks, it's almost precisely 10 minutes if you average it all out. Because the network is tuned to maintain that heartbeat. But sometimes you wait a long time for your block. Can I get a time check for the end of the session? - 22. - 22 minutes left? Very good. All right. So now let's look at it in terms of time. Right, this was in terms of blocks. This is in terms of time. Alice creates, signs, and transmits a transaction paying Bob's address $40, or that amount in bitcoin. Bob's wallet, that's running on the web store, is watching a lot of addresses. Maybe Bob has lots of customers with lots of carts and lots of addresses simultaneously buying products. Presumably, you want Bob to be able to sell more than one product at a time. So Bob's wallet is watching all of these addresses. What does watching mean? It means that Bob's wallet is connected to the Bitcoin network, and has told the Bitcoin software that he's running, "Please tell me if any payments happen "to the following list of addresses." That's what the software is doing. Now, Bitcoin operates as a broadcast network, which means that when you send a transaction on the Bitcoin Network, you shout it. It's called a flood or gossip protocol. So what you do when you're on the Bitcoin network, what Alice's wallet is doing, is it's talking to all of the Bitcoin nodes that it has direct connections to, and it's gossiping, it's flooding, it's shouting a transaction. It says, "Hey, I have a transaction." Blah blah blah blah blah blah blah. The other nodes go, "Oh, good, new transaction. "Let's see if it's valid. "Yep, that's valid. "I'm gonna tell everybody I know about it." And they tell all of the nodes they're connected, and each one of those nodes looks at their transaction and goes, "Huh, let's see if it's valid. "Yep, I'm gonna tell everyone I know." So they tell everyone they know. And the transaction spreads really really fast. Within 15 seconds, it's spread to the entire Bitcoin network all around the globe. Within 15 seconds, anywhere in the world, Bob's wallet is going to see a notification that says, "Hey, one of your addresses received a transaction." Or, "Bob, you've been paid!" With the AOL voice, which you probably remember if you're in your 40s like me. (laughter) Now, at this point, the transaction is not confirmed. What does that mean? It's not in the blockchain. It's sitting in the queue. It's in the mempool. It's in Bob's mempool. It's in Alice's mempool. It's in the mempool of every single Bitcoin node on the Bitcoin network. And at this point, everybody's waiting to see the next block. This may take some time. Is Bob in a hurry to ship this book? Well this is the beauty with physical product. It's gonna take days or weeks for that book to reach Alice. Bob can wait 10 minutes. So what Bob's wallet is doing is it's waiting until this transaction is confirmed in a block. Because it may never be confirmed. If it's not confirmed, Bob didn't get paid. Bob only got paid if the entire transaction is in the blockchain and the entire world knows that Bob got paid. Until that moment, Bob hasn't been paid. There's a transaction out there. Now, for a book, Bob can wait. But what if it's a Starbucks? What if you just bought a cup of coffee? Like, "Thank you, that will be a large latte." "Oh yeah, that's $12." "Oh." (laughter) "Okay. Ouch. "Here, let me send you a transaction." "Thank you so much. "It's confirming, we'll wait. "Please wait. "This gentleman's transaction is confirming. "Any second now, plus or minus 40 minutes." (laughter) This doesn't work, right? But think about it this way. How often have you bought coffee from a Starbucks and not had to sign or enter your pin with a credit card? Well, if you haven't signed or entered your pin, can you reverse that transaction on your credit card? Absolutely you can. You can call a company and go, "I didn't buy a coffee. "I haven't signed or put my pin in. "I want my money back." And they will give you your $12 back. And Starbucks will be out one coffee and down $12. They don't care. The reason they don't care is because in terms of risk, the number of people who would charge back that coffee versus the delay they would have to wait to make sure they actually got paid, or had to wait for someone to sign or put a pin in, they can serve three other customers, and it doesn't matter. The same thing applies with blockchains. If I'm selling you a coffee, I don't care if it's confirmed. The chances that there will be a blockchain reorganization that undoes that transaction, or that it's never confirmed, is less of a problem for me if I have three other customers to serve. Now if you're buying a flat-screen TV, I'm not gonna let you walk out of the store until it's confirmed at least once, maybe twice, you know? If you're buying a house, I don't care really, I'd like six confirmations, but I know where you live. (laughter) 'Cause you just bought the house. Like, I'm not gonna sign over the title right now. It's gonna take a few days, so it's okay. So all of this is probabilities. It's a risk-based probability. When people say six confirmations are the gold standard, what they mean is after six confirmations, the probability of that transaction being reversed is so low that I'm willing to accept that risk. And that probability is entirely dependent on the value of the transaction you're talking about. So, whatever it is for you. I have like a rule of thumb. Zero confirmations for a cup of coffee. Zero confirmations for anything that I'm gonna ship in more than half an hour from the moment that you make the payment, 'cause I'll get some confirmations by then, right? Okay. One confirmation for some electronics, something nice that I'm gonna hand you right away. Maybe two confirmation for a flat-screen plasma. Three confirmation for a Mini Cooper. Actually did it. Three confirmations, good enough for me, here are the keys, walk away. I signed over the title after three confirmations. The chance of that being reversed, eh, not a problem. Yeah, also I know what your car is. And the license plate. I'll find you, right? Four confirmations, five confirmations for a house. I would sell a house with five confirmations. I would sell a house with three. Yeah. Six confirmations for a Ferrari that you drive off the lot. With appropriate insurance, yes. Seven confirmations for a mansion. Eight confirmation for an aircraft carrier. (laughter) 144 confirmations for 22 trillion dollars of US debt. I'd take it, right? Bitcoin isn't worth enough to do that. So, the mining actually happens separately from the receipt of the transaction. You may hear this term in economics, or in markets, settlement, or clearing. Settlement or clearing is the finalization of a transaction. It is the moment at which a transaction is no longer reversible. How long does it take to clear or settle a credit card transaction? Anyone? (audience speaking indistinctly) 60 days. How long does it take to approve a credit card transaction? 10 seconds or less. But don't think it's settled. If you're a merchant, they can show up 59 days later and go, "Uh-uh, never happened. Sorry." Right? That's why merchants love crypto. No chargebacks. There is no 60 days. So 10 minutes seems like a long time if you're thinking that retail transactions are instantaneous. They only are if it's cash. If it's a credit card, it's actually not instantaneous at all. The merchant doesn't get paid for at least 30 days. And in many cases, that payment is a credit that is subject to being taken back if the transaction is disputed. And the pinnacle of that is I've had a transaction reversed from a credit card 18 months after it was made. A credit card company came back and said, "No no, that never happened. "Sorry, you owe us money." Like, (laughs) good luck. (laughter) See you in court. 18 months. The gall. So after 60 minutes approximately, Bob's wallet has received five confirmations. Six confirmations, sorry. Five more blocks mined on top of the one containing Alice's transaction. Let's go back and look at this. Block 560344 contains Alice's transaction. That means Alice's transaction has now been recorded in the block on the blockchain. How many confirmations is that? Anyone? All together now? - One. - Make a guess? - One. - Come on, one! One confirmation. So what does it mean to say a transaction has one confirmation? It means it's in a block. What does it mean to say it's zero confirmations? It means it's not in a block yet. It's in the mempool. When it goes from the mempool to a block that's actually been mined, it's in the blockchain now, it's in that block, that block is one confirmation. All right? So if block 560344 is one confirmation from Alice's transaction, what is block 560345? Two confirmations. Now this is where it gets a bit confusing. Alice has received two confirmations on her transaction, when one block has been mined on top of the block that contains her transaction. We count one for the one that has her transaction, one block for the one above her transaction on top of her transaction, that's layered on top. So we're building up, right? Two confirmations. Three confirmations with block 560346. Six confirmations at block 560349, which is five blocks after the one that Alice's transaction was in, yes? The block it's in is one, and then we layer on top. What's the upper limit on how many confirmations a transaction can receive? Anyone? What is the maximum number of transactions you can have? There is no maximum. How many transaction confirmations, approximately, has Hal Finney's transaction from 2009 received so far? 560,000 or more confirmations. And every 10 minutes, one more. So if you look at a really old transaction, it's gonna say, "This transaction has 300,000 confirmations."

Bob pays Catalina’s invoice for web development work

All that means is that it was mined 300,000 plus one blocks ago, yes? Now let's look at our final example of the day, and we'll wrap things up and get done with this. Now, Catalina wants to get paid for web design. Catalina has a software development company in Argentina. Now she operates in Argentinian pesos, or ARS, right? A-R-S, Argentinian pesos. I would love to tell you that that's the exchange rate. Things have not been good for Argentina since I wrote these slides. So, she's charging 10,000 pesos. And in that time, 10,000 pesos was $262 US. Her invoice is actually written out for 10,000 pesos, because that's how she prices her services, because she operates in the currency that is legal tender in Argentina, with is Argentinian pesos, right? Bob agrees to pay that. How does Bob figure out what the exchange rate is in bitcoin? Bob converts pesos to dollars, dollars to bitcoin. Why? Because Bob has to do accounting in dollars. So Bob has to put in his accounting system, I paid $262, and then convert that into bitcoin and pay 0.07811758 bitcoin. Which Catalina will account for as I received 10,000 pesos. Is this making sense? So you see this double exchange rate that happens when you're doing two national currencies, but the payment is in bitcoin.

Aggregating transaction

This is critical to understand how you do accounting. We have some other classes for that too. All right, here's the transaction that paid Catalina. This is a real transaction. This looks really weird! Can anybody guess what's happening here? Bob has these inputs to pay Catalina, why? (audience speaking indistinctly) Anyone? (audience speaking indistinctly) Multiple addresses in the wallet? What are these addresses, what are these inputs? (audience speaking indistinctly) Yeah, these are not change addresses. (audience speaking indistinctly) They're unspent transactions, but why are there so many of them? (audience speaking indistinctly) What is Bob selling? Books. How much is Bob selling these books for? 40 bucks each. Catalina wants $262. Bob has a whole bunch of $40 chunks of bitcoin that Bob has received as payment for each one of the books in his store. Each one of those payments from each one of those customers created an output that Bob's wallet controls. But that output is unique and indivisible. So Bob's wallet has all of these $40 payments, right? Only they're not $40 payments. They're $39.73 payments, they're $39.82 payments, they're $41.72 payments, because the bitcoin price keeps changing. So while he's selling $40 books, each of the little payments that comes in is slightly different. Bob's wallet needs to take all of these unspent chunks of bitcoin, which we call UTXO, we'll talk about that in a bit, and aggregate them together to make a payment to Catalina. Have you ever been in a convenience store where the person in front of you goes, "How much is that bottle, please?" "$2.00" "Oh, okay." "10 cents, 20 cents, 30 cents, 30--. "10 cents." (laughter) That's what Bob's wallet is doing, right? He has a bunch of loose change. Now, this loose change could be millions of dollars per payment, but each payment is unique and indivisible. Each output can only be spent in its entirety. There's two ways Bob could make this payment. They might have the exact amount in a UTXO and pay that to Catalina, done. Easy. Unlikely to happen, doesn't consider fees, all kinds of complications. Most likely, Bob has a slightly larger amount, pays that, gets change, pays the fees. So two outputs, one input. But in many cases, Bob's wallet actually doesn't have a big enough UTXO. So what it has to do is aggregate several inputs, pay the amount that Catalina needs, pay change back to himself, and, guess what, fees. Fees are in there too. Do the math, you can figure out how much Bob paid in fees. This is what this transaction actually looks like on the blockchain. Again, it's a real transaction. I sat there for two days making $40 payments as the price of bitcoin changed to a store that doesn't exist in order to make this slide.

History of the Bitcoin Blockchain

You're welcome. (laughter) And that's the real transaction. We're gonna wrap up by explaining the blockchain now that we have a much broader picture of all of these components. It starts with what's known as the genesis block. We count that as block zero, because we're programmers and we're annoying in that way. We count from zero. So block zero is the genesis block. Block one is the next block in the sequence, and it points back to block zero as it's so-called parent. The parent block is the block that came before. The child block is the block that came after. Every block has a parent, right? Which is the block it was mined on top of, as its child. And inside each block, there is a reference to the parent block. This creates an unbroken chain. If you take the block that just got mined while I was talking, and you look inside at its parent, and you follow that back one block, and then you look at its parent and you follow that back one block, and you keep doing that, 580,000 blocks later, you're going to arrive at the genesis block.

Chained blocks

In an unbroken, continuous chain, all the way back to January 3rd, 2009. Each of these references is in the block header, and the block also contains transactions. I'm gonna run a bit late, but not too much. Now, if you were to go and try and change one of these transactions here, what would happen is you'd be modifying the data in this block. If you modify the data in this block, the block hash changes. Which means that the next block is now not pointing correctly. Which means that you'd have to change the next block as well, its child, 'cause it no longer has a correct reference. But once you change that block to update its parent, its block hash changes, which means you need to change its child to update it, which would change its block hash, effectively forcing you to re-mine all of the blocks from that moment on, right? This is how we achieve immutability in Bitcoin. Every block contains transactions. Those transactions are summarized in a hash. That hash is referenced by the child block, so that you can't actually change it. And that reference is then reflected in its child, in its child, in its child, in its child, in an unbroken chain. So the chain goes two ways. It goes back all the way to the genesis block. But the ripple effect of a hash change is carried forward to all subsequent blocks, invalidating them.

Bitcoin money supply

Which is why you can't change the past. Each block also has an amount of bitcoin in it. This is called the block subsidy, or the issuance, the reward for mining. Miners earn bitcoin. Where do those bitcoin come from? New bitcoin. 'Cause each block contains new bitcoin. In the beginning, 50 bitcoin per block. After four years, that dropped to 25. Then it dropped to 12 and a half, which is the current block subsidy for bitcoin. 12 and a half bitcoin. In 2020, it's going to drop to six and a quarter bitcoin. Then three and an eighth. Then 1.7 something. And it will keep going down until it's one satoshi, and then zero. Creating this asymptotic, geometrically decreasing supply, which is probably the most famous characteristic of Bitcoin, as in, there will never be 21 million bitcoin. In fact, if you play out the Bitcoin system, it will mine 20,999,999 .9997 bitcoin.

Halving

Or something like that. Just short of 21 million. There is a great site called the Bitcoin clock, which you can find. And it shows you in a clock format time to the next halving of the supply. So we say every four years, Bitcoin's supply is reduced by 50%, but in fact, it's every 210,000 blocks. Which, at 10 minutes per block, is approximately four years. But because of the difference in timing, that can change by weeks, right? It might happen a few weeks early, it might happen a few weeks late, it depends on how accurately that timing will be executed by the Bitcoin network. This is, again, the meaning of on average, which means really not, most of the time. (laughs) So, here you see how the supply drops and the cumulative issuance approaches that line asymptotically. Almost all of the bitcoin will be mined by the year 2030, and then we're talking about very, very small amounts per block thereafter, asymptotically decreasing to zero issuance by the year 2141. So people often ask me, "What happens in the year 2149?" Sorry, "What happens in the year 2141?" It's a really simple answer. I'm dead.

Mining incentives

(laughter) We're all dead. It's okay, deal with it. So, miners receive two sets of incentives. One is called the block subsidy, and it's new bitcoin that is minted in every block, and the other one is transaction fees that is the sum of all of the fees of all of the transactions that they put in that block when they mined it. If you look at block 560344, again, this is Alice's transaction block, and you look inside, you'll find the first transaction is one called the Coinbase transaction. This is the transaction that rewards the miners. Every block has at least one transaction. That transaction is the Coinbase transaction containing new bitcoin. It can have no other transactions, just one. That's okay, it's valid. And if you look here, what's the amount there? 12.57682767. Can anyone tell me how that number came up? - The reward plus fees. - Reward plus fees. So the reward, or block subsidy, currently is 12.5 bitcoin. Which means that in this particular block, there was 0.07682767 fees exactly included in the transaction. How do we know that? If it was a penny more, this block is invalid. Everybody checked to see that all of the fees add up precisely. A miner can actually pay themselves less, but they can't pay themselves more, all right? Who writes the Coinbase transaction? The miners do. So when a miner is constructing a block, this is how it works. Their mining software goes, "Let's create the first transaction in this block. "I generously give myself 12.5 bitcoin. "No wait, we've got some fees. "12.57627285, signed me." Now, that's a great transaction to write. And if you're a miner and you put that in your block, does that mean anybody cares that you put that in your block? No, because this block hasn't been mined yet. Now imagine thousands of miners around the world each writing their own check. They're all writing: To me, 'cause I'm awesome. 12.7567. And then they have different amounts. Different fees, because they've included different transactions from their different mempools. And none of those blocks is real until one of them is. The miner who wins has their block accepted by everybody else because they found proof of work. How do they know they get paid? They wrote the Coinbase transaction. And that Coinbase transaction is meaningless unless their block is accepted by everyone. But the moment it's accepted by everyone, that Coinbase transaction is in there, so the payment to the miner becomes real. They can't actually spend it for 100 blocks. It's a mechanism of security in Bitcoin. But it's real now. Thank you so much for coming today. (applause) If you enjoyed this video, please subscribe, like, and share. All my work is shared for free. So if you wanna support it, join me on PageShare. (mellow music)