3. Practical Example of how Blockchain Works

In this video, we are going to take a practical look at how blockchain maintains the integrity of its data by taking a look at the blockchain demo given made by Anders Brownworth.

And this is, of course, the site at which this demo is.

So first, let's take a look at what exactly happens with data.

Right here you can type any data that you want to.

I have typed the string data and as you can see, if you see rather carefully, when I type even a single letter, a hash is created.

What is happening is that Blockchain's SHA256 hash is being used to hash this specific data that you are entering here.

So when I'm typing 'd', 'd' is hashed using the SHA256 hashing method and this hash is created.

If I type 'a', this specific hash will be created. 't', 'a'.

And as you can see, the hash is completely different from any letter that if you, for example, compare 'da' with 'data', it's very different.

That is what is unique about hashes, in that any type of data you have, every single unique data will have a unique hash.

That is basically all about hashing.

Now, let's take a look inside the block of a blockchain.

Right here we have block number 1 of the blockchain.

We have something called "Nonce" here, and this nonce is set to a number 72608.

The data here is empty and of course, by it, a hash is made.

Now, if I type something inside here, let's say 'data', this hash is changed and also the color of the block is changed to red.

What has happened here?

Let's just remove this data for now and see the block again goes to blue.

Now, if you take a look at this hash very carefully, you can see there is something unique about this hash.

In that the first four characters of this hash are 0's, they are trailing 0's, which is actually the condition that is used in order to create proof of work and in order to create the puzzle for the miners to solve.

So for the miner essentially has to do he has to change the nonce a bunch of times.

With the data that he or she has been given to get a hash which has four trailing 0's or the number of trailing 0's can vary according to different blockchains.

So if I click on mine here now, let's see what happens.

As you can see, a new hash was created.

The nonce has been changed and this hash again has four trailing 0's.

So what happens here is that the data and the nonce are hash together to see what kind of hash comes out.

And if you change the nonce, the hash will change.

So what the miner is doing is the miner is using multiple nonce.

It is throwing multiple nonce with the data into the hashing function, getting a bunch of hashes and checking if each of the hash has this trailing 0's or not.

That is exactly how a miner tries to solve the puzzle that he has been given for proof of work.

Now let's take a look at this blockchain section in that there are multiple blocks here.

You can see there's the block number 1, there's a block number 2, 3, 4, 5, and so on.

If you take a look at these data that we have here, we also have a previous hash right here.

Now, this hash is actually equivalent to 0.

That is because this is the first block and there is no other block behind this block.

We have the hash of this specific block with the empty data.

It's nonce is, of course, 11316.

Now, if you take a look at the next block, which is the block number 2, it has some other nonce, 35230.

The data is empty, but in the previous hash, there is a hash right here.

If you take a look at this previous hash and this current hash of block 1, these are the same hashes, which means block number 2 is holding the hash of the previous block, which is the block number 1.

And of course, it has its own current hash as well.

Next we have the block number 3.

The block number 3 again, has some nonce, the empty data, there is the previous hash and the current hash.

So if you compare, again, the hash of block 2 with the previous of block 3, they are the same, which kind of creates a chain linking of sorts in that this hash and this previous hash will always be the same.

If, say, for example, I change some data here.

You can see the blocks turned red.

Why is that?

Well, that is because when I change the data, the previous hash here was not changed.

But the current hash has changed because when using this nonce and this different data, some other hash is produced.

And if you compare right here, this previous hash is now same as this hash, but the rest of the hashes have completely changed.

There are no trailing 0's in any of these hashes, which means that these are unsolved.

So these have to be mined again, which means that if you try to tamper the data in a blockchain, you will have to mine all these blocks all over again.

Now, although if you see, you may say that you can just click on mine on these three ones and just make sure that it is correct again.

Well, you see for an example of only three blocks, that is possible.

But if you have, let's say, just about a 100,000 blocks or 1 lakh blocks or 10 lakh blocks, then how many blocks are you going to keep mining in order to get the right hashes?

Well, that is exactly what makes a blockchain tamper proof that if you change the data, an entire set of blocks will be null and void, which means that your blockchain won't be accepted as the right blockchain.

Now, what do I mean by that?

Well, you see, the blockchain is set on a distributed, decentralized network, which means that every peer on the decentralized network has its own copy of blockchain.

And here we have three peers with three different blockchains.

Again, they have the same properties in that the hash of the current one is the same as the hash of the previous one.

As you can see here, second one has the hash of block one.

The third one will have the hash of the second one to be the previous for it and so on.

That, of course, is creating a chain of blocks.

But this chain of blocks is there with another peer called Peer B, and the third one is also there called the Peer C.

All these peers have the same blockchain as of right now.

But let's say if I tamper with the data of block number 2, I, this is empty right now.

So let's say I type your data.

This hash was changed, which of course changed the previous hash for this one, which again changed the hash for this one and just invalidated a set of blocks completely.

So Peer A is now holding a tampered blockchain.

But you see Peer B and Peer C are still holding the right blockchain, which means that these are the ones that will be accepted and not Peer A is blockchain.

Now, in hindsight it may seem that there are three peers, then why are the blockchain of Peer B and Peer C being here, being accepted as the correct one.

You see, in real life, the distributed decentralized network will have 1000 of 1000 of nodes.

These 1000 nodes have each a copy of the blockchain, and as long as a majority of these peers have the right blockchain, the right blockchain will always stay untampered.

It is only when an attacker has the control of more than 51% nodes on a decentralized network that he or she can actually tamper with data.

If not, then no one can tamper with the data of the blockchain.

That is essentially what carries the essence of the blockchain in that the blockchain has 100% integrity and it is completely tamper-proof.

That is about it for this video.

Complete and Continue  

Become a Member and Get Unlimited Access to 30,000+ Top Cyber Security Courses And Labs.