3.3 Blockchain - Video Tutorials & Practice Problems
Video duration:
5m
Play a video:
We will now build these blocks into a blockchain Because a blockchain is a chain of blocks. By now, you know what a block has, you notice that a block has a specific block number. We talked about the data field, and this would be where all the transactions and all the information for that block would be. And we said that we had a cryptographic hash, and we also talked about the importance of the NAS. But if you'll notice, in this specific example, and you do that by actually going to the third tab on the navigation on top, you have a chain of blocks. And notice that all of these blocks are numerically organized, and they're built chronologically. You see, you have block number five and that's after block number four, which is after block number three, back to block number two, then all the way back to block number one. In fact, do you wanna get specific in the real Bitcoin blockchain, the first block will be block number zero. But for this demo blockchain, we actually began as block number one, and this was just to keep it simple for people to understand. But what I wanna point out to you is that these blocks are built chronologically. Block number one, then block number two, then block number three, et cetera, all the way to the front. In this specific moment, there are hundreds of thousands of blocks that have been built on the Bitcoin blockchain, and they all lead back all the way, to the first block ever. So in this case, we're just gonna focus on five blocks just to show you the examples. So key things I wanna point out to you. Let's say that we have blocked number three. Block number three, we see actually has the data field. It has hash, but it also has a field called prev. Now this field we haven't talked about, but in this specific demo, prev stands for previous. Why? Because this hash, is actually the hash for the previous block. You see this specific block has a hash which ends in 4f51. And you see that block number three, that previous field sets 4f51. That is, this hash which is labeled as previous, is actually the hash for the previous block. And this goes all the way back to you see, we've got blocked number one, which has its own hash, which is actually labeled in block number two, you see block number two, the previous would be blocked number one's hash, but block number one doesn't have any block before. So the previous hash will be zero. And let's take this all the way to the front. This whole linking together of blocks, using cryptographic hashes, is one of the key elements that makes a blockchain so secure. If you have, for example, in block number five, block number five has a cryptographic hash of its own. In this case it ends in 67ce, but that cryptographic hash is built, including the cryptographic hash, for the previous block. You see, the previous field says, the hash which ends in 9ebec, which is the cryptographic hash for block number four, all right? And you can go back. For example, in this case, block number three would be, the hash is ceb7b, which is included in the previous field for block number four, that is all the blocks are linked together. Why is this so important? Because, if I make any changes the same block number three and I add a transaction or change anything, I not only break block number three, I break the entire chain. That is, because I change the cryptographic hash for this block, automatically that changes the field that's labeled as previous, which automatically breaks the cryptographic hash for this block, which implies that it breaks block number five, et cetera. And this is one of the key reasons why blockchain is so secure. Because if anybody changes any information, anywhere on the blockchain, it will break not only that block of transactions, but it will break all the blocks from then on. So the only way that you could fix this, is actually by either going back to where you were. So this is the actual valid entire blockchain, you see this blockchain is all valid. Or if you actually break this, you have to remine this block. But here's what's interesting. Once I continue and I finally remine that block and I make it valid, it still doesn't fix the next block. So I would have to mine again, this block as well, until I can actually get a valid block, but that still doesn't solve block number five. You see, if anybody would to try to tamper and change any transaction anywhere on the Bitcoin blockchain, they would not only have to change the block where that transaction would be, they would have to remind the entire chain all the way to the front, and they will have to do that faster than all of the other miners in the network. Let's go ahead and mine this block again, so we can actually get a fully valid blockchain here. And I'll tell you why this is so important. Because right now this is a perfect perfectly valid blockchain because it has a cryptographic hash of a certain amount. But it is not what the original blockchain was. And if I actually go back to where the original blockchain was, it breaks all again. So, the integrity of the entire blockchain is preserved, because every single transaction is recorded inside a block, and that block is protected by using a cryptographic hash. In the next section, I'm gonna tell you exactly, how this specific issuance of a cryptographic hash for a block, and preserving the entire blockchain by using these cryptographic hashes makes a blockchain so secure. Because once you apply that across a distributed network, that's decentralized, and you have many, many copies of the blockchain, every single one of those blockchains, needs to be identcal. Let's take a look now to see how it all works out.