Steemit Crypto Academy, Season 3: Week 4 | Homework Post for Professor @pelon53 - ROOT HASH AND MERKLE TREE

in hive-108451 •  4 years ago 

Hello everyone, I am happy to make submissions of my homework for the weekly crypto academy course. this week with professor @pelon53 is all about ROOT HASH Y ÁRBOL MERKLE. He has done well with his lecture and also his resource really guided me to work around my assignment.

I will be making submissions based on the questions that have been asked by the professor. And without further submissions, I will like to start the ball rolling.

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Introduction

The evolution of cryptocurrencies and of course DeFi systems has really made it possible for the existence of decentralized financial systems. Upon the innovation, it has really done so well and has always improved upon the number of users it records. But one thing we have failed to understand is that, the success of this cryptocurrencies is fully based on security of this blockchain technology upon which they are built on. Here, we could see how the blockchain systems brings together the block of data being processed using hashtags which always gives them value and thus giving them some form of uniqueness. This way also propels assets that has been used or spent in the system.

What we should also know is that, the said hashtags or hashes connects information from different sources about the blocks which are in pairs. This is done until it reaches a complete data or information upon which all transactions and hashes in the blocks are made. There is a term known as the Merkel Tree. This is where you actually see how this said hashes connect together.

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Question One: Explain in detail the hash rate

I will define hash rate as the rate at which the computational power and speed uppon which a computer finishes the mining process which is completed by the transactions process of solving hash algorithms. Miners will be able to be able to solve complex algorithms only if they have more hash rates. Hash rates are inn the units of seconds or measured in seconds.

Mathematical formula for Hash rate = number of hashes solved / time

Lets look at this scenario.

Assuming we have a computer of high power is able to calculate 200,000.00 with 60 seconds. Lets see the hash rate of the question above using the hash rate formula given above.

Hash rate = number of hashes solved / time
Hash rate = 200,000.00 with / 60
Hash rate = 3,333.33 h/s

It is very necessary to have a very high rate always, this is because looking at the BTC mining, you need to have high rated machine that will be able to mine faster and the more they are able to solve this complex algorithms, then the high chances you stand of making more earns. Just in the PoW, miners see it to be a race, this is because, you will need a more powerful machine and power to mine and based on that you turn to get more rewards but those who are not able to utilize much power and also they do not have machines that are powerful they turn out to loose a lot or rewards.

So there is no doubt that, it is very difficult to mine BTC and also other PoW blockchains. They are very expensive and also power consuming, the devices also responsible for the mining at high hasj rate are also expensive and consumes so much power so if you are not able to cater for this you woud'nt really have what you want.

I will provide a screenshot containing a BTC hash rate. The Hashrate Unit/s, the Hash and then Hashes Per Second

1.JPG

source

The chart below will show previously, the rate at which BTCwas mine and the hash rates and also showing the current hash rate of BTC

2.JPG
source

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Question Two: Make the following Merkle Tree:

Transaction (tree leaves): Steem1; Steem2; Steem3; Steem4; Steem5; Steem6; Steem7; Steem8.
I made it to the Root Hash. And put every hash generated using SHA-256 , show screenshots.
Tell the steps to follow to verify if Steem6 is included in the Markle Tree.

Step 1: Leaves

Steem1
Hash: 7760E25BCB80ADF1DD92DB339BF5790A59E90CD54EFA072F1250DCE13FA97045

1.JPG

Steem2
Hash: FE00506E91CF52BC4B35321E6B978D1A7349397B19C6C1C01E095971FDEC9741

2.JPG

Steem3
Hash: A9418332E0C351D6A50C835AA9E57D514F0573C231D491E97726DB8A5844F2DC
3.JPG

Steem4
Hash: 22F4EC8E20C9CCAF2C313B23F18981B1C73BF39081BCD739E5D998A95A46AB30

4.JPG

Steem5
Hash: 2A3C87336683AB0DDFA56AFEFC740E6C13A02FEA0A43D6797343B26D7AF0C57B

5.JPG

Steem6
Hash: A7BAA6DE0C0658E9E3681966E542BACD116529F5AE9A2D9126CDB1C1D5BC1278

6.JPG

Steem7
Hash: D441688DDA7F9285E8811728DD9A3955CF74F0A3C7600C1589D0F1D3B48FFAC7

7.JPG

Steem8
Hash: F2E38ED4FF662087B6E9BEAFA4158EBC488B995732057BDA019A6A77FFB5F9F5

8.JPG

Step 2: First Branches

Steem1Steem2

Hash: A5568957014F6AC3866923C7DE20D375E706B8D8C9F453636E90B9965ABEC62B
1.JPG

Steem3Steem4

Hash: 18D25196DB699F6AB9222B7302EB8A6F6EBFADEC703C07DD5DB8D9455913A499

2.JPG

Steem5Steem6

Hash: D118E137F92A0DBEA138B6BF70C7714153A7BC393CD0272A44BD94864645224B

3.JPG

Steem7Steem8

Hash: A81D57BA11AEDFA9EFBBA42F6523D75D1EFA50B22C5E3557A21CEFFE87DDFC4A

4.JPG

Step 3: Second-Level Branches

The branches are still up to four, so we will go a step further by using them to generate second-level branches, so as to reduces the branches to two. They are:

Steem1Steem2Steem3Steem4

Hash: 8A248C05E69C4F1AA403AD18A7F445FF500C42483DA425CE0C980CDB2FD1AD9B
1.JPG

Steem5Steem6Steem7Steem8

Hash: 8B0935AEAB3F51BFA2B0750703EE2387E2B20EB19B0D24227E180C03A851AF17

2.JPG

Step 4: Generate the Root Hash

