Steemit Crypto Academy Season 3 Week 4 | Homework Post for Professor @pelon53 - Root Hash and Merkle Tree

in SteemitCryptoAcademy3 years ago (edited)

Root Hash and Merkle Tree



x9.jpg

Source

Good night everyone. Tonight I will take a class mentored by professor @pelon53 in the Steemit Crypto Academy community and in this post I will try to complete the homework given by the professor. The topic we will cover in this class is about Root Hash and Merkle Tree. There are three main questions to answer in this homework and let's try to answer them...


Q1.) Explain in Detail The Hash Rate


x10.jpg

Source

Hash and Hash rate are terms that we often hear in the cryptocurrency world, especially in cryptocurrency mining activities and in this post we will discuss about Hash rate and how important it is.

In simple terms, Hash rate is a mining speed level that is seen based on the computing power of a device used in mining a cryptocurrency and this speed level is measured on a Hash per Second (H/s) scale. If a device has a Hash rate of 1 Kilo Hash per Second (KH/s) it means that the device can calculate 1 Kilo Hash (1000 Hash) every second. The higher the Hash rate of a device, the faster the mining process is carried out.

Hash rate is very important in the world of cryptocurrency, the ever-growing growth of the blockchain network causes the Hash rate to increase with increasingly difficult mathematical operations. The higher the hash rate, the better the network security. That way, the higher investor confidence in cryptocurrencies. A high hash rate also indicates a lot of resources are devoted exclusively to processing transactions on the blockchain.

With higher network speeds, it becomes increasingly difficult for hackers to obtain the hashing power needed to attack the network. In addition, mining also becomes increasingly difficult as the difficulty level of mathematical puzzles increases. The harder the mining is going on, the more hash the miner needs to get the reward, causing the total hash to be higher.


Q2.) Make The Following Merkle Tree:

Transaction (Tree Leaves): Steem1, Steem2, Steem3, Steem4, Steem5, Steem6, Steem7, Steem8

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


Tree Leaves Hash


Steem1
Hash:
7760E25BCB80ADF1DD92DB339BF5790A59E90CD54EFA072F1250DCE13FA97045

a.png

Steem2
Hash:
FE00506E91CF52BC4B35321E6B978D1A7349397B19C6C1C01E095971FDEC9741

b.png

Steem3
Hash:
A9418332E0C351D6A50C835AA9E57D514F0573C231D491E97726DB8A5844F2DC

c.png

Steem4
Hash:
22F4EC8E20C9CCAF2C313B23F18981B1C73BF39081BCD739E5D998A95A46AB30

d.png

Steem5
Hash:
2A3C87336683AB0DDFA56AFEFC740E6C13A02FEA0A43D6797343B26D7AF0C57B

e.png

Steem6
Hash:
A7BAA6DE0C0658E9E3681966E542BACD116529F5AE9A2D9126CDB1C1D5BC1278

f.png

Steem7
Hash:
D441688DDA7F9285E8811728DD9A3955CF74F0A3C7600C1589D0F1D3B48FFAC7

g.png

Steem8
Hash:
F2E38ED4FF662087B6E9BEAFA4158EBC488B995732057BDA019A6A77FFB5F9F5

h.png


Tree Branches Hash


Steem1Steem2
Hash:
A5568957014F6AC3866923C7DE20D375E706B8D8C9F453636E90B9965ABEC62B

i.png

Steem3Steem4
Hash:
18D25196DB699F6AB9222B7302EB8A6F6EBFADEC703C07DD5DB8D9455913A499

j.png

Steem5Steem6
Hash:
D118E137F92A0DBEA138B6BF70C7714153A7BC393CD0272A44BD94864645224B

k.png

Steem7Steem8
Hash:
A81D57BA11AEDFA9EFBBA42F6523D75D1EFA50B22C5E3557A21CEFFE87DDFC4A

l.png


Second Level Tree Branches


Steem1Steem2Steem3Steem4
Hash:
8A248C05E69C4F1AA403AD18A7F445FF500C42483DA425CE0C980CDB2FD1AD9B

m.png

Steem5Steem6Steem7Steem8
Hash:
8B0935AEAB3F51BFA2B0750703EE2387E2B20EB19B0D24227E180C03A851AF17

n.png


Root Hash


Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8
Hash:
9C2FC83F36D59B8ED5033D2BCC417728583C8DAA0AA9868FD374BE3619D6E4F9

o.png


Create Merkle Tree


p.png


Steps to Verify if Steem6 is Included in The Markle Tree


To ensure whether Steem6 is included in the Markle Tree or not, then we only need to download the Root Hash and check it. In simple terms, here are the steps.

  • Check Hash Steem5, Steem7Steem8 and Steem1Steem2Steem3Steem4.
  • Calculate Hash Steem6.
  • Calculate Hash Steem5Steem6.
  • Calculate Hash Steem5Steem6Steem7Steem8.
  • Calculate Hash Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8.
  • And it is proven that the last Hash is the Root Hash of the Merkle Tree.
  • Means it is true that Steem6 is included in the Markle Tree.

