Crypto Academy / Season 3 / Week 4 - Homework Post for @pelon53 | ROOT HASH AND MERKLE TREE
Hello Steemers, Today I am here with my first post in season 3 week 4 of steemit crypto academy and for this I am completing my homework task given by professsor @pelon53 about the topic ROOT HASH AND MERKLE TREE in order to proceed further as we have studied about hash and cryptography in the last homework post given by professor @pelon53 in the season 3 week 2 of steemit crypto academy.
Some Basic Terms
- Hash : A hash is a fixed-length alphanumeric code that is generated by converting message, data or any word/sentence. These codes(Hash) are generated by different hashing algorithm such as SHA256, SHA1, MD5.
Example : If we convert word "steemit" using the SHA256 hashing algorithm, we will get the following hash code : 8e28424874487e30a83a8e39e344a869fb2d8c86578a0ef4d65f52ecd6b84c7f
- Merkle Tree : Merkle tree is a part of blockchain technology, It is a data structure which contains hash codes of different blockchain transcation, It ehnances security and effenciency of the blockchain.
Merkle Tree created by all the transactions done under the blocks by combining the hash of all the transactions. It helps in the verification that a block transaction is done or not in that block.
These are created by making hash of pairs of nodes until one node is left which will become the root hash.
Explain in detail the hash rate.
- Hash Rate :Hash rate is a unit that is used to calculate computational power that is utilised to mine and do the processing of transactions.
Hash rate is calculated in Hash/sec(H/s).
Unit | Value |
---|---|
1 KH/s | 1000 |
1 MH/s | 1.000.000 |
1 GH/s | 1.000.000.000 |
1 TH/s | 1.000.000.000.000 |
1 PH/ s | 1.000.000.000.000.000 |
Example : Few months before i tried mining on my desktop PC using the CryptoTab browser and I was getting around 1520.9638 H/s, same is attached in the screenshot below.
When a new data is to be added to a new block , the mining machines use their computational power(Hash rate) to generate several new hashes that is lesser than or nearly equal to the value of the target hash, this is done by swapping a single value that is known as 'nounce'.
Whenever a miner's mining rig try to guess new unique hash code, it takes many millions or billions of guesses to hit the target hash code and then the miner generates the new block and in exchange of it the miner receive reward from the pool of newly minted coins.
Whenever a new block is generated it get added at the top of the blockchain. The miner get rewarded with a fixed amount of newly minted coins.
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 : Steem1; Steem2; Steem3; Steem4; Steem5; Steem6; Steem7; Steem8.
Hash codes for Tree Leaves :
- Steem1 :7760e25bcb80adf1dd92db339bf5790a59e90cd54efa072f1250dce13fa97045
- Steem2 :fe00506e91cf52bc4b35321e6b978d1a7349397b19c6c1c01e095971fdec9741
- Steem3 :a9418332e0c351d6a50c835aa9e57d514f0573c231d491e97726db8a5844f2dc
- Steem4 :22f4ec8e20c9ccaf2c313b23f18981b1c73bf39081bcd739e5d998a95a46ab30
- Steem5 :2a3c87336683ab0ddfa56afefc740e6c13a02fea0a43d6797343b26d7af0c57b
- Steem6 :a7baa6de0c0658e9e3681966e542bacd116529f5ae9a2d9126cdb1c1d5bc1278
- Steem7 :d441688dda7f9285e8811728dd9a3955cf74f0a3c7600c1589d0f1d3b48ffac7
- Steem8 :f2e38ed4ff662087b6e9beafa4158ebc488b995732057bda019a6a77ffb5f9f5
- Steem1Steem2 :a5568957014f6ac3866923c7de20d375e706b8d8c9f453636e90b9965abec62b
- Steem3Steem4 :18d25196db699f6ab9222b7302eb8a6f6ebfadec703c07dd5db8d9455913a499
- Steem5Steem6 :d118e137f92a0dbea138b6bf70c7714153a7bc393cd0272a44bd94864645224b
- Steem7Steem8 :a81d57ba11aedfa9efbba42f6523d75d1efa50b22c5e3557a21ceffe87ddfc4a
- Steem1Steem2Steem3Steem4 :8a248c05e69c4f1aa403ad18a7f445ff500c42483da425ce0c980cdb2fd1ad9b
- Steem5Steem6Steem7Steem8 :8b0935aeab3f51bfa2b0750703ee2387e2b20eb19b0d24227e180c03a851af17
- Steem1Steem2Steem3Steem4Steem5Steem6Steem7Steem8 :9c2fc83f36d59b8ed5033d2bcc417728583c8daa0aa9868fd374be3619d6e4f9
- Merkle Tree For Leaves Steem1; Steem2; Steem3; Steem4; Steem5; Steem6; Steem7; Steem8.
- Tell the steps to follow to verify if Steem6 is included in the Markle Tree.
To verify some transacion in a block, the efficient and faster way to do it is using merkle tree, To verify the transaction there is no need to go through the whole transaction to verify it, this can be simply done by checking the root hash, There is no need to download the whole merkle tree, we can just download the root hash/ root node of the tree.
To verify the that Steem6 is included in the Merkle tree we don't need to download the whole merkle tree, we just need to download the merkle root/ root hash and then check whether Steem6 is included in that node or not, If yes then the transaction is carried under the merkle tree otherwise it is not carried out under the merkle tree.
- Tree Leaves : SCA1; SCA2; SCA3; SCA4; SCA5; SCA6; SCA7; SCA8.
Hash codes for Tree Leaves :
- SCA1 :13e0a04bb0e669e1c638dbe3a704743f99f162b25245e4d8c064d35ba38fa8c8
- SCA2 :27849353a9c8cc4e948eb6e5748edd79cb83513d8c0adaf3e8c83d3792c9149b
- SCA3 :67e872f952c105c35e0bce130536d061f4999dca5593754ba9ba7be59b8e7c0d
- SCA4 :491928a32bae70a12fa251412bbfd7c9999f317ba6bf577c283c724225270a43
- SCA5 :99c078c39cde7f47799e0e8691460a9f3e83e78d498ea989308fcfcc58907b19
- SCA6 :7a648d887b124db14e96e23ba92783e7f26d00957c19b9b8229632c2c1873729
- SCA7 :7e0bbd6ba4ba9896f9911af46b06dd2c47535f9c80b29d693fdf6b9319d0d68e
- SCA8 :562abceeb497e1fe7ae275a883fd5ef9d92a05f5c19d82abaa0dc1571b7df3ad
- SCA1SCA2 :91b09bba815748166fb36413342c7e4e7e809f4bac538c0418841a4476b527ef
- SCA3SCA4 :b49b48697a3acbc5e3d2e36b6ee49c44020d88e664c5c1aa7a7cf34058177379
- SCA5SCA6 :f026924cd1285ff92c2a2de9b9313027eb67273a82375c939348c887f6b52f77
- SCA7SCA8 :aa55ec5a6b11393b289c4b2b6916172acc2941c5c978fb1d7bf02696bab323a4
- SCA1SCA2SCA3SCA4:f50dc120cbf6c46923037f6d7f41d4153ecc9ab7430dda662c142db1ffe483f7
- SCA5SCA6SCA7SCA8:a3d8ca8494cc426abd5e1fc5fa0feae4f2b2ece4c4cecdca05e19eb66542533f
- SCA1SCA2SCA3SCA4SCA5SCA6SCA7SCA8 :cb40ca6db72dd507cf9118963f94b7740822258e74afb0fd45d89db35d24b386
- Merkle Tree For Leaves SCA1; SCA2; SCA3; SCA4; SCA5; SCA6; SCA7; SCA8.
- If the number of leaves on the tree is odd, what should you do? Explain.
It is possible to create Merkle tree because these trees are created by hashing the pairs of nodes of the tree until we get only one node which will become the root node/ root hash.
If there are odd number of transactions in the Merkle tree then it is also generated in the same way as the Merkle tree is formed with a even number of transaction.
Conclusion
A hash is a alpha numeric code of fixed length that is generated by converting data to make is unreadable.
Merkle tree is a data structure that contains all the hash codes for the transactions that are carried out under that block.
Merkle root is the last node ( going bottom to top) that contains information of all the nodes under it, means contains all the information of the transactions done under it.
Hash Rate is the numeric value of the computational power of the mining rig, represented by unit Hash/seconds (H/s).