SlideShare a Scribd company logo
1 of 37
• Blockchain, definition, application, benefits
• All the imp terms
• Basics of cryptography---
• Block, definition, header body
• Mining process, consensus,
Merkle tree
• In blockchains, a Merkle tree is a data structure used to encode
blockchain data efficiently and securely.
• Transactions are passed through a hashing function to produce a
transaction hash.
• A block stores all transactions in the blockchain.
• These transactions in a block after being hashed pairs of
transactions are concatenated together to form a single hash.
• This process continues until there is a single hash for the whole
block of transactions.
• In the case there are an odd number of transactions, one will be
double hashed and its hash is concatenated with itself.
• A Merkle tree / binary hash tree is used to summarize and verify
the integrity of these transactions.
• These trees hold cryptographic hashes at their nodes and the tree
is usually displayed up-side-down whereby the root is at the top
and the leaves at the bottom.
Merkle Trees in Bitcoin.
• In Bitcoin, merkle trees are used to summarize all
transactions in a block to produce an overall digital
fingerprint of all transactions in the block.
• This process produces a hash such that if a
transaction in the block is mutated or removed, it
would result in a totally different hash rendering
the block invalid.
• The resulting hash is referred to as the Merkle
root and the hashing algorithm used is SHA-256.
• consider the case where we have four transactions, A,
B, C, and S.
• An even number of transactions. In this case, we will
have four leaves HA, HB, HC, and HD where;
HA = SHA-256(SHA-256(Transaction A))
•
To obtain the parent node HAB, we concatenate the
two hashes HA and HB to obtain a 64-byte string(32-
byte each).
• We then double hash the string to obtain the parent;
HAB = SHA-256(SHA-256(HA + HB))
• To obtain the parent node HCD, the process is
repeated;
HCD = SHA-256(SHA-256(HC + HD))
• This concept can be used to construct Merkle trees
of all sizes.
• In Bitcoin, a block is mined after every 10 minutes,
meaning it will contain transactions in the past 10
minutes.
• This number ranges from hundreds to thousands
of transactions in a block depending on the
network activity.
• This number of transactions is combined to form a
single hash, the root of the tree.
• The beauty of hash functions is that any size or
length of transaction passed through the hashing
function results in a fixed-length string(32-byte).
• Now, to make sure that a transaction is in a
block, a node produces log2(N) 32-byte hashes
that constitute if an authentication/Merkle
path that connects the transaction to the root.
• In this case, the base-2 logarithm increases
much more steadily as the number of
transaction increase.
• This enables the efficient production of 10-path
to 12-path hashes that provide proof that a
transaction exists within the tree.
• A node can prove that transaction K is in the
block by producing a 32-byte hash long
Merkle/authentication path consisting of four
hashes(HL, HIJ, HMNOP, and HABCDEFGH).
• With this path, any node can verify that a
transaction(HK) exists in a block by computing
four pair-wise hashes, HKL, HIJKL, HIJKLMNOP +
root.
• Note that, as the number of blocks and
transactions increases, the Merkle tree only gets
better and more efficient.
• The following image summarizes its efficiency;
• Merkle trees in Bitcoin allow nodes to just download
block headers and be able to know if a transaction
has been included in the block instead of storing the
whole copy of the blockchain.
• This is applicable in mobile wallets where there is
not enough space to store the full blockchain.
• In this case, the app will retrieve a small Merkle path
from a full node without the need to store or
transmit it.
•
These nodes are referred to as simplified payment
verification nodes.
• They use Merkle paths without having to download
and store the full blockchain copy.
Merkle Trees and SPVs.
• As mentioned SPV nodes don't store the full blockchain copy and therefore
don't have all transactions.
• They only download block headers.
• To verify a transaction is included in a block, they use
an authentication/Merkle path.
• For example, we have an SPV node that verifies payments to a wallet
address. It will establish a bloom filter on its peers.
• This filters the number of transactions that are received and results in only
those containing the wallet address.
•
When a transaction matches the filter, the node sends the block using
the merkleblock message.
• This message contains the block header and the merkle path linking the
transaction in question.
The node uses the path to connect the transaction to the block and verify its
inclusion in the block.
The block header is also used t link the block to the rest of the chain.
• These two links(transaction-block, block-blockchain) when combined are all
that is needed to prove a transaction is included in the blockchain.
PPT FOR EXPLAINING MERKLE tree and SPV.pptx
PPT FOR EXPLAINING MERKLE tree and SPV.pptx
PPT FOR EXPLAINING MERKLE tree and SPV.pptx
PPT FOR EXPLAINING MERKLE tree and SPV.pptx
PPT FOR EXPLAINING MERKLE tree and SPV.pptx
PPT FOR EXPLAINING MERKLE tree and SPV.pptx
PPT FOR EXPLAINING MERKLE tree and SPV.pptx

