Steemit cryptoacademy homework task for professor @stream4u

in SteemitCryptoAcademy3 years ago (edited)

Hey steemians in this post I will be submitting my homework post for professor @stream4u.

IMG_20210805_163003.jpg

Q-1) What is Blockchain and What are the types of Blockchains / Explain in detail the types of Blockchain?

Blockchain


A block is an entity that contains the information, this information could be everything but in the case of cryptocurrency, a block contains all the relevant information regarding transactions(ex: address, hash, parent hash or previous hash etc.) that are taking place in that block. Now when we join more than one block it constitutes a chain called a blockchain.

The very first block which starts the blockchain is called Genesis block and the genesis block doesn't contain the hash of the previous block, now when Block 2 or the block that created after the genesis block gets linked to the genesis block it contains the data(information regarding transactions), previous hash and a hash of its own. That's how it goes on in a chain and constitutes an immutable blockchain (data can't be altered or changed), the property of "hashes to be unique leads to the immutable nature of a blockchain".

In the world of cryptocurrency, decentralised blockchains or distributed ledgers are the essential points to focus on, as a distributed ledger, it is open to anyone or distribution of information among all the nodes which means anyone can participate or serves as a node(with required technology) and being decentralised means that a blockchain can not be controlled by a single person, a consensus must be reached for confirming or verifying the transactions in a block.

How does blockchain work?

Three essential components that carry out the working of a blockchain or constitutes blockchain technology are:

(1) Block
(2) Nodes
(3) Miners

(1) Block: As I stated above, a block contains all the relevant information regarding a transaction(relevant to cryptocurrency). Due to the immutable nature of blockchain, the data can't be altered that has been digitally stored inside a block.

Block contains 3 core things and these things are:

(A) Data: Data that gets stored in the block includes various information regarding a transaction and this information include:

(a) Sender's address
(b) Receiver's address
(c) Block height
(d) Time of transaction
(e) Amount transacted, etc.

(B) Nonce: Nonce stands for "Number only used once" which is a 32-bit number that gets generated at the time of generation of a block, the first task that must be accomplished by the miners is to find the Nonce value and in turn, miners get rewarded with the cryptocurrency.

(C) Hash: Hash is a 255-bit number and unique that means a hash can't be repeated in a blockchain, hashes are crucial to finding a transaction in a blockchain.

IMG_20210803_181739.jpg

Fig 1: A block with data and hashes(it's own and parent), Ethereum


IMG_20210803_182610.jpg

Fig 2: Unique nature of hash, SHA-256 Hash


IMG_20210803_182523.jpg

Fig 3: Unique nature of hash,SHA 256 Hash

(2) Nodes: Nodes are digital devices like computers that verify the transactions, stores details of transactions and exchange details of transactions to other nodes in a blockchain.

Due to the exchanging of data between the nodes in a blockchain, a blockchain remains updated. Every node has details about blockchain or you can say a copy of details of transactions, as it includes all the nodes despite a single node that shows a pure decentralised nature of a blockchain.

(3) Miners: Miners play an essential role in a blockchain as they contribute by validating blocks and transactions by solving a mathematical problem that can't be solved by humans with the help of CPU, GPU and ASICS MINERS.

In return, miners get rewarded with cryptocurrency.


Note: Anyone can't be a miner because of the following reasons:

(A) Costly equipment.

(B)Consumption of energy and time.

(C) Need cryptocurrency to mine like in PoB and PoS.


Types of blockchain:

(1) Public blockchain
(2) Private blockchain
(3) Consortium blockchain
(4) Hybrid blockchain

(1) Public blockchain: As the name suggests it is a public blockchain that means it is open for anyone and anyone can serve as a node with all the requirements fulfilled. Distributed ledger technology is used in the public blockchain so that all the information can be distributed among the nodes assuring transparency and providing decentralised nature to the blockchain.

Public blockchains ensure that the transparency and decentralised nature of blockchains don't get compromised at any cost, anyone who has the resources can serve as a node and get a reward in the form of cryptocurrency for validating transactions without any restriction from the network.

Application of Public blockchain:

Properties of Public blockchain like transparency, use of distributed ledger technology(DLT) and decentralised nature make Public blockchain a suitable blockchain to be used for the cryptocurrency blockchains.

Some major examples are:

(A) Bitcoin
(B) Ethereum
(C) STEEM
(4) TRON


Advantages of Public blockchain:


(a) Decentralised nature of blockchain: Due to the decentralised nature of Public blockchain, the power is not concentrated at a single point or in the hand of a single person, instead the power is distributed among the users of the blockchain.

(b) Transparency: It is all thanks to the distributed ledger technology(DLT) that made it possible to distribute all the information regarding blockchain among the nodes assuring transparency in the network, is there is transparency, there is trust.

(c) Permissionless access to anyone: Anyone can serve as a node or can take part in the mining process, required that they have an internet connection and resources for the process, there is not any restriction on anyone to use blockchain that makes it accessible for everyone.


Disadvantages of Public blockchain:


(a) Prone to alteration of data: If a hacker accomplished hacking 51% of the nodes, he would easily alter any data he wants in the blockchain, but it is quite difficult to do it.

(b) Scalability: Scalability now becomes a must feature in the blockchain system owing to the increasing popularity of cryptocurrency investors and users, and that is the reason why one should opt for a platform with good scalability, you must have encountered the waiting period in Ethereum blockchain due to the congestion on its blockchain. Scalability tells us about the ability of a blockchain about how many of the transactions a blockchain can handle. Public blockchains are facing a problem regarding scalability.

Bitcoin: 5 TPS(transactions per second)

Ethereum: 10 TPS(transactions per second)

(c) Congestion: Congestion on a blockchain increases with the popularity of a blockchain and if a blockchain isn't scalable enough to tackle or handle the users, blockchain starts working slow that made users wait.


(2) Private blockchain: As the name suggests it is a private blockchain that means it is not open for anyone except some nodes that are permitted from the organisation, it works the same as a public blockchain where information can be distributed among the nodes but the catch here is that the nodes are permitted by the organisation and any other person can not take part like in a public blockchain.

Like I said the nodes are permitted by the organisation and due to this private blockchain serves as a centralised system that is being controlled by a single entity or higher-ups of the organisation.

You can think of private blockchain as private schools that are being controlled by a single entity that is the principal of that school.

Application of Private blockchain:

This blockchain can come in handy when used in a private company or an organisation because of the security provided by this blockchain.


Advantages of Private blockchain:


(a) Security: As the nodes are permitted by the organisation itself, there are very few chances or nearly zero chances of more than 50 per cent of nodes gets hacked by a hacker.

(b) Needs permission to access the blockchain: This advantage gives total control in the hands of the higher-ups or the head of the organisation, they can choose a reliable node that will work fast and according to requirements.

(c) Fast network: As the number of nodes involved is very limited along with the restriction for outsiders to serve as a node in the blockchain, these two factors leads to the smaller size of a blockchain and made a blockchain suitable to carry out fast transactions.


Disadvantages of Private blockchain:


(a) Centralised nature: The crux or a core of a blockchain is its decentralised nature that distributed the power among all the users or nodes in a blockchain but here in a private blockchain the power or control is concentrated at the higher level only and that makes it a centralised blockchain contradicting the very essence of a blockchain.

(b) Restriction for non permitted users: Very few of the users or participants that are being chosen are allowed to engage in a blockchain or control the network.

We can see the example of that in RIPPLE and HYPERLEDGER.


(3) Hybrid blockchain: As the name suggests it is a hybrid or combination of two types of blockchains and these blockchains are "Public blockchain" and "Private blockchain", now a question arises in our mind, why do we need to make a hybrid blockchain and the simple answer to that is to overcome the limitation of both the blockchains and aggregation the good features.

Organisations can set up a permissioned group of users to determine who can access the information along with a group of permissionless users to determine the data that can be shown publicly and let the two groups control the network.

Application of Hybrid blockchain:

This blockchain can come in handy for the governments of the nations to store the information about the people of their countries and they can also share that data or information when needed with other organisations.


Advantages of Hybrid blockchain:


(a) Security: As Hybrid blockchains are not open for all, it is very difficult for a hacker to hack 51% of the nodes to take control of a blockchain.

(b) Fast and scalable: Due to the involvement of a few nodes or users, very few nodes are required to verify a transaction and validate it, which makes it a scalable blockchain too.

(c) Anonymous identity of users: The identity of users are hidden from other users required that they don't make a transaction.


Disadvantages of Hybrid blockchain:


(a) Centralised nature or less transparency: As this blockchain involves some of the groups that are permitted by the organisation or higher-ups, it can't be said to be a pure decentralised system and the identity of a user is hidden to another user makes it a less transparent blockchain in comparison to a public blockchain.


(4) Consortium or Federated blockchain: This blockchain is the same as a Hybrid blockchain as it uses both public and private blockchains but the main difference between a Consortium and a Hybrid blockchain is that in Consortium blockchain various organisations collaborate to work on a decentralised network with providing the access of controlling the network to a particular group.

In this blockchain, two terms come into the limelight and these terms are preset nodes and member nodes.

Preset nodes are responsible for initiating, verifying and validating transactions and reaching consensus.

Whereas, member nodes are responsible for only receiving or initiative a transaction.

Application of Consortium blockchain:

The collaboration of various organisations to work on a decentralised platform makes it a very good or promising blockchain technology that can be used in the banking sector. Banks can come in collaboration and can decide about the nodes(preset and member) that will validate a transaction.


Advantages of Consortium blockchain:


(a) Security: As Consortium blockchains are not open for all, it is very difficult for a hacker to hack 51% of the nodes to take control of a blockchain.

(b) Fast and scalable: Due to the involvement of a few nodes or users, very few nodes are required to verify a transaction and validate it, which makes it a scalable blockchain too.

(c) Collaboration of different organisation: Various organisation can collaborate and can work under a blockhain as a unit.


Disadvantages of Consortium blockchain:


(a) Centralised nature or less transparency: same as hybrid blockchain, this blockchain involves some of the groups that are permitted by the organisation or higher-ups, it can't be said to be a pure decentralised system and the identity of a user is hidden to another user makes it a less transparent blockchain in comparison to a public blockchain

Q-2) What are the benefits of blockchain?

Benefits of Blockchain

(1) Security: We came across the first description of Blockchain in 1991, Stuart Haber and W Scott Stornetta were the ones who proposed the idea of blockchain, but at that time the main function of blockchain technology was to timestamp the documents.

But after 17 years, Satoshi Nakamoto came up with the idea of the first digital cryptocurrency(Bitcoin) that works on blockchain technology and that's how blockchain came into the limelight.

My main motive behind the story above is that Blockchain was used to timestamp the documents so that one can keep a record of documents and make sure that the timestamp on the document can not be altered. We all know that Blockchain has immutable property that means one can't change or alter the data or information in the blockchain and this could only be accomplished with the help of the unique and non-repeatable nature of hashes.

So one's data is as safe as it is nearly impossible to hack 51% of the total nodes and gain control of the network.


(2) Transparency: It is all thanks to the distributive ledger technology that made it possible to distribute data or information among users or nodes. As I mentioned or stated above about the immutable nature of blockchain and time stamping transactions, due to these two features a transaction can easily be found in a blockchain by any of the users because of the transparency provided by the blockchain or distributive ledger technology(DLT).

All of us have used blockchain explorer to explore a blockchain and through that, we can see any transactions or blocks made without any restriction, it is the real transparency.

IMG-20210805-WA0001.jpg

Fig 4: Blockchain, picture made by me

Additional Information:

You can see for yourself the transparency feature of blockchain in the links given below:

Tronscan transparency

Etherscan transparency

Steemscan transparency


(3) Decentralised nature of blockchain: We all know that the word cryptocurrency is synonymous with decentralisation, which means every user have equal control over a blockchain instead of a single man or entity controlling the blockchain.

The very first cryptocurrency(bitcoin) has the decentralised blockchain and following bitcoin, every other cryptocurrency accepted decentralised blockchain as an integral part of the world of cryptocurrency where everyone has equal rights and equal control over the blockchain.

Now some cryptocurrencies include their users to help to govern their platform and it is made possible because of the decentralised nature of blockchain.

Some of the cryptocurrencies that let their user govern the platform are :

Polkadot(DOT)
Cardano(ADA)

There are some cryptocurrencies too that are not fully decentralised and paid the price for it, the biggest example of that is RIPPLE(XRP).


(4) Immutability: Immutability will always be one of the remarkable features of a blockchain, blockchain was introduced or developed for the very purpose of providing immutability so that one can't alter with the data that has been recorded.

If a blockchain is immutable, its data can't be altered which provides security to the users of the blockchain by preventing fraud from happening and getting information about any activity that is not authorised or done by the users or nodes.


(5) Reducing human effort along with increasing efficiency and speed:

India is a democratic country where elections take place every 5 years (Lok sabha), it is known to all the people of India that the ballot paper system was used to cast a vote which requires a lot of humans effort, at the time of counting of votes, it took a lot of time for the election commission to count those votes and there was not any assurance that the human would not make a mistake while counting.

But then EVM(Electronic voting machine) system was introduced which uses digital devices to cast a vote. Now humans efforts are reduced as they don't have to count millions of votes, a computer or a device will not make any mistake while counting and will not be partial to anyone leading to the great efficiency and EVM will take much less time than humans while counting votes.

Now through the above example, I have told you how a Blockchain can reduce human effort(by minimising workload from humans), provide great efficiency(Computers don't make mistakes while recording data while humans can make) and reduce the time for a particular process(because of the involvement of digital devices).

Q-3) Explain Blockchain Distributed ledger.

Blockchain distributed ledger

The ledger contains all the data regarding transactions that are being executed on a network, this ledger is widely used in the banking sector to keep a record of all the information of the users, but when it comes to the cryptocurrency this ledger can't be adopted because of its governance or it is controlled by a single entity.

Instead of using a normal ledger, most of the cryptocurrencies use a technology called distributed ledger technology. In distributed ledger technology, a copy of a shared ledger is distributed among the nodes working on a network. By using a shared ledger or distributing ledger it makes this technology a decentralised one and suitable to used in blockchain technology.

Instead of data being updated by a few selected nodes(in the banking system), distributed ledger technology provides its users or nodes with the right to execute, verify and record transactions in a ledger and then update it and send it to every other node to keep blockchain updated.

IMG-20210805-WA0000.jpg

Fig 5: Distributed Ledger technology, picture made by me

Use of Distributed ledger technology in the blockchain system.

(1) Transparency: Due to the use of Distributed ledger technology in a blockchain, all the relevant information regarding transactions are distributed among the nodes in the network and gets updated in a blockchain. By doing this anyone can check any transactions that are being executed in the blockchain without any restriction which is not possible in banking systems or centralised ledger technology.


(2) Removing intermediaries: By using Distributed ledger technology, the users of the blockchain need not rely anymore on the intermediaries or 3rd party to execute, verify and record a transaction, instead, the users themselves are responsible for executing, verifying and recording transactions in a blockchain.


(3) Access to anyone: Anyone who is using a blockchain can serve as a node and there is not any restriction on it provided that the node has resources and time to do its work. Unlike in centralised organisation, where nodes are selected, controlled and put to work by a central authority, the distributed ledger is known for its centralised nature and access to anyone who is using the blockchain.


Some properties of Distributed Ledger Technology


(A) Reduced cost of transactions: As we all know Distributed Ledger Technology removes or limits the involvement of intermediaries or mediators or 3rd parties leading to the reducing cost of a transaction.

(B) Security: It is nearly impossible to hack 51% of nodes to gain control over the blockchain as every node is operating from a different geographical area and in the case of a dishonest node, it is easy to reach a consensus because of availability of several nodes in a network.

(C) Speed of transactions: Speed is directly proportional to the update of a blockchain and through Distributed Ledger technology because every node is working simultaneously and recoding relevant information to the ledger which keeps a ledger updated leads to a faster transaction speed.

(D) Resistant to alteration of data: Due to the involvement of several nodes from all over the world, all the relevant information gets stored in the ledger and can't be changed, in case If it gets altered all the blocks after the particular block whose data gets altered remain invalid, this makes it resistant to alteration of data in a blockchain via distributed ledger technology.

Q-4) What Is Blockchain Double Spending and how Bitcoin handles this problem?

