Bitcoin Forum
April 28, 2024, 02:42:14 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Additional details and explanations regarding merkle trees  (Read 324 times)
Egii Nna (OP)
Full Member
***
Offline Offline

Activity: 280
Merit: 159



View Profile
October 06, 2023, 07:54:36 AM
Merited by o_e_l_e_o (4), BlackHatCoiner (4), SOKO-DEKE (3), knowngunman (2), iBaba (2), Abbatty (2), vapourminer (1), DdmrDdmr (1), AYOBA (1), ParaBoi (1)
 #1

For my research, I was looking into merkle trees today. This research taught me many things, but I also learned about merkle trees and how they relate to bitcoin. Since we have direct access to the database, I'm not sure why Merkle trees which are used to verify the data's integrity are necessary. Could someone please explain the real implementation of Merkle trees on the Bitcoin blockchain? Why are we unable to simply perform a database query to obtain the transaction data?
I need assistance with it in order to learn a lot and comprehend more clearly.

1714315334
Hero Member
*
Offline Offline

Posts: 1714315334

View Profile Personal Message (Offline)

Ignore
1714315334
Reply with quote  #2

1714315334
Report to moderator
1714315334
Hero Member
*
Offline Offline

Posts: 1714315334

View Profile Personal Message (Offline)

Ignore
1714315334
Reply with quote  #2

1714315334
Report to moderator
1714315334
Hero Member
*
Offline Offline

Posts: 1714315334

View Profile Personal Message (Offline)

Ignore
1714315334
Reply with quote  #2

1714315334
Report to moderator
Make sure you back up your wallet regularly! Unlike a bank account, nobody can help you if you lose access to your BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714315334
Hero Member
*
Offline Offline

Posts: 1714315334

View Profile Personal Message (Offline)

Ignore
1714315334
Reply with quote  #2

1714315334
Report to moderator
1714315334
Hero Member
*
Offline Offline

Posts: 1714315334

View Profile Personal Message (Offline)

Ignore
1714315334
Reply with quote  #2

1714315334
Report to moderator
mocacinno
Legendary
*
Offline Offline

Activity: 3374
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
October 06, 2023, 07:57:56 AM
Merited by o_e_l_e_o (4), BlackHatCoiner (4), ABCbits (2), Pmalek (2), vapourminer (1), DdmrDdmr (1)
 #2

one of the application of a merkle tree is the block header: you need to able to prove the transaction data inside a block didn't change just by looking at the block header... It's impossible to add all transaction hashes to the header, so we use a merkle tree.

This way, when a miner finds a block header whose sha256d hash is under the current target, the block can no longer be changed, since changing any transaction in the block will change the merkle tree and invalidate the block

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Amphenomenon
Sr. Member
****
Offline Offline

Activity: 504
Merit: 326


Hope Jeremiah 17vs7


View Profile WWW
October 06, 2023, 10:04:34 AM
Merited by BlackHatCoiner (2), Ambatman (2), vapourminer (1), DdmrDdmr (1), albert0bsd (1), Hatchy (1)
 #3

In addition to what @mocacinno has stated, here is a post about this : Merkle Trees and Merkle Roots for dummies

freebitcoin       ▄▄▄█▀▀██▄▄▄
   ▄▄██████▄▄█  █▀▀█▄▄
  ███  █▀▀███████▄▄██▀
   ▀▀▀██▄▄█  ████▀▀  ▄██
▄███▄▄  ▀▀▀▀▀▀▀  ▄▄██████
██▀▀█████▄     ▄██▀█ ▀▀██
██▄▄███▀▀██   ███▀ ▄▄  ▀█
███████▄▄███ ███▄▄ ▀▀▄  █
██▀▀████████ █████  █▀▄██
 █▄▄████████ █████   ███
  ▀████  ███ ████▄▄███▀
     ▀▀████   ████▀▀
BITCOIN
DICE
EVENT
BETTING
WIN A LAMBO !

.
            ▄▄▄▄▄▄▄▄▄▄███████████▄▄▄▄▄
▄▄▄▄▄██████████████████████████████████▄▄▄▄
▀██████████████████████████████████████████████▄▄▄
▄▄████▄█████▄████████████████████████████▄█████▄████▄▄
▀████████▀▀▀████████████████████████████████▀▀▀██████████▄
  ▀▀▀████▄▄▄███████████████████████████████▄▄▄██████████
       ▀█████▀  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  ▀█████▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
▄█████
██
██
██
██
██
██
██
██
██
██
██
▀█████
.
PLAY NOW
█████▄
██
██
██
██
██
██
██
██
██
██
██
█████▀
ABCbits
Legendary
*
Offline Offline

Activity: 2856
Merit: 7409


