Bitcoin Forum
May 09, 2024, 01:51:25 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is the purpose of the Merkle Root in a Bitcoin block?  (Read 227 times)
Picard78 (OP)
Member
**
Offline Offline

Activity: 68
Merit: 23


View Profile
July 30, 2020, 04:37:27 AM
 #1

Hello Bitcoin Expert,

I understand how Merkle trees are created and how they are used to quickly verify a transaction in a block but I don’t understand how or why they are used.

A google search presents the following:

Quote
Merkle trees enable SPV nodes on the blockchain to check if miners have verified the transactions in a block without downloading all the transactions in a block.

What I don’t understand is that once a Transaction is in a confirmed Block why does it have to be verified?  Once it is in a confirmed Block the transaction is verified and immutable. 

I watched this video by Andreas https://www.youtube.com/watch?v=OdjEhNdvTNM and he mentions Side Chains but I still don't understand why we need to confirm a transaction has been verified in a confirmed block.

Thank you.
1715219485
Hero Member
*
Offline Offline

Posts: 1715219485

View Profile Personal Message (Offline)

Ignore
1715219485
Reply with quote  #2

1715219485
Report to moderator
Bitcoin addresses contain a checksum, so it is very unlikely that mistyping an address will cause you to lose money.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715219485
Hero Member
*
Offline Offline

Posts: 1715219485

View Profile Personal Message (Offline)

Ignore
1715219485
Reply with quote  #2

1715219485
Report to moderator
1715219485
Hero Member
*
Offline Offline

Posts: 1715219485

View Profile Personal Message (Offline)

Ignore
1715219485
Reply with quote  #2

1715219485
Report to moderator
1715219485
Hero Member
*
Offline Offline

Posts: 1715219485

View Profile Personal Message (Offline)

Ignore
1715219485
Reply with quote  #2

1715219485
Report to moderator
ranochigo
Legendary
*
Online Online

Activity: 2968
Merit: 4170



View Profile
July 30, 2020, 04:40:39 AM
Merited by Coding Enthusiast (2)
 #2

SPV wallets do not download the entire block. They only download the block headers.

The block header contains the merkle root among other stuff. By downloading the block headers only, the SPV wallet saves a lot of bandwidth and space. With the block header, the SPV node can verify if the block has sufficient target and can also use the merkle root to verify if a transaction has indeed been included in that specific block.

Even if it isn't about SPV nodes, by constructing the merkle root, you're basically telling everyone all the transactions that has been included in the block. Only the block header is hashed, the individual transactions aren't. Merkle root is the way to include transactions in your block. Read up on how the bitcoin block is constructed to get a more in depth understanding.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5591


Self-proclaimed Genius


View Profile
July 30, 2020, 06:41:48 AM
 #3

I suggest you to read about "merkle path" in page 167-168 of Andreas M. Antonopoulos's Mastering Bitcoin.
You'll understand how SPV nodes can efficiently verify its transactions using the merkle root which is in the blockheader.

Here's the wiki page with links: https://en.bitcoin.it/wiki/Mastering_Bitcoin

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Husires
Legendary
*
Offline Offline

Activity: 1596
Merit: 1285



View Profile WWW
July 30, 2020, 03:17:58 PM
Merited by ABCbits (1)
 #4

The Merklre Tree greatly interferes with this process since its hashes are compressed from roots to the top.  
Even changing one value for a transaction at the base of the tree, change to all the hash values, up to the root's hash value.
Thus a single value prove all the transactions under it and not need to hash the full list of transactions.


source:
https://github.com/bitcoinbook/bitcoinbook/blob/14a25a6fd9e97002c57a46f1fe9faf48cd5d6e46/ch07.asciidoc#merkle-trees

.BEST..CHANGE.███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
Picard78 (OP)
Member
**
Offline Offline

Activity: 68
Merit: 23


View Profile
July 31, 2020, 04:00:38 AM
 #5

Quote
Even if it isn't about SPV nodes, by constructing the merkle root, you're basically telling everyone all the transactions that has been included in the block. Only the block header is hashed, the individual transactions aren't.


I see only the Block Header is hashed, so the Merkle Root confirms the data integrity of the Transactions Data.

My next question is why are the Transactions not included in the Block Header Hash as well. 

A decent answer is here https://bitcoin.stackexchange.com/questions/60676/why-is-only-the-block-header-sha256-hashed-and-not-the-whole-block

Quote
it makes the speed of mining independent from the number of transactions.
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5591


Self-proclaimed Genius


View Profile
July 31, 2020, 05:08:55 AM
 #6

Quote
Even if it isn't about SPV nodes, by constructing the merkle root, you're basically telling everyone all the transactions that has been included in the block. Only the block header is hashed, the individual transactions aren't.
My next question is why are the Transactions not included in the Block Header Hash as well.  
Since you're talking about "Block Header Hash", it's about mining, then that quote from the "decent answer" is the answer.

In case you've missed this info from that link and from this thread as well:
the merkle root is part of the Block header and if you hash the block header, you indirectly hashed all the transactions in that block because the merkle root is the root hash of all the txs in the block.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Picard78 (OP)
Member
**
Offline Offline

Activity: 68
Merit: 23


View Profile
July 31, 2020, 05:54:34 AM
 #7

Quote
In case you've missed this info from that link and from this thread as well:
the merkle root is part of the Block header and if you hash the block header, you indirectly hashed all the transactions in that block because the merkle root is the root hash of all the txs in the block.


That's true.  Thanks for that further point.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!