Q3.) 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

If The Number of Leaves on The Tree is Odd, What should you do? Explain


Tree Leaves Hash


SCA1
Hash:
13E0A04BB0E669E1C638DBE3A704743F99F162B25245E4D8C064D35BA38FA8C8

1.png

SCA2
Hash:
27849353A9C8CC4E948EB6E5748EDD79CB83513D8C0ADAF3E8C83D3792C9149B

2.png

SCA3
Hash:
67E872F952C105C35E0BCE130536D061F4999DCA5593754BA9BA7BE59B8E7C0D

3.png

SCA4
Hash:
491928A32BAE70A12FA251412BBFD7C9999F317BA6BF577C283C724225270A43

4.png

SCA5
Hash:
99C078C39CDE7F47799E0E8691460A9F3E83E78D498EA989308FCFCC58907B19

5.png

SCA6
Hash:
7A648D887B124DB14E96E23BA92783E7F26D00957C19B9B8229632C2C1873729

6.png

SCA7
Hash:
7E0BBD6BA4BA9896F9911AF46B06DD2C47535F9C80B29D693FDF6B9319D0D68E

7.png

SCA8
Hash:
562ABCEEB497E1FE7AE275A883FD5EF9D92A05F5C19D82ABAA0DC1571B7DF3AD

8.png


Tree Branches Hash


SCA1SCA2
Hash:
91B09BBA815748166FB36413342C7E4E7E809F4BAC538C0418841A4476B527EF

9.png

SCA3SCA4
Hash:
B49B48697A3ACBC5E3D2E36B6EE49C44020D88E664C5C1AA7A7CF34058177379

10.png

SCA5SCA6
Hash:
F026924CD1285FF92C2A2DE9B9313027EB67273A82375C939348C887F6B52F77

11.png

SCA7SCA8
Hash:
AA55EC5A6B11393B289C4B2B6916172ACC2941C5C978FB1D7BF02696BAB323A4

12.png


Second Level Tree Branches


SCA1SCA2SCA3SCA4
Hash:
F50DC120CBF6C46923037F6D7F41D4153ECC9AB7430DDA662C142DB1FFE483F7

13.png

SCA5SCA6SCA7SCA8
Hash:
A3D8CA8494CC426ABD5E1FC5FA0FEAE4F2B2ECE4C4CECDCA05E19EB66542533F

14.png


Root Hash


SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA8
Hash:
CB40CA6DB72DD507CF9118963F94B7740822258E74AFB0FD45D89DB35D24B386

15.png


Create Merkle Tree


16.png


If The Number of Leaves on The Tree is Odd


Leaves on Merkle Tree is designed in a pairwise arrangement until it produces only one Root Hash and it will only work if all of them have been met. In this case, the odd leaves will be duplicated and will become an identical pair so that the arrangement of the leaves on the Merkle Tree is even. For more details, let's look at the following pictures.


Sample Case
The following is an illustration showing that the number of leaves on a Merkle Tree is odd. Markle Tree only consists of 7 leaves, namely SCA1, SCA2, SCA3, SCA4, SCA5, SCA6, and SCA7.

x1.png

Duplicating SCA7
The following is an illustration showing that SCA7 is duplicated into an identical pair so that the arrangement of the leaves on the Merkle Tree is even.

x2.png

Now we just need to follow the steps as in question number 2 to generate a Root Hash because the arrangement of the leaves on the Merkle Tree is even.

SCA7SCA7
Hash:
71AF5095F10844EDA37CFCF8EE7712ADD5940F4ADAE1946CE66793270438C39B

x3.png

SCA5SCA6SCA7SCA7
Hash:
2DAE9A09ABB66E133AEBD3F875490C194CD75E035B3AC6D1479379E89CFB2E67

x4.png

SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA7
Hash:
79A243A66E564ABAFEADAAA763B0D5BA7CFFD5462ADDC77D88CA683210AA2784
And finally we get the Root Hash.

x5.png

Merkle Tree Successfull Completed


x6.png


In addition, here are two different schemes, namely seven-leaf and five-leaf. Both are also solved by the same mechanism, duplication. Here is the simple Merkle Tree flow.

  • Illustration of a Merkle Tree with seven leaves, namely SCA1, SCA2, SCA3, SCA4, SCA5, SCA6, and SCA7.

x7.png

  • Illustration of a Merkle Tree with five leaves, namely SCA1, SCA2, SCA3, SCA4, SCA5.

x8.png


Conclusions


Crypto mining is closely related to solving difficult and complex mathematical puzzles that require devices that have high computing power and high speed. The higher the Hash rate, the faster the processing that occurs. The higher the speed of a device, the more energy it uses.

Merkle Tree also plays an important role here, especially in managing transaction details. With Merkle Tree we also do not need to verify all transactions in a block to access a particular transaction details. Root Hash is the last Hash contained in a Merkle Tree and this Hash contains all the details of previous transactions.

Sort:  
Loading...

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 59531.52
ETH 2678.46
USDT 1.00
SBD 2.43