More Related Content

Similar to PPT FOR EXPLAINING MERKLE tree and SPV.pptx

Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)
Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)
Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)IT Arena
 
Blockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchainsBlockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchainsBrett Colbert
 
Blockchain Ecosystem and Cryptocurrency Regulations
Blockchain Ecosystem and Cryptocurrency RegulationsBlockchain Ecosystem and Cryptocurrency Regulations
Blockchain Ecosystem and Cryptocurrency RegulationsAmir Rafati
 
Blockchain Session 1
Blockchain Session 1Blockchain Session 1
Blockchain Session 1DSCPICT
 
Blockchain Technology
Blockchain TechnologyBlockchain Technology
Blockchain TechnologyRashi Singh
 
The Secret behind the Blockchain Technology
The Secret behind the Blockchain TechnologyThe Secret behind the Blockchain Technology
The Secret behind the Blockchain TechnologyPECB
 
Blockchain Technology
Blockchain TechnologyBlockchain Technology
Blockchain TechnologyShubhAm RaWat
 
Blockchain, working [blockchain vs bitcoin] pros and cons
Blockchain, working [blockchain vs bitcoin] pros and consBlockchain, working [blockchain vs bitcoin] pros and cons
Blockchain, working [blockchain vs bitcoin] pros and consJerin Sebastian
 
Node.js Blockchain Implementation
Node.js Blockchain ImplementationNode.js Blockchain Implementation
Node.js Blockchain ImplementationGlobalLogic Ukraine
 
Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014WeKCo Coworking
 
What to expect from Blockchain in 2019?
What to expect from Blockchain in 2019?What to expect from Blockchain in 2019?
What to expect from Blockchain in 2019?PECB
 
Blockchain Technologies for Data Science
Blockchain Technologies for Data ScienceBlockchain Technologies for Data Science
Blockchain Technologies for Data ScienceBruno Gonçalves
 
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)Nicholas Lin
 

Similar to PPT FOR EXPLAINING MERKLE tree and SPV.pptx (20)

Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)
Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)
Cryptocurrencies for Everyone (Dmytro Pershyn Technology Stream)
 
Blockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchainsBlockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchains
 
Blockchain Ecosystem and Cryptocurrency Regulations
Blockchain Ecosystem and Cryptocurrency RegulationsBlockchain Ecosystem and Cryptocurrency Regulations
Blockchain Ecosystem and Cryptocurrency Regulations
 
Blockchain Session 1
Blockchain Session 1Blockchain Session 1
Blockchain Session 1
 
Blockchain
BlockchainBlockchain
Blockchain
 
Blockchain Technology
Blockchain TechnologyBlockchain Technology
Blockchain Technology
 
Block chain
Block chainBlock chain
Block chain
 
bitcoin_presentation
bitcoin_presentationbitcoin_presentation
bitcoin_presentation
 
Blockchain and bitcoin
Blockchain and bitcoinBlockchain and bitcoin
Blockchain and bitcoin
 
The Secret behind the Blockchain Technology
The Secret behind the Blockchain TechnologyThe Secret behind the Blockchain Technology
The Secret behind the Blockchain Technology
 