Being a citizen of India, Professor you must have encountered a situation when you give a note that values in 500 or 2000 rupees and shopkeeper or retailer verifies that note to see if it is real or not and if the note(2000 rupee) that you gave to the shopkeeper is a fake one, he/she will know about it. So it is very difficult or nearly impossible in paper currencies to swindle someone with a counterfeit or fake currency.

But when it comes to digital currency, it becomes a problem because the process of verifying transactions takes time to verify a transaction and then send funds, so one can easily turn the verification time into his/her favour by sending the same amount to different or multiple users. This is the reason why it is called double-spending.

One can use the same amount to be spent multiple times, this problem arises due to negligence of a user, a counterfeit copy of a token and trust between the buyer and seller.

Double spending by an example:

For instance, let us say that I have 5 BTC in my possession and I want to buy something that costs 5 BTC, 3 sellers are selling that thing for 5 BTC. I send 5 BTC to all three sellers simultaneously by manipulating the blockchain or taking advantage of the verification time of transactions. In this way, I can double-spend my funds and get the benefit despite that one of the senders will not be able to get 5 BTC.

IMG_20210805_010539.jpg

Source
Fig 6: Double spending

There are three types of the main attack that comes under double-spending:

(1) Finney attack: in this attack, a miner sends his funds to himself(another wallet) and doesn't report or transmit that to the network then he sends the same amount to the seller and report the mined block in which all the above transactions took place to the ledger leading to a benefit of a miner and invalid transaction to seller.

