Steemit Crypto Academy||Season 3-week 4 | Homework task for Professor @pelon53 : Root Hash and Merkle Tree

in SteemitCryptoAcademy3 years ago

Motivational Quotes Instagram Post.jpg

Greetings Steemiams.
Welcome to my homework task entry on Root Hash and Merkle Tree.

COLLAGE_20210716_113906.jpg

  1. Explain in detail the hash rate.
    Hash rate is the total speed or computational power per second used during mining. It can be referred to as the speed used in mining. Hash rate is also referred to as hash power.

Mining is the the use of powerful computers by miners to solve complex mathematical problems. After solving a mathematical problem successfully, a miner stand a chance of acquiring the rewards of that mined blocks. The process of mining brings about the creation of new blocks in a blockchain and this is where hash rate come into play.

Hash rate measurement and units

Hash/second (Hash per second) is the unit used in the measurement of a hash rate

For instance, 3M hash/s shows that 3 million hash computations are done every second.
Hash rate is calculated using the formula below : Hash rate = No. of hashes solved / time

Importance of hash rate

The hash rate is an essential part of a network as it used to determine the strength of a network blockchain and specifically its security. The hash rate of a network becomes more secured when more machines (miners ) are trying to discover the next block of a network

A network becomes vulnerable when there is a fall in its hash rate; i.e unable to perform a 51% attack.

Hash rate is is a very important part of a network system, as it gives an estimate and also represents the productivity and efficiency of the mining machine used, since computing system with a high hash rate generate more rewards to its miners.

COLLAGE_20210716_113906.jpg

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

I first of all generate the hash rate for each leaf (Steem 1 to 8) using SHA-256 before the creation of the Merkle Tree.

Step 1: Generation of the hash of leaves (Steem 1 to 8) of the Merkle Tree

Steem1

Screenshot_20210724-115330_1627124572190.jpg
Hash: 7760E25BCB80ADF1DD92DB339BF5790A59E90CD54EFA072F1250DCE13FA97045

Steem2

Screenshot_20210724-115747_1627124611538.jpg
Hash: FE00506E91CF52BC4B35321E6B978D1A7349397B19C6C1C01E095971FDEC9741

Steem3

Screenshot_20210724-115839_1627124646273.jpg
Hash: A9418332E0C351D6A50C835AA9E57D514F0573C231D491E97726DB8A5844F2DC

Steem4

Screenshot_20210724-115911_1627124727881.jpg
Hash: 22F4EC8E20C9CCAF2C313B23F18981B1C73BF39081BCD739E5D998A95A46AB30

Steem5

Screenshot_20210724-115949_1627124762628.jpg
Hash: 2A3C87336683AB0DDFA56AFEFC740E6C13A02FEA0A43D6797343B26D7AF0C57B

Steem6

Screenshot_20210724-120047_1627124810970.jpg
Hash: A7BAA6DE0C0658E9E3681966E542BACD116529F5AE9A2D9126CDB1C1D5BC1278

Steem7

Screenshot_20210724-120109_1627124845115.jpg
Hash: D441688DDA7F9285E8811728DD9A3955CF74F0A3C7600C1589D0F1D3B48FFAC7

Steem8

Screenshot_20210724-120140_1627124912059.jpg
Hash: F2E38ED4FF662087B6E9BEAFA4158EBC488B995732057BDA019A6A77FFB5F9F5

Step 2: I proceeded to the generation of the Merkle Tree branches hash.

Steem1Steem2

Screenshot_20210724-122356_1627126102722.jpg
Hash: A5568957014F6AC3866923C7DE20D375E706B8D8C9F453636E90B9965ABEC62B

Steem3Steem4

Screenshot_20210724-122451_1627126135038.jpg
Hash: 18D25196DB699F6AB9222B7302EB8A6F6EBFADEC703C07DD5DB8D9455913A499

Steem5Steem6

Screenshot_20210724-122600_1627126183155.jpg
Hash: D118E137F92A0DBEA138B6BF70C7714153A7BC393CD0272A44BD94864645224B

Steem7Steem8

Screenshot_20210724-122718_1627126220084.jpg
Hash: A81D57BA11AEDFA9EFBBA42F6523D75D1EFA50B22C5E3557A21CEFFE87DDFC4A

Step 3: Generation of the hash of higher branches of the Merkle Tree.

Steem1Steem2Steem3Steem4

Screenshot_20210724-123814_1627126890213.jpg
Hash: 8A248C05E69C4F1AA403AD18A7F445FF500C42483DA425CE0C980CDB2FD1AD9B

Steem5Steem6Steem7Steem8

Screenshot_20210724-123908_1627126925501.jpg
Hash: 8B0935AEAB3F51BFA2B0750703EE2387E2B20EB19B0D24227E180C03A851AF17

Step 4: I proceeded to generate the Merkle root of the Tree.

Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8

Screenshot_20210724-124655_1627127311635.jpg
Hash: 9C2FC83F36D59B8ED5033D2BCC417728583C8DAA0AA9868FD374BE3619D6E4F9

Step 5: Creation of the Merkle Tree, using the root hash, higher branches hash, branch hash and the leaves hash.

Blue and Yellow Clean and Bold Vaccine Scheduling General Health Poster (1)_1627147963583.jpg

COLLAGE_20210716_113906.jpg

2b.Tell the steps to follow to verify if Steem6 is included in the Markle Tree.

In other to verify that Steem6 is included in the Merkel tree, I took the following steps

  • Step 1
    I generated the hash of the leaf5 (Steem 5)

