Crypto Academy / Season 3 - week 4 / Homework Submission Post for Professor @pelon53 / Root Hash and Merkel Tree

in SteemitCryptoAcademy3 years ago (edited)

Hi Professor @pelon53, I am @ononiwujoel, one of your students in Crypto Academy and a member of the steemit platform. This is my homework submission post from your lecture Root Hash and Merkel Tree

cover.jpg

Introduction

One of the most successful innovations of this century is cryptocurrencies and DeFi because it answered the long standing question of how to create a decentralized financial system and has since its creation continued to gather more users and enthusiast. However one of the secrets to the success of cryptocurrencies is reliability and high security of the blockchain technology on which they're built.

The blockchain system connects blocks of data using hashtags so as the maintain their uniqueness and prevent using an already spent asset. The Hashes connects several information about the blocks in pairs until it gets the last hash that will then have a complete information on all transactions and hashes in the block.
This Hash roots and the Mechanisms that connects hashes also called the Merkel Tree is what we are discussing in this assignment.

hr.jpg

1.- Explain in detail the hash rate.

hr.jpg

Hash rate can simply be defined as the measure of computational power and speed with which a computer completes a mining process and processes transactions by solving the hash algorithms. Hash rate is measured in hashes per second

1-2.jpgsource

The more hash rate a miner has, the more speed and efficiency he will have in solving the complex hash algorithms.

Having a high hash rate is very important, especially for Bitcoin miners because in this is what determines how fast you will be able to successfully solve the hash algorithms and find the next block and then earn the rewards for mining that block. In proof of work it is more like a competition because the more power you're able to add the blockchain by mining blocks, the more rewards you will earn so if you don't have devices with high mining speed you tend to loose out big time. This is one of the reasons mining Bitcoin and other PoW blockchains is very expensive and Power-consuming because the devices capable of mining with high hash rates are really expensive and takes lot of energy to work.

2-2.jpg
source

In the Bitcoin hash rate chart above we can see the drop in hash rate of Bitcoin which I learnt is as a result of the crackdown on Bitcoin miners in China. So this shows that the more miners we have on a blockchain the more difficult the process becomes and also the reward decreases. This simply means the higher the general hash rate of a blockchain, the more difficult mining becomes with lesser rewards in PoW.

So we can see that the hash rate tells a lot about the blockchain.

hr.jpg

2.- 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.

hr.jpg

  • We'll start by generating the Merkel tree leaves hash.

Steem1
st1.jpg
Hash: 7760E25BCB80ADF1DD92DB339BF5790A59E90CD54EFA072F1250DCE13FA97045

Steem2
st2.jpg
Hash: FE00506E91CF52BC4B35321E6B978D1A7349397B19C6C1C01E095971FDEC9741

Steem3
st3.jpg
Hash: A9418332E0C351D6A50C835AA9E57D514F0573C231D491E97726DB8A5844F2DC

Steem4
st4.jpg
Hash: 22F4EC8E20C9CCAF2C313B23F18981B1C73BF39081BCD739E5D998A95A46AB30

Steem5
st5.jpg
Hash: 2A3C87336683AB0DDFA56AFEFC740E6C13A02FEA0A43D6797343B26D7AF0C57B

Steem6
st6.jpg
Hash: A7BAA6DE0C0658E9E3681966E542BACD116529F5AE9A2D9126CDB1C1D5BC1278

Steem7
st7.jpg
Hash: D441688DDA7F9285E8811728DD9A3955CF74F0A3C7600C1589D0F1D3B48FFAC7

Steem8
st8.jpg
Hash: F2E38ED4FF662087B6E9BEAFA4158EBC488B995732057BDA019A6A77FFB5F9F5

  • Now we can proceed to generate the Merkel Tree branches hash

Steem1Steem2
st9.jpg
Hash: A5568957014F6AC3866923C7DE20D375E706B8D8C9F453636E90B9965ABEC62B

Steem3Steem4
st10.jpg
Hash: 18D25196DB699F6AB9222B7302EB8A6F6EBFADEC703C07DD5DB8D9455913A499

Steem5Steem6
st11.jpg
Hash: D118E137F92A0DBEA138B6BF70C7714153A7BC393CD0272A44BD94864645224B

Steem7Steem8
st12.jpg
Hash: A81D57BA11AEDFA9EFBBA42F6523D75D1EFA50B22C5E3557A21CEFFE87DDFC4A

  • Next, we'll generate in the Merkel Tree is the higher branches

Steem1Steem2Steem3Steem4
st13.jpg
Hash: 8A248C05E69C4F1AA403AD18A7F445FF500C42483DA425CE0C980CDB2FD1AD9B