(2) Race attack: As the name suggests, it is an attack in which the same amount is sent to the different receivers simultaneously before the transactions get verified, the sender gets benefited and one of the receivers gets swindled as the transaction remain invalid.

(3) Vector 76 attack: in this attack, a miner can replicate a block and can show it as a valid one and then can collect all the funds that took place in that block. This attack arises due to a small bug in the consensus algorithm of Bitcoin.


How does Bitcoin handle the double-spending problem

We will understand it by an example:

For instance, let us say that I have 5 BTC and I send 5 BTC to Dharamps(Trans1) and Stream4u(Trans2) simultaneously(case of double-spending). As these two transactions are not verified yet so both the transactions are sent to Unconfirmed Transaction pool where the transactions get verified.

So I made a transaction of 5 BTC to dharamps(Trans1) and stream4u(Trans2), so the first transaction that comes out of the "Unconfirmed transaction pool" will get added to the block as a valid transaction while the other one will be rejected as an invalid transaction.

Now there arise conditions:

(1) if both the transactions get verified at the same time: if both the transactions get verified at the same time then we will look for the next block for both of the transactions, the first transaction that is followed by the next mined block is considered as a valid transaction while another one as an invalid transaction.

(2) If both the transactions get followed by a block at the same time: if both the transactions get followed by a block simultaneously then we will look for the next mined block, the first transaction that is followed by the next mined block is considered as a valid transaction while another one as an invalid transaction.