Blockchain Technology
Blockchain TechnologyBlockchain Technology
Blockchain Technology
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Blockchain, working [blockchain vs bitcoin] pros and cons
Blockchain, working [blockchain vs bitcoin] pros and consBlockchain, working [blockchain vs bitcoin] pros and cons
Blockchain, working [blockchain vs bitcoin] pros and cons
 
Node.js Blockchain Implementation
Node.js Blockchain ImplementationNode.js Blockchain Implementation
Node.js Blockchain Implementation
 
Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014Blockchain - Presentacion Betabeers Galicia 10/12/2014
Blockchain - Presentacion Betabeers Galicia 10/12/2014
 
What to expect from Blockchain in 2019?
What to expect from Blockchain in 2019?What to expect from Blockchain in 2019?
What to expect from Blockchain in 2019?
 
Ethereum.pptx
Ethereum.pptxEthereum.pptx
Ethereum.pptx
 
Blockchain Technologies for Data Science
Blockchain Technologies for Data ScienceBlockchain Technologies for Data Science
Blockchain Technologies for Data Science
 
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
以比特幣為例的區塊鏈技術介紹 ( Intro to Blockchain using Bitcoin as an example)
 
Basics of Block Chain
Basics of Block ChainBasics of Block Chain
Basics of Block Chain
 

More from meena466141

different consensus protocols in blockchian.pptx
different consensus protocols in blockchian.pptxdifferent consensus protocols in blockchian.pptx
different consensus protocols in blockchian.pptxmeena466141
 
Fundametals of Blockchain and basics_L1.pptx
Fundametals of Blockchain and basics_L1.pptxFundametals of Blockchain and basics_L1.pptx
Fundametals of Blockchain and basics_L1.pptxmeena466141
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxmeena466141
 
Lect6 life cycle phases
Lect6 life cycle phasesLect6 life cycle phases
Lect6 life cycle phasesmeena466141
 
Lect5 improving software economics
Lect5 improving software economicsLect5 improving software economics
Lect5 improving software economicsmeena466141
 
Lect4 software economics
Lect4 software economicsLect4 software economics
Lect4 software economicsmeena466141
 
Lect3 conventional vs modern spm
Lect3 conventional vs modern spmLect3 conventional vs modern spm
Lect3 conventional vs modern spmmeena466141
 
Lect2 conventional software management
Lect2 conventional software managementLect2 conventional software management
Lect2 conventional software managementmeena466141
 
Lect1 intro to software project management
Lect1 intro to software project managementLect1 intro to software project management
Lect1 intro to software project managementmeena466141
 

More from meena466141 (9)

different consensus protocols in blockchian.pptx
different consensus protocols in blockchian.pptxdifferent consensus protocols in blockchian.pptx
different consensus protocols in blockchian.pptx
 
Fundametals of Blockchain and basics_L1.pptx
Fundametals of Blockchain and basics_L1.pptxFundametals of Blockchain and basics_L1.pptx
Fundametals of Blockchain and basics_L1.pptx
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
 
Lect6 life cycle phases
Lect6 life cycle phasesLect6 life cycle phases
Lect6 life cycle phases
 
Lect5 improving software economics
Lect5 improving software economicsLect5 improving software economics
Lect5 improving software economics
 
Lect4 software economics
Lect4 software economicsLect4 software economics
Lect4 software economics
 
Lect3 conventional vs modern spm
Lect3 conventional vs modern spmLect3 conventional vs modern spm
Lect3 conventional vs modern spm
 
Lect2 conventional software management
Lect2 conventional software managementLect2 conventional software management
Lect2 conventional software management
 
Lect1 intro to software project management
Lect1 intro to software project managementLect1 intro to software project management
Lect1 intro to software project management
 

Recently uploaded

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 