After I have successfully created the second-level branches, the next step is to generate the root hash.

Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8

Hash: 9C2FC83F36D59B8ED5033D2BCC417728583C8DAA0AA9868FD374BE3619D6E4F9

1.JPG

Step 5: Create the Merkle Tree

I finally created the Merkle tree for all the inputs and their respective hashes.

tree.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Question Two B: Tell the steps to follow to verify if Steem6 is included in the Markle Tree.

To be able to verify Steem6, the miner should be able to know the hash Steem5,
Hash of Steem7Steem8 and then, he must also know the hash of Steem1Steem2Steem3Steem4. So looking at the data I have already provided, the steps you will follow are stated below;

Step 1

First, using SHA-256, I generated the hash for Steem6.

Step 2

Since I already know what the hash of Steem5 is, I will use it, along with the hash of Steem6 I generated in Step 1 to calculate the hash for Steem5Steem6.

Step 3

Since I already know what the hash of Steem7Steem8 is, I will use it, along with the hash of Steem5Steem6 I generated in Step 2 to calculate the hash of Steem5Steem6Steem7Steem8.

Step 4

Since I already know what the hash of Steem1Steem2Steem3Steem4 is, I will use it, along with the hash of Steem5Steem6Steem7Steem8 I generated in Step 3 to calculate the hash of Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8

Hash of Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8 is referred to as the Merkle root hash.

Question Three: Using the SHA-256; you must place each complete hash in the Merkle Tree.

Transaction (tree leaves): SCA1; SCA2; SCA3; SCA4; SCA5; SCA6; SCA7; SCA8. Explain each step, show screenshots

Step 1: Leaves

SCA1
Hash: 13E0A04BB0E669E1C638DBE3A704743F99F162B25245E4D8C064D35BA38FA8C8

1.JPG

SCA2
Hash: 27849353A9C8CC4E948EB6E5748EDD79CB83513D8C0ADAF3E8C83D3792C9149B

2.JPG

SCA3
Hash: 67E872F952C105C35E0BCE130536D061F4999DCA5593754BA9BA7BE59B8E7C0D

3.JPG

SCA4
Hash: 491928A32BAE70A12FA251412BBFD7C9999F317BA6BF577C283C724225270A43
4.JPG

SCA5
Hash: 99C078C39CDE7F47799E0E8691460A9F3E83E78D498EA989308FCFCC58907B19

5.JPG
SCA6
Hash: 7A648D887B124DB14E96E23BA92783E7F26D00957C19B9B8229632C2C1873729
6.JPG

SCA7
Hash: 7E0BBD6BA4BA9896F9911AF46B06DD2C47535F9C80B29D693FDF6B9319D0D68E
7.JPG

SCA8
Hash: 562ABCEEB497E1FE7AE275A883FD5EF9D92A05F5C19D82ABAA0DC1571B7DF3AD

8.JPG

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Step 2: First Branches

SCA1SCA2
Hash: 91B09BBA815748166FB36413342C7E4E7E809F4BAC538C0418841A4476B527EF
1.JPG

SCA3SCA4
Hash: B49B48697A3ACBC5E3D2E36B6EE49C44020D88E664C5C1AA7A7CF34058177379
2.JPG

SCA5SCA6
Hash: F026924CD1285FF92C2A2DE9B9313027EB67273A82375C939348C887F6B52F77

3.JPG

SCA7SCA8
Hash: AA55EC5A6B11393B289C4B2B6916172ACC2941C5C978FB1D7BF02696BAB323A4

4.JPG

Step 3: Second-Level Branches

The branches are still up to four, So what we will do is to further use them to generate second level branches, so as to reduces the branches to two. They are:

SCA1SCA2SCA3SCA4
Hash: F50DC120CBF6C46923037F6D7F41D4153ECC9AB7430DDA662C142DB1FFE483F7

1.JPG

SCA5SCA6SCA7SCA8
Hash: A3D8CA8494CC426ABD5E1FC5FA0FEAE4F2B2ECE4C4CECDCA05E19EB66542533F

2.JPG

Step 4: Generate the Root Hash

After I have successfully created the second-level branches, the next step is to generate the root hash.

SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA8
Hash: CB40CA6DB72DD507CF9118963F94B7740822258E74AFB0FD45D89DB35D24B386

1.JPG

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Step 5: Create the Merkle Tree

Finally, I will create the Merkle tree for all the inputs and their respective hashes.

1.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

If the number of leaves on the tree is odd, what should you do? Explain.

In cases where the leaves on the Merkel Tree are odd, we will not be able to calculate the root hash. This is as a result of its nature, it is designed to be calculated in even not odds. I will live an example below in a screenshot so you could see it practically.

But what is done here is that the last leaf should be doubled in other to get a parent leaf either than that, there is no other way.

1.png

So what I explained above in a short sentence is shown below here.

you can see that the tree has 7 leaves, leaves, so we should double the last leaf by creating another SCA7 which is then merged with SCA7 to get SCA7SCA7. That will now be the parent hash

1.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Conclusion

There is no doubt that hashing is the heart of blockchain technology. Apart from the security, it gives to the platform, miners tend to receive rewards each time they verify hash values by solving complex math

The lecture was really deep and touched deep on how the blockchain actually works. I want to thank the professor for the lecture and also his time in making this resource. it has really guided me in making my submissions.

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

3zpz8WQe4SNGWd7TzozjPgq3rggennavDx3XPY35pEAVnpxq84Yqn6h7YbADVgu9ivzpqbSfPP3L9NZYCPTMgpa8sZ5fWZnJEsdTB2WhxSxHCNfEeUQFDyFiEsB4o18TDEwTKzVrApUhMbArPjJ6.png

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...