Crypto Swap Exchange


View Profile
October 06, 2023, 10:32:04 AM
Last edit: October 07, 2023, 09:01:39 AM by ETFbitcoin
Merited by o_e_l_e_o (4), BlackHatCoiner (4), Pmalek (2), Husna QA (2), vapourminer (1), mocacinno (1), DdmrDdmr (1)
 #4

Related with block header, it's also used by SPV wallet to verify whether a transaction iis in a block. Here's an illustration


Source: https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch09.asciidoc

That way, SPV wallet doesn't have to download whole block to perform verification which improve time to sync the wallet.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
witcher_sense
Legendary
*
Offline Offline

Activity: 2310
Merit: 4313

🔐BitcoinMessage.Tools🔑


View Profile WWW
October 06, 2023, 06:23:05 PM
 #5

For my research, I was looking into merkle trees today. This research taught me many things, but I also learned about merkle trees and how they relate to bitcoin. Since we have direct access to the database, I'm not sure why Merkle trees which are used to verify the data's integrity are necessary. Could someone please explain the real implementation of Merkle trees on the Bitcoin blockchain? Why are we unable to simply perform a database query to obtain the transaction data?
I need assistance with it in order to learn a lot and comprehend more clearly.
https://learnmeabitcoin.com/technical/merkle-root is one of the most valuable resources you should consult each time you struggle to understand something regarding Bitcoin's inner processes. Also, a Merkle tree is not an alternative to relational and No-SQL databases, it is just a very efficient data structure that makes it very easy to search for information and verify its integrity, it can be used by databases themselves to optimize different queries like insertions, searches, updates, etc.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Egii Nna (OP)
Full Member
***
Offline Offline

Activity: 280
Merit: 159



View Profile
October 06, 2023, 09:22:26 PM
 #6

Thank you so much, bosses. I appreciate what everyone has contributed, and I also want to take this opportunity to thank everyone for the time they took and the resources they shared with me to help me learn more about the Merkle Tree. I'm thrilled that you people gave me this information.

Alphakilo
Full Member
***
Offline Offline

Activity: 295
Merit: 132


Cashback 15%


View Profile
October 07, 2023, 03:20:58 AM
Merited by vapourminer (2), Pmalek (2), Cookdata (2), Franctoshi (1)
 #7

In addition to the resources already supplied, I came across an MIT course titled "Blockchain Basics & Cryptography" that delves into the fundamentals of block headers and Merkle trees. I've included them in two different formats below:

Video format of lecture - Blockchain Basics & Cryptography
Text format of the lecture - Blockchain Basics & Cryptography




AYOBA
Full Member
***
Online Online

Activity: 252
Merit: 140



View Profile
October 11, 2023, 04:18:31 PM
 #8

For my research, I was looking into merkle trees today. This research taught me many things, but I also learned about merkle trees and how they relate to bitcoin. Since we have direct access to the database, I'm not sure why Merkle trees which are used to verify the data's integrity are necessary. Could someone please explain the real implementation of Merkle trees on the Bitcoin blockchain? Why are we unable to simply perform a database query to obtain the transaction data?
I need assistance with it in order to learn a lot and comprehend more clearly.

In my understanding Merkel tree is know as data structure which is commonly used in computer science, which is also associates with Blockchain technology data, and is more exclusive and securely in Bitcoin and others cryptocurrencies, and it's also be best in terms of represent  and distribute the list of transaction because it perform data verification fastly with out any issues.

But if I may ask why is Merkel trees essential to the block?

witcher_sense
Legendary
*
Offline Offline

Activity: 2310
Merit: 4313

🔐BitcoinMessage.Tools🔑


View Profile WWW
October 11, 2023, 04:55:11 PM
Merited by Pmalek (2)
 #9

But if I may ask why is Merkel trees essential to the block?
In a decentralized, trustless network like Bitcoin, participants need to be able to quickly check the authenticity of the data they receive, and one of the best ways to ensure data has not been altered is to use different cryptographic proofs. In the case of a Bitcoin block, for example, we need to verify the integrity and presence of particular transactions because this information takes up most of Bitcoin's block space and, most importantly, it carries financial significance. We could use other data structures like hash chains to verify the said integrity and authenticity, but Merkle Tree happens to be one of the most efficient for this purpose.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
ymgve2
Full Member
***
Offline Offline

Activity: 161
Merit: 230


View Profile
October 11, 2023, 06:21:22 PM
 #10

Note that Merkle trees are not actually strictly required for a Bitcoin like coin to function - you can just as well do a full single hash of all the concatenated transactions in a block and place that in the header. The disadvantage is that the proof required to prove if a transaction got included is the full block itself.
AYOBA
Full Member
***
Online Online