PPT FOR EXPLAINING MERKLE tree and SPV.pptx

  • 1. • Blockchain, definition, application, benefits • All the imp terms • Basics of cryptography--- • Block, definition, header body • Mining process, consensus,
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. Merkle tree • In blockchains, a Merkle tree is a data structure used to encode blockchain data efficiently and securely. • Transactions are passed through a hashing function to produce a transaction hash. • A block stores all transactions in the blockchain. • These transactions in a block after being hashed pairs of transactions are concatenated together to form a single hash. • This process continues until there is a single hash for the whole block of transactions. • In the case there are an odd number of transactions, one will be double hashed and its hash is concatenated with itself. • A Merkle tree / binary hash tree is used to summarize and verify the integrity of these transactions. • These trees hold cryptographic hashes at their nodes and the tree is usually displayed up-side-down whereby the root is at the top and the leaves at the bottom.
  • 17. Merkle Trees in Bitcoin. • In Bitcoin, merkle trees are used to summarize all transactions in a block to produce an overall digital fingerprint of all transactions in the block. • This process produces a hash such that if a transaction in the block is mutated or removed, it would result in a totally different hash rendering the block invalid. • The resulting hash is referred to as the Merkle root and the hashing algorithm used is SHA-256.
  • 18. • consider the case where we have four transactions, A, B, C, and S. • An even number of transactions. In this case, we will have four leaves HA, HB, HC, and HD where; HA = SHA-256(SHA-256(Transaction A)) • To obtain the parent node HAB, we concatenate the two hashes HA and HB to obtain a 64-byte string(32- byte each). • We then double hash the string to obtain the parent; HAB = SHA-256(SHA-256(HA + HB)) • To obtain the parent node HCD, the process is repeated; HCD = SHA-256(SHA-256(HC + HD))
  • 19.
  • 20.
  • 21. • This concept can be used to construct Merkle trees of all sizes. • In Bitcoin, a block is mined after every 10 minutes, meaning it will contain transactions in the past 10 minutes. • This number ranges from hundreds to thousands of transactions in a block depending on the network activity. • This number of transactions is combined to form a single hash, the root of the tree. • The beauty of hash functions is that any size or length of transaction passed through the hashing function results in a fixed-length string(32-byte).
  • 22. • Now, to make sure that a transaction is in a block, a node produces log2(N) 32-byte hashes that constitute if an authentication/Merkle path that connects the transaction to the root. • In this case, the base-2 logarithm increases much more steadily as the number of transaction increase. • This enables the efficient production of 10-path to 12-path hashes that provide proof that a transaction exists within the tree.
  • 23.
  • 24. • A node can prove that transaction K is in the block by producing a 32-byte hash long Merkle/authentication path consisting of four hashes(HL, HIJ, HMNOP, and HABCDEFGH). • With this path, any node can verify that a transaction(HK) exists in a block by computing four pair-wise hashes, HKL, HIJKL, HIJKLMNOP + root. • Note that, as the number of blocks and transactions increases, the Merkle tree only gets better and more efficient. • The following image summarizes its efficiency;
  • 25.
  • 26. • Merkle trees in Bitcoin allow nodes to just download block headers and be able to know if a transaction has been included in the block instead of storing the whole copy of the blockchain. • This is applicable in mobile wallets where there is not enough space to store the full blockchain. • In this case, the app will retrieve a small Merkle path from a full node without the need to store or transmit it. • These nodes are referred to as simplified payment verification nodes. • They use Merkle paths without having to download and store the full blockchain copy.
  • 27.
  • 28.
  • 29.
  • 30. Merkle Trees and SPVs. • As mentioned SPV nodes don't store the full blockchain copy and therefore don't have all transactions. • They only download block headers. • To verify a transaction is included in a block, they use an authentication/Merkle path. • For example, we have an SPV node that verifies payments to a wallet address. It will establish a bloom filter on its peers. • This filters the number of transactions that are received and results in only those containing the wallet address. • When a transaction matches the filter, the node sends the block using the merkleblock message. • This message contains the block header and the merkle path linking the transaction in question. The node uses the path to connect the transaction to the block and verify its inclusion in the block. The block header is also used t link the block to the rest of the chain. • These two links(transaction-block, block-blockchain) when combined are all that is needed to prove a transaction is included in the blockchain.