ESG's Mike Leone provides a technical introduction to how Blockchain works.
Read the related ESG Blog: The ELI5 version of Blockchain Technology Components
Hey, everyone. This is Mike Leone, Senior Analyst at ESG covering blockchain. I get questions from family, friends, colleagues, clients, other vendors always asking, "What is blockchain?" There are search results out there like crazy. So, I'm chiming in with my take. Blockchain is a publicly available, distributed digital ledger of data and transactions made between parties. Data gets hashed. The hashed data gets placed in blocks based on a predetermined block size. Blocks get chained together. The chains get distributed to provide a consensus of the truth. And through that distribution, immutability is provided. Let's start with hashing. Hashing is a way to transform or encrypt a readable, understandable string into a 256-bit signature of that text. Now, numerous hashing algorithms exist, but for this example, let's use SHA256, which happens to be used by Bitcoin. SHA256 is a one-way cryptographic function, meaning it cannot be decrypted back to the original text.
The only way to figure out what was hashed would be to take the hashed versions of text. So, here's an example. If I simply take the lower case letter A and run it through the SHA256 hashing algorithm, you get a long and confusing combination of letters and numbers. Now, here are three minor variations with their subsequent hashes: Capital A, lower case A followed by the number one, and capital A followed by the number one. I think you get the point. So the next thing to note about hashing is that the string to be hashed does not have a size limit, whether a letter, a name, a transaction, or even the full text of the U.S. Constitution, when hashed, will provide the same length of an unpredictable mix of letters and numbers. Now, that we understand hashing, let's move to the concept of a block. What goes in a block? Each block contains hashed data as well as information about all the previous blocks in the chain.
Let's imagine I'm starting a new blockchain. Each block has fields of information. We have the block number, in this case, it's the genesis block or block 1, some data, the hash of the previous block, again, in this case, it's zero since it's the first block, a nonce, I'll cover that in a second, and then the underlying hash of all the data of the block. Let's imagine an underlying rule for a block to be officially signed and valid is that the hash of all the data in the block, the block number, the data, the previous block hash, and the nonce must begin with four zeros. It's important to note that in the real world, the rules or difficulty, they change. Here, we're using four zeros. A much harder rule would be starting with eight zeros. Difficulty can change over time. In some cases, difficulty just continues going up. In other cases, difficulty can get harder or easier with every new block. For simplicity, I used the letter A as the data. You'll also notice the nonce is set at 78,061. And that combination of information allows the hash to meet the rule of starting with four zeros.
The interesting part is that if any of the data changes, the underlying hash changes, making the block invalid. When changing the data to a1, notice the hash changes and now it no longer starts with four zeros, meaning it's not a valid block. This is where the nonce comes in. The nonce is an arbitrary number that can be changed to try and validate the block so it meets the hash requirement of starting with four zeros. Starting with a nonce of one, we can cycle through nonces until we find a valid solution. One, two, three. Eventually, a nonce of 9,352 works and provides a valid hash. The concept of finding a valid nonce is called "mining," which is essentially guessing if a nonce validates a block. The concept of mining or proving a block is valid through the completion of work deserves a video in and of itself. Further, there is more than one way to validate a block, proof of work, as I just mentioned. Another is proof of stake.
Now that we understand what goes into a block, the next step is chaining them together. Let's take our original block, one, and add a few more blocks that have already been validated, two, three, and four. Block two contains, again, the block number, some data, let's use B. You'll notice it now has a filled out previous block field, which is the hash of the previous block, a valid nonce, and a new hash for that block. The same process follows for blocks three and four. What this means is that when looking at the last block in the chain, it has all the information about every block before it. The cool part here is that if I was to go back to block two and change anything about it, it will impact every block in front of it and invalidate all of them. Changing the Block 2 data field to b1 changes the block's hash so it doesn't meet the four zero requirement. This has a domino effect since that hash is used in the previous field for the next block.
To fix it, you'd need to find a new nonce for the second block, which would take some time, then find a new nonce for block three and a new nonce for block four, all of which takes time. The more blocks in the chain and the farther you go back in time, the harder this process is to complete. Ths concept provides the first level of immutability. Now, let's imagine someone was able to change a block early in a blockchain. They'd have to re-mine every block until the last block was mined, essentially changing the past. How is that prevented? This is where the two additional core concepts of blockchain technology come into play, distribution, and consensus. Here's the four-block blockchain but now there are five copies of it stored in different locations. And just to be clear, in the real world, there are thousands of copies of full blockchains run by nodes all over the world. But for educational purposes, let's stick with our example of five.
The five copies of the blockchain all contain the same data, the same hashes, the same nonces, and so on. So five copies and all five nodes are providing a consensus of the truth. They are saying we all agree this is a valid chain of validated and signed blocks. Now, if anything is changed anywhere in any of the blockchains, a quick check across all the chains will prove that the one changed blockchain differs from the consensus. Even if that changed blockchain gets mined to validate individual blocks because the hashes don't match the other four blockchains, it will still be considered invalid because it does not match the overall consensus. Now, for those that don't care about this deep technical stuff, I'll be doing a follow-up video of what happens when someone converts physical money, say, a U.S. dollar to a cryptocurrency as cryptocurrency is really the first use case that's widely adopted and used. I'm also going to go deeper on use cases, how it matters to me, vendors in the space, and of course, I'll be taking any feedback from you, the viewers, on where I should go next. Thanks for watching.