You can check for the confirmations of the 6 blocks after the transaction which makes a transaction a valid one.

Q-5) Practical + Theory, Visit Blockchain Demo and check section Blockchain, then explain in detail how Blocks Hashes Work in Blockchain, what will happen when any middle of the block gets changed, try to give screenshot for each possible details.

As I was told to visit Blockchain Demo, I opened the website and came to know about the working of blocks, hash and miners in a blockchain and I am mentioning it here that all the screenshot below in the Q-5 is taken from Blockchain Demo. So let us start now with our Que 5.

How do Block hashes work in a blockchain?

In my opinion, this is a very good question that allows us to show what have we learnt in the above questions practically.

I will be showing you:

(1) Unique nature of hashes in the block which means that every block has a different hash.

(2) How do blocks get arranged in a chain?

(3) Immutability of blockchain

Here is an example of two valid blocks, Block 1(Genesis block) and Block 2.

IMG_20210805_100458.jpg

Fig 7: Block 1 and 2

Theory:

Details of Block 1:

Hash: 000015783b764259d382017d91a36d206d0600e2cbb3567748f46a33fe9297cf

Previous hash: 0000000000000000000000000000000000000000000000000000000000000000

Nonce: 11316

Details of Block 2:

Hash: 000012fa9b916eb9078f8d98a7864e697ae83ed54f5146bd84452cdafd043c19

