Steemit Crypto Academy, Season 3: Week 4 | Homework task for professor [@pelon] | ROOT HASH Y ÁRBOL MERKLE.
Explain the hash rate in detail.
Hashrate is measure of number of hashes generated per second. It is literal meaning or definition of hashrate. If we further try to analyse it, than we can say that, it is the measure of number of calculations carried out in a second because hash is derrived after solving cryptographic puzzles. Another perspective to look at it is in terms of computational power of hardware used in mining. So hashrate is a measure of computational power as well. More the computational power, more will be hashrate and therefore more efficient is the hardware used.
Let's take example of PoW algorithm in Bitcoin. We know that, PoW is meant to determine right hash of each transaction, so as to verify and validate the transaction before recording on blockchain. If we choose two GPus, one with hasheare of 10k and other with 100k. It means that the GPU with hashrate of 10k will generate 10000 hashes per second and one with hashrate of 100k will generate 100000 hashes per second. So the probably of finding correct hash on GPU with hashrate of 100k is more than that with 10k . It is basically because of higher computational power of GPU that hashrate of one is more than other.
All the computational power used to mine a particular coin would be therefore known as the hashrate of the particular blockchain or cryptocoin. More this rate, more secure is the blockchain because more hashrate would mean more miners are competing to find a correct hash or in other words we can say that more computational power is put to use to save the particular blockchain from attacks. A fall in hashrate would therefore make a blockchain more susceptible to the attacks like 51% attack.
Make the following Merkle Tree:
Transaction (tree leaves): Steem1; Steem2; Steem3; Steem4; Steem5; Steem6; Steem7; Steem8.
Merkle tree is a representation of cryptographically coded data in the form of hashes. Each leaf node is formed by single hash and the first branch is binary ( combination of two leaf nodes) and second order branch is combination of first order branches . The concentration of hashes continues untill we reach root hash or master hash.
As for my understanding of basic framework of blockchain is concerned, merkle tree is perfect representation of that franework , gifted by Ralph Merkle in 1979. Merkle tree has served to enhance security, simplify data verification etc. Let's begin constructing merkle tree .
Step 1 : Leaf nodes
We simply need to generate hashes. I am using SHA 256 for the same.
Steem1
7760E25BCB80ADF1DD92DB339BF5790A59E90CD54EFA072F1250DCE13FA97045
Steem2
FE00506E91CF52BC4B35321E6B978D1A7349397B19C6C1C01E095971FDEC9741
Steem3
A9418332E0C351D6A50C835AA9E57D514F0573C231D491E97726DB8A5844F2DC
Steem4
22F4EC8E20C9CCAF2C313B23F18981B1C73BF39081BCD739E5D998A95A46AB30
Steem5
2A3C87336683AB0DDFA56AFEFC740E6C13A02FEA0A43D6797343B26D7AF0C57B
Steem6
A7BAA6DE0C0658E9E3681966E542BACD116529F5AE9A2D9126CDB1C1D5BC1278
Steem7
D441688DDA7F9285E8811728DD9A3955CF74F0A3C7600C1589D0F1D3B48FFAC7
Steem8
F2E38ED4FF662087B6E9BEAFA4158EBC488B995732057BDA019A6A77FFB5F9F5
Step 2: First Branch node hashes
Here our branch node hashes will be binary as they will be formed by concentration of two successive leaf hashes.
Steem1Steem2
A5568957014F6AC3866923C7DE20D375E706B8D8C9F453636E90B9965ABEC62B
Steem3Steem4
18D25196DB699F6AB9222B7302EB8A6F6EBFADEC703C07DD5DB8D9455913A499
Steem5Steem6
D118E137F92A0DBEA138B6BF70C7714153A7BC393CD0272A44BD94864645224B
Steem7Steem8
A81D57BA11AEDFA9EFBBA42F6523D75D1EFA50B22C5E3557A21CEFFE87DDFC4A
Step 3 : Second branch node hashes
These will be formed by combining two first order branch hashes in one.
Steem1Steem2Steem3Steem4
8A248C05E69C4F1AA403AD18A7F445FF500C42483DA425CE0C980CDB2FD1AD9B
Steem5Steem6Steem7Steem8
8B0935AEAB3F51BFA2B0750703EE2387E2B20EB19B0D24227E180C03A851AF17
Step 4 : Root hash.
Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8
9C2FC83F36D59B8ED5033D2BCC417728583C8DAA0AA9868FD374BE3619D6E4F9
Merkle tree
Final merkle tree of steem 1 -8 hashes.
Tell the steps to follow to verify if Steem6 is included in the Markle Tree.
To verify, if Steem6 is included in Merkle tree, we need to have hash of node Steem1Steem2Steem3Steem4 , Steem5, Steem7S5eem8. Than we will proceed in a step by step manner:
Let's generate hash of Steem6 with the help of SHA 256
As we got hash of Steem6 above, combine it with hash ot Steem5, so as to get Steem5Steem6 hash .
Combine the Steem5Steem6 hash with Steem7Steem8 hash that we have already, so as to get hash for Steem5Steem6Steem7Steem8.
As we already have hash of Steem1Steem2Steem3Steem4, we will. combine it with the hash of above generated hash Steem5Steem6Steem7Steem8, so as to form root hash, that is hash of Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8
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.
For leaf node hashes, I'll be using SHA 256 as mentioned above.
Step one : Leaf node hashes
SCA1
13E0A04BB0E669E1C638DBE3A704743F99F162B25245E4D8C064D35BA38FA8C8
SCA2
27849353A9C8CC4E948EB6E5748EDD79CB83513D8C0ADAF3E8C83D3792C9149B
SCA3
67E872F952C105C35E0BCE130536D061F4999DCA5593754BA9BA7BE59B8E7C0D
SCA4
491928A32BAE70A12FA251412BBFD7C9999F317BA6BF577C283C724225270A43
SCA5
99C078C39CDE7F47799E0E8691460A9F3E83E78D498EA989308FCFCC58907B19
SCA6
7A648D887B124DB14E96E23BA92783E7F26D00957C19B9B8229632C2C1873729
SCA7
7E0BBD6BA4BA9896F9911AF46B06DD2C47535F9C80B29D693FDF6B9319D0D68E
SCA8
562ABCEEB497E1FE7AE275A883FD5EF9D92A05F5C19D82ABAA0DC1571B7DF3AD
Step two: First Branch node hashes
These hashes are binary, they are formed by concentration of two successive leaf nodes in one branch node.
SCA1SCA2
91B09BBA815748166FB36413342C7E4E7E809F4BAC538C0418841A4476B527EF
SCA3SCA4
B49B48697A3ACBC5E3D2E36B6EE49C44020D88E664C5C1AA7A7CF34058177379
SCA5SCA6
1078A5288323A9EA00C8A2861B6970F6EA17D0022957C6ED99211751C4829A1B
SCA7SCA8
AA55EC5A6B11393B289C4B2B6916172ACC2941C5C978FB1D7BF02696BAB323A4
Step 3 : Second branch node hashes
These are formed by combination of two successive first order branch modes in one.
SCA1SCA2SCA3SCA4
F50DC120CBF6C46923037F6D7F41D4153ECC9AB7430DDA662C142DB1FFE483F7
SCA4SCA6SCA7SCA8
A3D8CA8494CC426ABD5E1FC5FA0FEAE4F2B2ECE4C4CECDCA05E19EB66542533F
Step 4 : Root hash
SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA8
CB40CA6DB72DD507CF9118963F94B7740822258E74AFB0FD45D89DB35D24B386
Merkle tree
Final Merkel tree of SCA 1 - 8 hashes .
If the number of leaves on the tree is odd, what should you do? Explain.
As seen above, two leave hashes combine to form a branch and branches combine to form a second branch or a root depending upon the number of hashes. So a pair of leave hashes combine to form a branch hash, now the question arises that if number of leaves is odd, than what to do.
In case of odd leaves, we will duplicate the leaf which is odd. For example, SCA1, SCA2 , SCA3 , SCA4 SCA5. SCA6, SCA7. In this case, we have odd number of leaves, so we will duplicate SCA7 and combine them to form a branch hash. And that branch of two hashes will concentrate along with other hashes to form a root hash.
In the example given above, root hash will be SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA7
Thanks
Thank you, I'll surely act upon suggestions.