Activity: 252
Merit: 140



View Profile
October 11, 2023, 09:10:26 PM
 #11

But if I may ask why is Merkel trees essential to the block?
In a decentralized, trustless network like Bitcoin, participants need to be able to quickly check the authenticity of the data they receive, and one of the best ways to ensure data has not been altered is to use different cryptographic proofs. In the case of a Bitcoin block, for example, we need to verify the integrity and presence of particular transactions because this information takes up most of Bitcoin's block space and, most importantly, it carries financial significance. We could use other data structures like hash chains to verify the said integrity and authenticity, but Merkle Tree happens to be one of the most efficient for this purpose.

Thank you very much I sincerely appreciated. Before I was completely perplexed, but with your explanation, I have learned a lot from you. it's good for someone to bring out what they don't understand so that others can offer assistance.

so98nn
Hero Member
*****
Offline Offline

Activity: 2086
Merit: 603


View Profile
October 16, 2023, 12:47:59 PM
 #12

Sincerely it is deeper when you keep reading about the tech behind blockchain and how it works. I have tried to create a topic regarding blockchain and how it works in the beginner's section when I realized I needed more and more learning each time I created a new topic. It's still pending work right now but such discussion is always encouraging to me and definitely to those who need such info.

The way everyone is explaining it here is like legend-level. I got more hundred questions after reading all of them. Lolz.

one of the application of a merkle tree is the block header: you need to able to prove the transaction data inside a block didn't change just by looking at the block header... It's impossible to add all transaction hashes to the header, so we use a merkle tree.

This way, when a miner finds a block header whose sha256d hash is under the current target, the block can no longer be changed, since changing any transaction in the block will change the merkle tree and invalidate the block

After reading this, I wanted to understand how a block can be changed or edited if this process is entirely irreversible. Merkle tree as I am guessing is also a chain of blocks containing the info and it keeps growing as the new data is received. What makes it different from the block and its header?  So those are different components on the chain.
mocacinno
Legendary
*
Offline Offline

Activity: 3374
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
October 16, 2023, 01:55:05 PM
Merited by vapourminer (1)
 #13

--snip--
one of the application of a merkle tree is the block header: you need to able to prove the transaction data inside a block didn't change just by looking at the block header... It's impossible to add all transaction hashes to the header, so we use a merkle tree.

This way, when a miner finds a block header whose sha256d hash is under the current target, the block can no longer be changed, since changing any transaction in the block will change the merkle tree and invalidate the block

After reading this, I wanted to understand how a block can be changed or edited if this process is entirely irreversible. Merkle tree as I am guessing is also a chain of blocks containing the info and it keeps growing as the new data is received. What makes it different from the block and its header?  So those are different components on the chain.

I'll try to simplify things a bit, but the nature of these things is rather complex, so it'll still require some effort to grasp the simplified explanation.

Let's assume the current blockchain height is 812460. This means, 812459 blocks have been found on top of the first block.
Block 812460 has a block header.

When i'm a miner trying add a block to the blockchain, i'm trying to find the block with height 812461.
In order to do so, i have to find a block header that, when hashed using the sha256 hash function twice, results in a hash that's under the current target.

I create a block header by taking the hash of the previous block's header (812460), the merkle root of 1 Mb of transactions from my mempool (excluding the witness data) and a nonce (next to some other data like the Version, Bits and Time, which i'm going to discard to simplify things a bit). I do a sha256d of this block header, and if my result is OVER the current target, i iterate the nonce and retry (untill i find a nonce for which my current hash is under the target... Offcourse the odds of finding such a header by myself is really small).

The merkle root in the block header i'm creating is built by building a merkle tree out of each of the transactions in the block. If i change anything about one of these transactions (even their order) the merkle root changes. This means that once i find a valid block header, both the previous block and all of the transactions in my current block become immutable. If i would change a transaction in a previous block, the merkle tree of the previous block would change, the block header would change and the odds of the new block header's sha256d still being under the target is really, really, really small... It also means my current block can no longer change (same logic about the merkle tree + the hash of the previous block header is also a part of the current block header).
The end result is an immutable blockchain..

If i ever wanted to change the history by removing a transaction from (for example) block 812360, it's merkle tree would change and i would need to find a completely new nonce that would make the sha256d hash of this header under the current target, and then i would need to re-mine block 812361, 812362,... And i would need to catch up (and exceed) the current tip because otherwise the rest of the network would just reject my alternative chain... In reality, this would cost billions in hardware and power, and it's just not possible economically... That's what makes our blockchain secure Smiley.
The network is programmed to, when faced with 2 alternative chains, pick the one with the most cumulative work... So if i wanted to change history, i'd have to exceed all the work in the current main chain.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
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!