Previous Hash: 000015783b764259d382017d91a36d206d0600e2cbb3567748f46a33fe9297cf

Nonce: 35230


From the above details, we came to know that:

(1) Hashes are unique: Despite having no data in the block both the blocks have different hashes that shows that for a slight change in a block we get a different hash.

(2) How do blocks link each other and form a chain?

So there is a simple explanation for this and the explanation is "Hash of a block serves as the previous hash of the next block".

Proof of my explanation:

Hash for block 1 : 000015783b764259d382017d91a36d206d0600e2cbb3567748f46a33fe9297cf

Previous hash for a block 2: 000015783b764259d382017d91a36d206d0600e2cbb3567748f46a33fe9297cf

You can see that both the hashes are the same and that proved my explanation. So now we know that the hash of a block serves as the previous hash for the next block and that is how blocks are combined or linked to each other to form a chain called a blockchain.

Note: Block 1 being a "genesis block" has a hash value with all zeroes and in Blockchain demo the hash and block is valid if it starts with 0000.

IMG_20210805_100714.jpg

Fig 8: Block 3 and 4

Theory:

Details of Block 3:

Hash: 0000b9015ce2a08b61216ba5a0778545bf4ddd7ceb7bbd85dd8062b29a9140bf

Previous hash: 000012fa9b916eb9078f8d98a7864e697ae83ed54f5146bd84452cdafd043c19

Nonce: 12937

Details of Block 4:

Hash: 0000ae8bbc96cf89c68be6e10a865cc47c6c48a9ebec3c6cad729646cefaef83

Previous Hash: 0000b9015ce2a08b61216ba5a0778545bf4ddd7ceb7bbd85dd8062b29a9140bf

Nonce: 35990


From the above details, we came to know that the same explanations is working for Block 3 and Block 4 as we get in block 1 and block 2:

(1) Hashes are unique: Despite having no data in the block both the blocks have different hashes that shows that for a slight change in a block we get a different hash.

(2) How do blocks link each other and form a chain?

So there is a simple explanation for this and the explanation is "Hash of a block serves as the previous hash of the next block**.

Proof of my explanation:

Hash for block 3 : 0000b9015ce2a08b61216ba5a0778545bf4ddd7ceb7bbd85dd8062b29a9140bf

Previous hash for block 4: 0000b9015ce2a08b61216ba5a0778545bf4ddd7ceb7bbd85dd8062b29a9140bf

You can see that both the hashes are the same and that proved my explanation. So now we know that the hash of a block serves as the previous hash for the next block and that is how blocks are combined or linked to each other to form a chain called a blockchain.