Screenshot_20210724-115949_1627124762628.jpg

  • Step 2:
    I generated the parent hash of Steem7 and Steem8 (Steem7Steem8)
    Screenshot_20210724-122718_1627126220084.jpg
  • Step 3:
    I generated the parent hash of Steem1Steem2Steem3Steem4

Screenshot_20210724-123814_1627126890213.jpg

  • Step 4:
    Lastly I added the hash of Steem5Steem6Steem7Steem8 to the hash of Steem1Steem2Steem3Steem4 to get the root hash.

Screenshot_20210724-124655_1627127311635.jpg

If Steem6 is removed from the hash root, then the hash root will be different from the hast root above.

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

  • Step 1: First of all I generated the hash of the leaves of the Merkle Tree

SCA1

Screenshot_20210724-165310_1627142526289.jpg
Hash: 13E0A04BB0E669E1C638DBE3A704743F99F162B25245E4D8C064D35BA38FA8C8

SCA2

Screenshot_20210724-165452_1627142560744.jpg
Hash: 27849353A9C8CC4E948EB6E5748EDD79CB83513D8C0ADAF3E8C83D3792C9149B

SCA3

Screenshot_20210724-165604_1627142627028.jpg
Hash: 67E872F952C105C35E0BCE130536D061F4999DCA5593754BA9BA7BE59B8E7C0D

SCA4

Screenshot_20210724-165650_1627142658812.jpg
Hash: 491928A32BAE70A12FA251412BBFD7C9999F317BA6BF577C283C724225270A43

SCA5

Screenshot_20210724-165746_1627142689618.jpg
Hash: 99C078C39CDE7F47799E0E8691460A9F3E83E78D498EA989308FCFCC58907B19

SCA6

Screenshot_20210724-165859_1627142716238.jpg
Hash: 7A648D887B124DB14E96E23BA92783E7F26D00957C19B9B8229632C2C1873729

SCA7

Screenshot_20210724-170003_1627142754072.jpg
Hash: 7E0BBD6BA4BA9896F9911AF46B06DD2C47535F9C80B29D693FDF6B9319D0D68E

SCA8

Screenshot_20210724-170051_1627142808558.jpg
Hash: 562ABCEEB497E1FE7AE275A883FD5EF9D92A05F5C19D82ABAA0DC1571B7DF3AD

Step 2: Generation of the hash of the Merkle Tree branches.

SCA1SCA2

Screenshot_20210724-171548_1627143781793.jpg
Hash: 91B09BBA815748166FB36413342C7E4E7E809F4BAC538C0418841A4476B527EF

SCA3SCA4

Screenshot_20210724-171734_1627143817562.jpg
Hash: B49B48697A3ACBC5E3D2E36B6EE49C44020D88E664C5C1AA7A7CF34058177379

SCA5SCA6

Screenshot_20210724-171830_1627143848419.jpg
Hash: F026924CD1285FF92C2A2DE9B9313027EB67273A82375C939348C887F6B52F77

SCA7SCA8

Screenshot_20210724-171923_1627143889341.jpg
Hash: AA55EC5A6B11393B289C4B2B6916172ACC2941C5C978FB1D7BF02696BAB323A4

Step 3: Generation of the hash of higher branches of the Merkle Tree.

SCA1SCA2SCA3SCA4

Screenshot_20210724-173224_1627144592631.jpg
Hash: F50DC120CBF6C46923037F6D7F41D4153ECC9AB7430DDA662C142DB1FFE483F7

SCA5SCA6SCA7SCA8

Screenshot_20210724-173403_1627144627691.jpg
Hash: A3D8CA8494CC426ABD5E1FC5FA0FEAE4F2B2ECE4C4CECDCA05E19EB66542533F

Step 4: Generation of the root hash of the Merkel Tree.

SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA8

Screenshot_20210724-174317_1627145064845.jpg
Hash: CB40CA6DB72DD507CF9118963F94B7740822258E74AFB0FD45D89DB35D24B386

Step 5: Creation of the Merkle Tree, using the root hash, higher branches hash, branch hash and the leaves hash.

Blue and Yellow Clean and Bold Vaccine Scheduling General Health Poster (2)_1627148010041.jpg

COLLAGE_20210716_113906.jpg

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

Naturally the Merkle Tree is ought to have even numbers so it can produce a root hash with an equal number of branches and leaves.

If the number of leaves on the tree is odd, before drawing the Merkle Tree the last number should be duplicated and hashed with itself in order to get an even number of leaves.

For example; For a Merkle Tree with 5 leaves, leave5 which is the last and odd leave should be duplicated.

Merkle root of the will be Hash12345555.

The higher brancehes will be Hash1234 and Hash5555

The second branches of the Merkle Tree will be (Hash12, Hash34) and (Hash55, Hash55)to get Hash1234. Then Hash55 with Hash55 to generate Hash5555.

The leaves will be Hash1, Hash2, Hash3, Hash4 and Hash5.

Example:
1_wNm1yknGeuiSQyIFYxHrhA.png

An even Merkle Tree created from an odd number of leaves Source

COLLAGE_20210716_113906.jpg

Conclusion

This lecture on Root Hash and Merkle Tree has really opened my knowledge on how blockchain hasting works and how to generate a Merkle Tree.

All thanks to Professor @pelon53 for this wonderful lecture.

Cc: -
@pelon53 .

Sort:  
Loading...

Coin Marketplace

STEEM 0.20
TRX 0.15
JST 0.030
BTC 65353.52
ETH 2654.64
USDT 1.00
SBD 2.84