uh welcome you all in my blockchain channel that is blockchain hands-on in short duration that is just five minutes today i am going to explain by using a very good link that is called as blockchain demo dot io why i am referring this link because on this link they have shown very important details like whenever you want to visualize blockchain in real scenario you are expected to look at such kind of visual demos so dear audience you can see here they have given 28 steps i will explain you each step okay so here we are
observing the step two you can see here they have given the source code also so you can see the code so basically uh this code is developed by using javascript and here you can see they have given the work like how you can make use of constructor and how you can create the genesis block okay see basically uh whenever you look at the blockchain so you should be aware like what is data what is hash what is genesis block so these 28 steps they are very important they are also given the explanation also so it
starts with a single block that is called as the genesis block so if you look at the next step wherein we are going to look at other details like how block stores information okay so the index is there and that is basically the position of the block in the chain and genesis block has the index 0 and next block will have the index 1 now a record basically when you consider the record when the block is created the timestamp helps to keep the blockchain in order now if you look at hash hash is a very
important concept because a hash looks like a bunch of random numbers and letters so basically it is alpha numeric value what are the properties of hash hash has a fixed length then same data always map to the same hash then different data may map to the different hash it is easy to compute and is infeasible to convert hash to data so these points you have to keep in mind now if you look at what is meant by a valid hash a valid hash for a blockchain is basically a hash that meets certain requirements what are
they they are having three zeros at the beginning of the hash and that is the requirement for the valid hash the number of leading zeros required is the difficulty now we can see the next detail now how block hash calculation is to be carried out so f of data is equal to hash so hash is a digital fingerprint and that block needs the data is the combination of index timestamp previous hash block data and nonce see nones you will observe in different types of blockchain programs wherein you will also observe like they have considered nonce
and the difficulty label so basically f of index hash previous hash timestamp data and nonce that is going to give you the hash so replace the value of our genesis block and you will get so they are considering like zero then zero and they have considered the timestamp and welcome to the blockchain demo 2.0 and they have considered the nonce at the last so 604 is the nonce welcome to the welcome to blockchain demo 2.0 that is data timestamp previous hash is 0 and index is 0 okay now you can see what is previous hash
is the hash of the previous block and the genesis block if you look at previous hash is 0 because there is no previous block okay now what is data each block store the data against it so crypto currencies you people are aware about bitcoin the data include money transactions now if you look at the nonce nonce is a number that is used for finding the valid hash to find a valid hash we need to find a nonce value that is going to produce a valid hash when used with the rest of the information from the
block now uh mining mining is a very important concept because see the process of determining nonce is called as a mining so you are going to start with a nonce of 0 and that keep incremented by 1 until you are going to find a valid hash as difficulty increases please remember i have just discussed with you about the difficulty the number of possible valid hash decreases with fewer possible valid hashes it takes more processing power to find a valid hash if the hash on the block is invalid click on the tool button to mine the
genesis block so here they have given very important steps i'm explaining you each and every step then data mutation so here if you want to edit welcome to blockchain demo 2.0 so data is a input variable for the hash and the changing the data will change the as well the new hash will not have leading zeroes and therefore it becomes invalid if you look at the further detail mutation effect so subsequent blocks will also be invalid a hash change will cause a mutation in the previous hash of subsequent blocks since previous hash is used to
calculate the hash subsequent hashes will also change this will lead to a cascading invalidation of blocks so you can try yourself like here i have already told you like this is another's work that is blockchain demo dot io here add three blocks then muted the genesis block input okay then adding a new block so to mine another block to the blockchain and you have to fill out the data input and you have to click the button so they have shown the code also like add block new block if this is valid block the new block
and this dot latest block so here this dot blockchain dot push new block else through error invalid block now we will move to the next step so adding valid blocks so valid blocks how you can add it so you that block should need to meet some requirements so index one greater than the latest index of the block then lock previous hash equal to the latest block hash block hash meets difficulty requirements and block hash is correctly calculated now here to peer network so global network of computers work together to keep the blockchain source secure correct
and consistent now add here so click the button to add here to the network so they have shown the code like discover peers p2p dot get new peer error and connection if error through error else this initiate connection dot call this and con so they have shown a very simple way details about the same thing here status so currently active connected disconnected okay so you can change the peers click on the desired appear then to connect a p to appear on a read peer click and to see history between peers on the green peer you
can click and to disconnect with the peer you can again click on the green pair okay so here they have shown the code here you can see like how you can consider like clothes connection and all that now we will see a remaining few steps so if you look at the step number 21 that is peer message so peers ask for each other's block to determine who has the most up-to-date blockchain then peer communication okay then p2p so zero start with the genesis block add here and connect add a block check history between the peers
okay then p to p to our point two if you look at so zero you are starting with the genesis block add two blocks add up here and connect check history between the beer the longer value chain takes a procedure for a shorter chain and that is called as the longest chain rule so this rule you can keep in mind that is the longest valued chain takes precedent over a shorter chain then p to p 2 or 0.3 after receiving the longest valued chain it will broadcast the latest block to its peers eventually all the
peers on the network will have the longest valid chain what is the immutability the block is muted the block and subsequent blocks becomes invalid invalid blocks are rejected by the peers on the network they need to be reminded for the validity purpose earlier blocks will be harder to corrupt because they are more subsequent in valid blocks to remind but spears on the network are always adding new valid blocks the hacker would have to outline the network which requires majority processing power now 51 percent attack if the participant has more than 51 percent of the network
he could not he could outmine the network and hack the blockchain when there are more miners in the network the processing power becomes more distributed and no one has majority power this leads to a more secure blockchain so here they have given the fund of secure blockchain and here they are saying like thank you for learning about the blockchain and i already told you like this project is available on the github and you can go through the same i will show you some steps for this project so here you can see you can add a
block and in this you can add new block this is genesis block then lock one and then you can add one more block that is having value 12 okay so in this way please go through this link that is blockchain demo dot io please don't forget to subscribe like and share my youtube videos so i hope you have enjoyed this visual for the blockchain table thank you once again keep watching blockchain related videos through my youtube channel