Now that we have seen the details of all the four-block we came to know that:

Hash of block 1 = Previous hash of Block 2

Hash of block 2 = Previous block of hash 3

Hash of block 3 = Previous block of hash 4

So it shows us how blocks are linked to each other via hashes and the previous hashes to form a chain called a blockchain.

If you want to see more i am providing one more screenshot of block 4 and block 5

IMG_20210805_100835.jpg

Fig 9: Block 4 and Block 5

Hash of block 4: 0000ae8bbc96cf89c68be6e10a865cc47c6c48a9ebec3c6cad729646cefaef83

Previous hash of Block 5: 0000ae8bbc96cf89c68be6e10a865cc47c6c48a9ebec3c6cad729646cefaef83

Hash of block 4 = Previous hash of block 5

Explanation stays same as above for block 1, 2, 3 and 4.

What will happen when any middle of the block gets changed?

Suppose I am a miner working on a blockchain and i came to know that some hackers have hacked the blockchain and changed the block. They can change any block by adding information or deleting information, but as we had no data in the blocks there is only one option and that is to add data.

IMG_20210805_101758.jpg

Fig 10: Adding data to change a genesis and a middle block

I have shown you all the screenshots of blocks 1, 2, 3 and 4 and also shown you that all of them are valid as they all are green in colour and their hashes start with 0000.

Now a hacker was able to put or add information that is "professorstream4u and as I stated above a slight change in the block can cause a change in the hash, so by just adding the "professorstream4u he was able to change the hash of block 1, he did the same for block 2 and added the information "professorsapwood".

By doing this he was able to invalidate all the blocks in the blockchain as all the blocks are linked to each other via the hash of the previous block, and if the hash of the previous block is invalid turn it is obvious that the next block will automatically have an invalid hash.

Hash of block 1 due to adding information "professorstream4u" becomes: 75254744064fefbb1fc02347c305a994d790129e6ee93b3a5f74051dac2d17ca

Hash of block 2 due to adding information "professorsapwood" becomes: 3236b71f7ca6773d5f04b33c2af83dcfd6584d0158190bac5432c156c8d3690a

We all know that in a blockchain demo a hash that starts with 0000 is valid but we can see that both of the cases for block 1 and block 2 are invalid as they don't start with 0000.

Further, we now have to determine the correct nonce value for which our hash and block becomes valid, but it is not a simple job we have to do the work of a miner for that.

Validating blocks in a blockchain by re-mining all the blocks whose data gets changed or altered that resulted in a change in block

As I have told you about the work of a miner in the first question that the foremost thing for a minor to do is to identify the correct nonce value which is a very difficult task as we all know the Nonce are the number that can only be used once and are generated randomly.

In the blockchain demo, we have a Nonce value of 5 digit numbers, so I calculated the combinations that can be used as a Nonce but only 1 of them will be the right one.

Combinations: by using permutations and combinations I came to know that there can be 10×10×10×10×10×10 combinations. A human can't find a Nonce value from 100000 combinations.

IMG_20210805_102310.jpg

Fig 11: Putting random Nonce value to validate the block

So to mine block 1 and to validate it I chose a Nonce value which is "00001" and by doing this our hash of block 1 gets changed, this shows that Hash changes with the changing Nonce.

Hash for Block 1 by changing the Nonce value to "00001": 327f04f90c9d6d4b77427e5a12372abf28e3f3835ddb51bd7e922ee01853ba4f

You can see that it is an invalid hash because it doesn't start with 0000 and the colour of the block is still red.

You can also see that the hash of block 1 which is an invalid hash serves as a previous hash for block 2 and that makes Block 2 an invalid one too.

IMG_20210805_102559.jpg

Fig 12: Putting random Nonce value to validate the block

So to mine block 1 again and to validate it I chose an another Nonce value which is "00002" and by doing this our hash of block 1 gets changed, this shows that Hash changes with the changing Nonce.

Hash for block 1 by changing Nonce value to "00002": addbbca654ee66915568f2c256593ebf9c42b128c176f3446ef6899b1c92ea6a

You can see that it is an invalid hash because it doesn't start with 0000 and the colour of the block is still red.

You can also see that the hash of block 1 which is an invalid hash serves as a previous hash for block 2 and that makes Block 2 an invalid one too.

Now I don't have the might to put numbers till my Nonce value validate the hash and block as there are 100000 combinations, so for this purpose, there are machines or miners that can find Nonce value easily.

IMG_20210805_103026.jpg

Fig 13: Clicking on mine button to find Nonce value and validate the block

I clicked on the mine button to find the Nonce value that can validate the hash and block both. After clicking on the mine button.

Correct Nonce value for "professorstream4u" is: 41683

