Skip to content

Commit

Permalink
Edited ch09.asciidoc with Atlas code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexPro committed May 1, 2017
1 parent b953605 commit 48f4060
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ch09.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Looking at this new block, the node finds the +previousblockhash+ field, which c

((("merkle trees", id="merkle09")))((("blockchain technology", "merkle trees", id="BCTmerkle09")))Each block in the bitcoin blockchain contains a summary of all the transactions in the block, using a _merkle tree_.

A _merkle tree_, also known as a _binary hash tree_, is a data structure used for efficiently summarizing and verifying the integrity of large sets of data. Merkle trees are binary trees containing cryptographic hashes. The term "tree" is used in computer science to describe a branching data structure, but these trees are usually displayed upside down with the "root" at the top and the "leaves" at the bottom of a diagram, as you will see in the examples that follow.
((("binary hash trees", see="merkle trees")))A _merkle tree_, also known as a _binary hash tree_, is a data structure used for efficiently summarizing and verifying the integrity of large sets of data. Merkle trees are binary trees containing cryptographic hashes. The term "tree" is used in computer science to describe a branching data structure, but these trees are usually displayed upside down with the "root" at the top and the "leaves" at the bottom of a diagram, as you will see in the examples that follow.

[[chain_of_blocks]]
.Blocks linked in a chain, by reference to the previous block header hash
Expand Down Expand Up @@ -183,7 +183,7 @@ The process continues until there is only one node at the top, the node known as
.Calculating the nodes in a merkle tree
image::images/mbc2_0902.png["merkle_tree"]

Because the merkle tree is a binary tree, it needs an even number of leaf nodes. If there is an odd number of transactions to summarize, the last transaction hash will be duplicated to create an even number of leaf nodes, also known as a _balanced tree_. This is shown in <<merkle_tree_odd>>, where transaction C is duplicated.
((("balanced trees")))Because the merkle tree is a binary tree, it needs an even number of leaf nodes. If there is an odd number of transactions to summarize, the last transaction hash will be duplicated to create an even number of leaf nodes, also known as a _balanced tree_. This is shown in <<merkle_tree_odd>>, where transaction C is duplicated.

[[merkle_tree_odd]]
.Duplicating one data element achieves an even number of data elements
Expand Down

0 comments on commit 48f4060

Please sign in to comment.