Steem5Steem6Steem7Steem8
st14.jpg
Hash: 8B0935AEAB3F51BFA2B0750703EE2387E2B20EB19B0D24227E180C03A851AF17

  • Next in the Merkel Tree, we generate the Root Hash also known as the Merkel root

Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8
st15.jpg
Hash: 9C2FC83F36D59B8ED5033D2BCC417728583C8DAA0AA9868FD374BE3619D6E4F9

  • Now we can combine the root hash, second level branches, branches and leaves to create our Merkel Tree

3-2.jpg

hr.jpg

Steps to Verify if Steem6 is included in the root hash

  • Firstly, generate the hash of the leaf on one side, that is Steem5

st5.jpg

  • Next generate the parent hash of Steem5 and Steem6

st11.jpg

  • Next, generate the parent hash of Steem5Steem6 and Steem7Steem8

st14.jpg

  • Now join this with its counterpart which is Steem1Steem2Steem3Steem4 to generate the root hash

st15.jpg

If the root hash is different from this then it is incorrect.

hr.jpg

3.- 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.

hr.jpg

  • We start by generating the Merkel Tree leaves

SCA1
sz1.jpg
Hash: 13E0A04BB0E669E1C638DBE3A704743F99F162B25245E4D8C064D35BA38FA8C8

SCA2
sz2.jpg
Hash: 27849353A9C8CC4E948EB6E5748EDD79CB83513D8C0ADAF3E8C83D3792C9149B

SCA3
sz3.jpg
Hash: 67E872F952C105C35E0BCE130536D061F4999DCA5593754BA9BA7BE59B8E7C0D

SCA4
sz4.jpg
Hash: 491928A32BAE70A12FA251412BBFD7C9999F317BA6BF577C283C724225270A43

SCA5
sz5.jpg
Hash: 99C078C39CDE7F47799E0E8691460A9F3E83E78D498EA989308FCFCC58907B19

SCA6
sz6.jpg
Hash: 7A648D887B124DB14E96E23BA92783E7F26D00957C19B9B8229632C2C1873729

SCA7
sz7.jpg
Hash: 7E0BBD6BA4BA9896F9911AF46B06DD2C47535F9C80B29D693FDF6B9319D0D68E

SCA8
sz8.jpg
Hash: 562ABCEEB497E1FE7AE275A883FD5EF9D92A05F5C19D82ABAA0DC1571B7DF3AD

  • Next step in this Merkel Tree is to generate the branches

SCA1SCA2
sz9.jpg
Hash: 91B09BBA815748166FB36413342C7E4E7E809F4BAC538C0418841A4476B527EF

SCA3SCA4
sz10.jpg
Hash: B49B48697A3ACBC5E3D2E36B6EE49C44020D88E664C5C1AA7A7CF34058177379

SCA5SCA6
sz11.jpg
Hash: F026924CD1285FF92C2A2DE9B9313027EB67273A82375C939348C887F6B52F77

SCA7SCA8
sz12.jpg
Hash: AA55EC5A6B11393B289C4B2B6916172ACC2941C5C978FB1D7BF02696BAB323A4

  • Next step in this Merkel Tree is to generate the higher level branches

SCA1SCA2SCA3SCA4
sz13.jpg
Hash: F50DC120CBF6C46923037F6D7F41D4153ECC9AB7430DDA662C142DB1FFE483F7

SCA5SCA6SCA7SCA8
sz14.jpg
Hash: A3D8CA8494CC426ABD5E1FC5FA0FEAE4F2B2ECE4C4CECDCA05E19EB66542533F

  • Next, we can now generate the root hash of this Merkel Tree

SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA8
sz15.jpg
Hash: CB40CA6DB72DD507CF9118963F94B7740822258E74AFB0FD45D89DB35D24B386

  • Finally we can create the Merkel Tree using the hashes we generated.

4-1.jpg

hr.jpg

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

hr.jpg

If the number of leaves on the Merkel Tree is odd we won't be able to calculate the root hash because it is designed in a way to be calculated in even numbers. So in a scenerio as such the last leaf should be doubled in other to get a parent hash to join other branches.

For Example

5-1.jpg

The tree above have 7 leaves, so we should double the last leaf by creating another SCA7 which is then merged with SCA7 to get SCA7SCA7 as its parent hash and from there we can proceed to the higher level branches and then root hash.

6-1.jpg

hr.jpg

Conclusion

Having gone through this lecture and the research required to complete the assignment we have covered a number of important topics including the importance of hash roots and hastages in the blockchain system. We also saw the cascading system used in organising information in the blockchain called the Merkel Tree and important it is to maintain the security and reliability of data in the blockchain. Merkel Tree is actually a concept that can be applied to many other structures apart from the blockchain technology.
Finally we saw the hash rates and how it affects mining process and rewards in cryptocurrencies.

It was a great lecture and I really learnt a lot

Cc: Professor @pelon53

Thanks for viewing and I hope I met your expectations

Sort:  
Loading...

Coin Marketplace

STEEM 0.25
TRX 0.11
JST 0.032
BTC 61041.41
ETH 2947.17
USDT 1.00
SBD 3.85