Hash for block 1: 00002997a8625cf6ca75d3f1bbfe86729bd068c88b353b1a6175e68603e37852

You can see that the hash value of block 1 with the nonce value of "41682" starts with 0000 which means it is a valid hash and the colour of the block turned to green showing that it becomes a valid block by re-mining the block for added information.

The correct hash of Block 1 is now serving as a previous hash of Block 2.

Now I will re-mine block 2 by clicking on the mine button to make it a valid block.

IMG_20210805_143053.jpg

Fig 14: Clicking on mine button to find Nonce value and validate the block

I clicked on the mine button to find the Nonce value that can validate the hash and block 2 both. After clicking on the mine button.

Correct Nonce value for "professorsapwood" is: 100721

Hash for block 2: 0000f7727a831cb5ad460a80529f3071c3e73f3322af7a7733febc1dbb39f694

You can see that the hash value of block 2 with the nonce value of "100721" starts with 0000 which means it is a valid hash and the colour of the block turned to green showing that it becomes a valid block by re-mining the block for added information.

The correct hash of Block 2 is now serving as a previous hash of Block 3.

Now I will re-mine the Block 3 by clicking on the mine button and validate it.

IMG_20210805_151612.jpg

Fig 16: Validation of Block 3 by re-mining it

I clicked on the mine button to find the Nonce value that can validate the hash and block 3 both. After clicking on the mine button.

Correct Nonce value for block 3 is: 135394

Hash for block 3: 00000e81245f5229b43cae052118cbaa9d146b2ef36758bced4d4d7ba0977745

You can see that the hash value of block 3 with the nonce value of "135394" starts with 0000 which means it is a valid hash and the colour of the block turned to green showing that it becomes a valid block by re-mining the block for added information.

The correct hash of Block 3 is now serving as a previous hash of Block 4.

So by doing this we can re-mine all the blocks that gets invalidated due to change in a block.

By just changing a little data in any of the block leads to the the invalidation of all the blocks next to the altered block, that shows a blockchain is immutable and if its data gets altered or changed, the blocks next to the altered block becomes invalid too.

So I have shown all the properties of hashes in a blockchain and i have also shown what happens to the blockchain when a block gets changed.

Q-6) What Is Race Attack in blockchain? OR What Is Finney Attack in blockchain? OR What Is Vector76 Attack in blockchain?

Finney attack in Blockchain

In this attack, a miner sends his funds to himself(another wallet) and doesn't report or transmit that to the network then he sends the same amount to the seller and reports the mined block in which all the above transactions took place to the ledger leading to a benefit of a miner and invalid transaction to the seller.

Hal Finney was the man who came up with the idea of this attack, he is also the very first receiver of Bitcoin and to honour him for finding an attack the attack was named after him Finney attack.

How does the Finney attack gets executed?

(1) For instance, I have 5 BTC and I am a miner, so I will send those 5 BTC to another wallet that is also in my possession. Now I just have to find the block where my transaction took place and start mining it.

(2) Now that I have been able to locate the block in which my transaction took place, I will look for my transaction and won't report or record it in the ledger or network. Now with the same 5 BTC that I sent to myself, I will buy something worth 5 BTC from a seller.

(3) I will send the 5 BTC and instead, the seller will send me the thing without confirming the transactions that I want to buy of 5 BTC, now I will report or add the block in which all of the above transactions took place to the network.

As I am working as a miner the block will be considered as a valid block and when the transaction will get verified, the transaction that I made earlier to myself will be considered as valid while the transaction I made or executed to the seller will be considered as an invalid transaction because I have made the transaction of the same amount twice and the first one is from myself to myself which will get validated.

How can someone prevent himself from Finney attack?

As I mentioned above these all attacks are the result of the negligence of users, not checking confirmation and copied or counterfeit tokens.

We should always check for the confirmation up to 6 blocks and then do out part water it's selling or buying an asset, by doing this we can prevent ourselves from Finney attack and many other attacks.

Q-7) Limitations/disadvantages of Blockchain.

Limitation/Disadvantages of Blockchain

Everything has its pros and cons and we have talked about the pros of blockchain a lot and now it's time that we knew about the limitations or disadvantages of blockchain.

(1) Higher fees of transaction: Despite limiting the involvement of intermediaries or mediators in the process of verifying and executing a transaction, there is still a high fee that is charged by the blockchain and the perfect reason for that is the use of costly devices that consumes a lot of energy.

More the energy required in a blockchain, the more the fee will be, as we have seen in ETHEREUM blockchain which charges a fee of approx 500 Rs per transaction or 0.09 ETH(13000 Rs approx) for batch sending multiple transactions.


Additional information

But some blockchains are free of fees like Steem, Tron etc. And there are some block chains too that are using very little power or reducing the number of nodes to reduce cost like ADA(CARDANO).


