{"id":19630,"date":"2022-11-29T10:17:52","date_gmt":"2022-11-29T10:17:52","guid":{"rendered":"https:\/\/zebpay.com\/au\/?p=19630"},"modified":"2022-11-29T10:17:54","modified_gmt":"2022-11-29T10:17:54","slug":"what-is-a-merkle-tree","status":"publish","type":"post","link":"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree","title":{"rendered":"What is a Merkle Tree in Blockchain"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_66_1 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#Merkle_Tree_explained\" title=\"Merkle Tree explained\">Merkle Tree explained<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#Merkle_Tree_Data_Structure\" title=\"Merkle Tree Data Structure\">Merkle Tree Data Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#What_is_a_Merkle_Root\" title=\"What is a Merkle Root?\">What is a Merkle Root?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#How_Does_a_Merkle_Tree_Work\" title=\"How Does a Merkle Tree Work\">How Does a Merkle Tree Work<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#Benefits_of_Merkle_Tree_in_Blockchain\" title=\"Benefits of Merkle Tree in Blockchain\">Benefits of Merkle Tree in Blockchain<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#Importance_of_Merkle_Trees\" title=\"Importance of Merkle Trees\">Importance of Merkle Trees<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#Applications_of_Merkle_Tree\" title=\"Applications of Merkle Tree\">Applications of Merkle Tree<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/zebpay.com\/au\/blog\/what-is-a-merkle-tree\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Merkle_Tree_explained\"><\/span>Merkle Tree explained<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Merkle tree is a data structure which was first conceived by Ralph Merkle back in the 1980s. It is a technique used to verify data integrity in an efficient and decentralised way. Since most crypto tokens are powered by decentralised blockchains, it becomes imperative for one to understand how data is stored and verified on these blockchains.&nbsp;<\/p>\n\n\n\n<p>If you are curious to know more about Merkle trees, then you are in the right place. In this article let us figure out what Merkle Trees are all about. We will dissect the information in the simplest way possible to make sure you don\u2019t end up with a question mark.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Merkle_Tree_Data_Structure\"><\/span>Merkle Tree Data Structure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before diving into the structure of a Merkle Tress, let us understand the fundamental components of a blockchain. The most basic component of a blockchain is a transaction. A transaction has information on the movement of crypto from one account to the other. A bunch of transactions are together stacked up on a block. And each block is linked to the previous block. All the blocks together make up a blockchain.&nbsp;<\/p>\n\n\n\n<p>A Merkle tree consists of hash functions. A hash function is a string of random alphanumerics which are created from transaction data. It is almost impossible to trace input from a hash function because of the sheer amount of computing power required to decrypt it. So effectively, a hash function becomes a one-way function. This hash function is one of the many components of a block.&nbsp;<\/p>\n\n\n\n<p>Read more: <a href=\"https:\/\/zebpay.com\/au\/blog\/bitcoin-hash-rate\" target=\"_blank\" rel=\"noreferrer noopener\">What is Bitcoin Hash Rate<\/a><\/p>\n\n\n\n<p>Each block on the blockchain has a Merkle root and information is split in the form of a tree where each node in the tree is eventually connected to the root. And each block has the hashed signature of the previous block which connects one block to the next.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Merkle_Root\"><\/span>What is a Merkle Root?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>A Merkle Root is the root node for each block of the <a href=\"https:\/\/zebpay.com\/au\/blog\/blockchain-vs-cryptocurrency\" target=\"_blank\" rel=\"noreferrer noopener\">blockchain<\/a>. It contains the hashed information of all the transactions in that block. It provides a single-point validation for every transaction on that block. It is an essential part of the entire tree structure because of the condensed nature of information storage which speeds up verification processes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_Does_a_Merkle_Tree_Work\"><\/span>How Does a Merkle Tree Work<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"384\" src=\"https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/How-does-a-Merkle-Tree-Work-1024x384.jpg\" alt=\"How Does Merkle Tree Work\" class=\"wp-image-19635\" srcset=\"https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/How-does-a-Merkle-Tree-Work-1024x384.jpg 1024w, https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/How-does-a-Merkle-Tree-Work-300x113.jpg 300w, https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/How-does-a-Merkle-Tree-Work-768x288.jpg 768w, https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/How-does-a-Merkle-Tree-Work.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>How are Merkle trees used in the Bitcoin blockchain? A Merkle tree database is used on the Bitcoin blockchain to split the data of the block securely and make sure that the information is not lost, damaged or tampered with. Simply put, without a Merkle tree, it gets extremely difficult or maybe even impossible to validate transactions because of the enormity of information on the Bitcoin blockchain.&nbsp;<\/p>\n\n\n\n<p>The Merkle tree has three types of nodes<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Leaf-node:<\/strong> It consists of the hashed data of one transaction of that particular block<\/li>\n\n\n\n<li><strong>Branches: <\/strong>The intermediate nodes that club the hashes of various individual transactions<strong>&nbsp;&nbsp;<\/strong><\/li>\n\n\n\n<li><strong>Root node:<\/strong> This node has the hash information of the entire block&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>This style of data management helps in validating individual transactions without downloading the entire blockchain, which has terra bytes of data. It is an efficient, secure and cryptographic way to make the blockchain run.<\/p>\n\n\n\n<p>Below is a Merkle hash tree example for reference. H(ABCDEFGH) is the root node. T(A), T(B), T(C) and so on are the leaf nodes which have individual transaction information. The rest of the nodes are intermediate nodes. The below image shows how the data is split for easy validation. Each transaction data is converted into a hash function as shown in H(A), H(B) etc. These hash functions are attached to each other forming H(AB), H(CD) etc. And all of the intermediate hashes are attached to form the block hash function.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"751\" height=\"425\" src=\"https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/merkle-hash-tree.png\" alt=\"Merkle Hash Tree Example\" class=\"wp-image-19629\" srcset=\"https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/merkle-hash-tree.png 751w, https:\/\/zebpay.com\/au\/wp-content\/uploads\/2022\/11\/merkle-hash-tree-300x170.png 300w\" sizes=\"(max-width: 751px) 100vw, 751px\" \/><figcaption class=\"wp-element-caption\"><strong><em>Image source:<\/em><\/strong><em> Investopedia<\/em><\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Benefits_of_Merkle_Tree_in_Blockchain\"><\/span>Benefits of Merkle Tree in Blockchain<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Reduces processing time:<\/strong> Since the transactions on the block are distributed amongst several validators, each validator simultaneously works on unique transactions. This is much more efficient than a method where one transaction is sequentially validated after another.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Lesser CPU bandwidth required: <\/strong>Similar to the reason above, the distributed style of data processing requires lesser CPU power at an individual level. Together this computing power adds up to be a lot, but the distributed nature of validation lessens the burden on each validator.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Detects data tampering:<\/strong> A widely asked question is \u201c does Merkle tree increase security\u201d. This question will be answered here. Recalling what we have mentioned above that each hash function is unique to its input is essential to understand this aspect. If details of even a single transaction are changed, it gets reflected in the hash output since each input has a unique output. And since each leaf which stores the hash of a transaction is connected to another leaf, this change in value cascades to the root of the tree.&nbsp;<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Importance_of_Merkle_Trees\"><\/span>Importance of Merkle Trees<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Merkle tree cryptography has proven to be tremendously beneficial for the working of a blockchain. They form an integral part of the blockchain because of the below reasons<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reducing the burden on individual nodes thereby making the blockchain scalable<\/li>\n\n\n\n<li>A fast method to validate transactions instead of following a sequential approach<\/li>\n\n\n\n<li>Ensuring the security of the transactions because any manipulation is reflected in the root hash of a block<\/li>\n\n\n\n<li>The Merkle tree blockchain structure reduces power consumption at an individual level when compared to other verification methods<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Applications_of_Merkle_Tree\"><\/span>Applications of Merkle Tree<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The concept of Merkle trees has been widely adopted in the domain of Crypto and data management in general. Below are some of the most famous applications of Merkle trees<\/p>\n\n\n\n<p><strong>Bitcoin:<\/strong> It is used extensively in block validation of the bitcoin blockchain. As explained above, Merkle trees exist in each block header.<\/p>\n\n\n\n<p><strong>Mining of Bitcoins:&nbsp; <\/strong>Each miner individually validates the transactions and stores them in the leaf of the Merkel tree<\/p>\n\n\n\n<p><strong>Verification: <\/strong>The concept of the Merkle tree is also being applied in <a href=\"https:\/\/zebpay.com\/au\/blog\/proof-of-reserves\" target=\"_blank\" rel=\"noreferrer noopener\">Proof of Reserves<\/a> to ensure consistency in asset management<\/p>\n\n\n\n<p><strong>Hyperledger Fabric: <\/strong>The concept of the Merkle tree is also being used in the Hyperledger fabric blockchain to hash the block data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To sum it all up, Merkel trees are one of the most efficient ways to manage data on blockchains. It has proven to be highly useful and efficient in the verification and mining processes of cryptos. Beyond that, it is a fundamental concept that every crypto enthusiast should know about.<\/p>\n\n\n\n<p>If you found this article to be helpful, do share it with the ones who are curious just like you.&nbsp;<\/p>\n\n\n\n<p>You can read more about the latest events in crypto on <a href=\"https:\/\/zebpay.com\/au\/blog\" target=\"_blank\" rel=\"noreferrer noopener\">ZebPay blogs<\/a>. Level up your crypto trading experience using ZebPay\u2019s brand-new update.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Merkle Tree explained Merkle tree is a data structure which was first conceived by Ralph Merkle back in the 1980s. It is a technique used to verify data integrity in an efficient and decentralised way. Since most crypto tokens are powered by decentralised blockchains, it becomes imperative for one to understand how data is stored [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":19636,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[14],"tags":[79],"class_list":["post-19630","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-crypto","tag-blockchain"],"acf":[],"_links":{"self":[{"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/posts\/19630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/comments?post=19630"}],"version-history":[{"count":2,"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/posts\/19630\/revisions"}],"predecessor-version":[{"id":19638,"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/posts\/19630\/revisions\/19638"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/media\/19636"}],"wp:attachment":[{"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/media?parent=19630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/categories?post=19630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zebpay.com\/au\/wp-json\/wp\/v2\/tags?post=19630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}