How the Blockchain Works | Harmony Founder Nick White

Nick White explains how blockchain works, from blocks and hashes to cryptographic signatures and consensus. He covers why consensus prevents double-spending, what the Byzantine Generals' Problem is, and the difference between permissioned and permissionless networks.
Chapters
The fact that you can create a ton of different valid chains, like I can follow the Bitcoin protocol and create thousands of chains. They're all valid, but they're not the one Bitcoin chain. How do we know which one is the chain? And that is the concept of consensus. It's basically how do we, as a group of people on a public open network, choose which one is the truth, which one— So now let's talk about blockchain. It is like the buzzword of crypto, but it's actually just a data structure. I don't know why or like how it became like the de facto word for the industry, but it is kind of— it is a pretty fundamental thing. But I mean, there's— I'm— I think maybe you guys are aware there are other ways of building a cryptocurrency besides just a blockchain. Like, the blockchain is just— I mean, obviously, that's how Bitcoin and Ethereum— it's even how Harmony is built. But it's not the only thing. So, blockchain can be a bit of a misnomer, because it's not necessarily the only way to achieve what, you know, blockchain and cryptocurrencies are known for. But it's also so fundamental that it's very important for you guys to understand what it is. And so, I— there's like a diagram here of what a blockchain kind of looks like on a very high level. And so each new block contains like a certain amount of data. In the case of like Bitcoin or Ethereum or whatever, they're usually like a set of transactions, which are basically like, hey, I send money here, or I interact with this smart contract. It's basically people sending, like trying to do something to change something that they own or interact with something, um, on— that's stored on the blockchain. So, it's sort of a way of people updating the, the network. Um, so, the data is important, but what's more important is actually this, um, a hash of the previous block. So, each new block that gets added has a link back to the previous one. And again, remember the hash is like a digital fingerprint. So, what that means is that you start to have this sort of cascade of fingerprints. And so, each time you add a new block, if anything before that most recent block gets changed, then the whole thing— you can tell that the whole thing has been tampered with. So, it's sort of like the— having the link of hashes is like a proof that, um, nothing has been changed, if, if that makes sense. So, the way that I can verify a blockchain is basically by walking down from the very beginning and basically going to the next block and making sure, yep, the hash matches. Okay, next one. Yep, the hash matches with the previous one. Okay, next one. Yep, the hash matches. So, you can verify, uh, pretty easily, um, that, that, that the whole thing, like, checks out. And so, that's, that's very powerful. Um, yeah, so I already talked about transactions. Um, and I should note that transactions are, are the only things that get, uh, the only transactions that get included in the blocks are actually valid transactions. And that's all about basically this, the, the whole idea that there are rules about what you can and can't do, like what, what transactions you're allowed to send versus not. I'll just quickly like run over this next thing, which is what is a transaction? A transaction is, can only be, is only valid if the person with the right private key is sending the transaction. So, the miners are like basically without the right signature, right? If I can't prove that I own this money or that I have the right to do this because it's, it's, this is me, then— It's not valid. The transaction won't be approved by the network, so it won't go through. And the transaction normally, like for example, if I'm paying someone, I also am sending it to a certain public address. So, I'm usually interacting with an endpoint, which is like a public address, which is normally like a person. Like your wallet would, you would have your own public address. You could create one right now. You could go online, create a Bitcoin public address. And then I can go on my computer, you give me your public address, I created a little transaction with my private key, signing it saying I'm sending this many Bitcoin to you. And if all of that is valid, and I own enough Bitcoin for that to work, then it will go through and you will receive it at that address. And now your private key that is corresponding to the public address is now your right to spend that money in the future. Um, And then there's another piece, which is called consensus. And so it's actually pretty easy to— anyone can create a string of blocks that have the right hashes and are valid in terms of they follow the rules. But how do we know, like, she— so she asked a really good question, how do we, like, is there one blockchain, we each have individual blockchains? The truth is that we have to have one blockchain, right? This is all about creating a shared imagined reality. And so that means we all need a shared source of truth. And consensus, the fact that you can create a ton of different valid chains, like I can follow the Bitcoin protocol and create thousands of, of, of chains. They're all valid, but they're not the one Bitcoin chain. How do we know which one is the chain? And that is the concept of consensus. It's basically how do we, as a group of people on a public open network, choose which one is, is the truth, which one to follow. And so this is kind of where the trust comes in. Trust, the trust is the hashing and all the cryptography combined with also consensus. So it's kind of like, this is why Bitcoin was so revolutionary, is that it combined a bunch of different like ingredients together into something new that the world had never seen before. And consensus is actually one of the very important ones. So, without consensus, you get forks and double spends. Forks are basically where the blockchain branches out. And there's like 2 competing chains where you don't know which one is, is the reality. And double spends are basically where I, in this fork, I fork the chain and I send you money, but then actually it turns out that— and I convince you, so you're verifying on your little wallet, on your block explorer. You're like, oh yeah, he sent me the money, like it checks out, everything is valid. And then all of a sudden it turns out that that's actually not the real chain, and now everyone's back on this black chain. And so this money that I— you thought I sent to you is no longer in your wallet, it's actually back in my wallet. And so, this is actually a real thing that happens. Blockchains get— have been attacked in the past with this double spending attack. So, basically what they'll do is they'll send a bunch of money to an exchange and sell it, but then in fact actually get the money back because they forked the chain. So, that's why consensus is so important, because it prevents these kinds of things from happening. Without this, we couldn't create a cryptocurrency. Blockchain wouldn't be powerful. It'd just be like a— A private database with some kind of interesting properties, but there's no, like, public dimension to it. Um, and if— so, yeah, again, consensus is actually one of the hardest problems to solve. Like, people could have created all the hashing and signatures, all the data structures we were talking about, like, 30 years ago. Um, and so the important thing is that it's that combined with the concept of consensus. And so, let's take a look at how Bitcoin solves consensus. There's a lot of different flavors of this. But just to get a better grasp of what consensus— the problem that consensus is solving is what's called the Byzantine Generals' Problem. So, the basic idea of it, like the story is like, okay, there's a group of generals in Byzantium and they're going to attack this city. And they have— they don't actually know or trust each other. They're all independent generals. And they can basically send messages to each other. Some of them might be traitors and some of them might be honest. But how do they know— how can they all come to agreement on whether to attack or not attack just by sending messages by courier? So this is basically— the problem boils down to, How can you get a group of individuals, some of whom are trustworthy and some of whom are not? Some of them might be malicious and trying to basically fake you and cheat you. But how can you get this group of individuals and guarantee that they will agree on something, like which chain to follow? So it's like a— it's an interesting problem and actually been solved in very more like academic context. Um, or like, uh, a more restricted context. So it's an old computer science problem, and it was solved for closed networks, meaning like if I know who the participants are in my network, like if it's a private network and there's only a limited number of people, we can solve this problem. We know we, we can basically come to agreement about some data, and even if a certain threshold of people are malicious, we'll always still agree on the same thing. All the honest people will agree that this is the one truth. But that's a closed network, right? And that's still pretty limited. So how can we do this on a— the real challenge is how can we do it on an open network where anyone is able to participate? And this is fundamental because this is what allows blockchain and cryptocurrencies to be decentralized. The fact that, you know, if we had just a private chain that has a— it's like a closed network where only certain people can participate, then it's basically just having a normal government. It's like basically having, you know, all the central banks talk to each other and they make the decisions and you don't have any power. The power of blockchain really comes from this fact that it's open, that anyone can participate, that there's no, like, trusted, like, middleman, right? And so that's why the Byzantine Generals' Problem and this concept of consensus is so important. So, Tim,
More from Tim

He Sold His Car to Build This Startup, Then Pitched It for $1M 😳 #Startups #AI

This Startup Moves Your Crypto BEFORE Hackers Can Steal It 😳 #Crypto #Cybersecurity

15 Months Without Refrigeration?! This Startup Thinks It Can Go Global 🥥 #FoodTech #Startups