(2) Scalability: Scalability is a major issue when it comes to blockchains, the reason for poor scalability is the engagement or involvement of many people or gaining popularity by cryptocurrency.

Scalability is the ability of a blockchain to handle several transactions. We have also known that

Bitcoin: 5 TPS(transactions per second)

Ethereum: 10 TPS(transactions per second

That shows that how poor scalability is being provided by the blockchains. But some blockchains claim to provide good scalability.

ADA: 1 million TPS
DOT: 1 million TPS


(3) Prone to attacks: We all talked about the various kinds of attacks on blockchain and this is all because of the decentralised nature of blockchain, bugs in consensus algorithms, dishonest miners and accessibility to all.

To get control over a blockchain hackers must hack 51% of nodes working on blockchain, but to swindle or cheat another user hackers use various ways like Finney attack, Race attack, vector 76 attack etc.

IMG_20210805_010608.jpg

Source
Fig : Attack on Bitcoin SV

(4) Immutability: Immutability is a double-edged sword for blockchain systems, it has lots of advantages but it comes with risks too. The risk involved in immutability is that it is non-reversible or something that can't be changed which might prove as a huge loss for someone who has done something wrong while executing a transaction.

For instance, I have 5 BTC(1.5 crore Rs in INR) and I want to send them to my other wallet but I mistook a detail and filled in the wrong one instead of it which cause me a loss of 1.5 crore Rs in INR which is not a small amount, now if that transaction has been recorded on the blockchain it is nearly impossible to change it to get my 5 BTC back.

(5) Still immature or Not reliable: Due to many reasons many countries are against cryptocurrencies or blockchain systems due to their decentralised nature which might lead to the birth of illegal activity on the blockchain.

Regulations or a complete ban is imposed on the cryptocurrency or blockchain system, we can take the example of India, here Govt. of India is thinking about regulating cryptocurrency laws so we are not certain about the blockchain or cryptocurrency system. You can help me here professor with your review of the upcoming regulation on cryptocurrency by Govt. Of India.

Q-8) Conclusion

To be blunt, I had a little bit of knowledge of blockchain till now, all thanks to steemitcryptoacademy but this task made me more familiar with the blockchain system, in which I got acquainted deeply with the blocks, hashes and nodes and how it all worked out in a blockchain. Moreover, I got to know about the types of blockchain which are Public, Private, Hybrid and Consortium, I was able to tell the use case and merits/demits of all types of blockchain.

Furthermore, I listed the benefits of blockchain which includes Security, decentralised nature, transparency, immutability etc. I have explained every benefit with an example or real-life example with some proof.

Then, I came to know about the Distributed ledger technology which is the crux of Blockchain technology for providing Transparency, reducing cost and limiting 3rd party involvement.

I have not known about double-spending in blockchain but I get to know about it via this homework task. I gave an example that made it easy to understand and states the common attacks like Vector 76, Finney and Race attack. Then I came to know about the methodology by which Bitcoin prevents double-spending to take place in the blockchain. I gave a solution to wait for the confirmation in 6 next blocks that makes the transactions real ones, not counterfeit ones.

Then I visited the Blockchain Demo website where I tried to give all the screenshots that show the nature of hashes and that also shows what happens if a block is changed. If a block is changed then the following blocks next to the altered block follows its trail and becomes invalid too because of the hashes and previous hashes that link blocks to form a chain called a blockchain.

Then I talked about the Finney attack in which I stated about the person who found it, how does it execute and how to prevent yourself from it. Then I talked about some disadvantages of Blockchain technology which are High fees of transactions, scalability and susceptibility to attacks.

In a nutshell, I liked this was which compelled me to write it in a way that made it understandable to anyone with required proofs, examples, real-life examples and screenshots

Thank you
That was all from my side
For the attention of professor @stream4u.

Sort:  

Hi @sarveshnegi2811

Thank you for joining The Steemit Crypto Academy Courses and participated in the Homework Task.

Review Visit Level
Task Remark
Comment
Guidance, Feedback, Suggestions
Verification (Done, Hold)
Total Grade
First
Completed
All topics explained very well. The Presentation of the Task is good. Mentioned information has a Quality Content. Blockchain Practicle and explanation done very well.
Looks Fine.
Done
10/10

Total | 10/10

Your Homework Task verification has been done by @Stream4u, hope you have enjoyed and learned something new.

Thank You.
@stream4u
Crypto Professors : Steemit Crypto Academy

#affable

Thank you professor @stream4u, it means a lot coming from you.

Coin Marketplace

STEEM 0.17
TRX 0.12
JST 0.027
BTC 55863.62
ETH 2927.13
USDT 1.00
SBD 2.28