Questions tagged [merkle-tree]

A hash-tree used to allow efficient and secure verification of contents of large data structures. Merkle-Trees are employed in Bitcoin to prove existence of transactions in a block.

Filter by
Sorted by
Tagged with
0 votes
1 answer
23 views

How do Bitcoin miners/nodes access previous transactions?

I started reading about how bitcoin transactions are processed and I came across the Merkle Tree. I learned that one of its purposes is to prevent nodes from storing the entire bitcoin transaction ...
user avatar
1 vote
1 answer
53 views

The true reason bitcoin needs merkle proof for SPV wallet?

I know exactly what merkle tree is, and I know it is used to verify a transaction is in a block with just a hundred of bytes flowing through my network cable (btw do I really lack that megabytes ...
user avatar
  • 151
1 vote
0 answers
43 views

Understanding bitcoin merkle tree construction at code level

I have a high level understanding of how merkle trees are constructed for a Bitcoin block, but I am interested in building a little CLI tool in golang that actually takes a list of transactions for a ...
user avatar
0 votes
0 answers
14 views

How is SPV feasible without the entire Merkle Tree? [duplicate]

One of the primary arguments in favor of using Merkle Trees as the mechanism of encoding transactions is the value it provides in Partial Verifications or Simplified Payment Verification. The argument ...
user avatar
  • 65
0 votes
1 answer
25 views

Is merkle hash tree also at network level?

From my understanding of the Bitcoin network, Merkle Hash Tree is used on a block level, where each transaction is a leaf of the tree (except the situation that if transaction count is odd, the last ...
user avatar
0 votes
1 answer
45 views

What are the detailed rules for Merkle tree generation? Specifically the order of the leaf nodes

As far as I know, the first one is the coinbase transaction
user avatar
1 vote
1 answer
61 views

What guarantees the validity of merkle root used in the merkle inclusion proof?

I understand Merkle roots can be used for Merkle inclusion proofs, where a client/validator can quickly check if a transaction is part of the block without requesting all the transactions in the block....
user avatar
0 votes
2 answers
112 views

MerkleRoot requires transaction hash to build a merkle tree.... Is that the "hash" key/value within the getblocktemplate response or the "data"?

I've created a function for parsing Json Objects and values and just when I think nothing can stop me, just when I feel like I'm the king of the blockchain and I can finally join in on the mining race ...
user avatar
0 votes
1 answer
54 views

Merkle tree recalculation during transaction lookup

When full-node receives a request from SPV client to check if given transaction exists in the blockchain - does it always re-calculate the merkle tree on the fly in order to return merkle path + block ...
user avatar
0 votes
0 answers
83 views

Ternary Merkle Tree - concatenation and Merkle Proof?

Unlike binary Merkle trees, ternary have 3 leaf nodes. I wanted to understand how do we eventually get to the Root Merkle node -- is it by concatenating in the pair of 3 (considering 3 leaves in every ...
user avatar
1 vote
1 answer
70 views

How can a block validate a merkle-root if it is all hashed?

I am trying to understand how another block validates the transactions through the merkle root. Shouldn't it be impossible to know what hashes the merkle root is hashed from because you can't reverse ...
user avatar
1 vote
1 answer
100 views

Why store Merkle tree of transactions rather than global ledger state?

I'm implementing my own Cryptocurrency similar to Bitcoin from scratch in C++ (just for learning and deeper understanding) and had an interesting design question. My understanding is that the Merkle ...
user avatar
0 votes
1 answer
52 views

Can taproot script trees have nodes with a single child?

I am writing some code implementing taproot address creation where a script path is present and I have a quick question surrounding the reference code. The BIP-341 reference method taproot_tree_helper(...
user avatar
  • 55
2 votes
1 answer
158 views

Merkle root of empty block

Based on https://en.bitcoin.it/wiki/Getblocktemplate : Collect your coinbase transaction (modified or not) at the front of the "transactions" list provided by the server. Apply a double-...
user avatar
0 votes
1 answer
119 views

Questions on Merkle root hashing for Stratum pools

These questions are partially inspired from this post on Merkle root hashing by pool operators. My understanding is that for Stratum mining the only hashing the pool has to do is produce the Merkle ...
user avatar
  • 3
2 votes
1 answer
94 views

What hardware do pool operators use for calculating the hashmerkleroot?

I've reviewed the response here: How do pool operators do their hashing? and acknowledge that the ratio of hashing required by pool operators is incomparable to the miners. I still wonder what ...
user avatar
0 votes
1 answer
45 views

For a block containing 'x' number of unverified transactions, how many SHA256d hashes are performed to obtain the hashmerkleroot?

I've been trying to understand this for a few days now. I understand that the hashmerkleroot is the root node of a fully perfect binary tree. I also understand that the sha256d hashes would be the non-...
user avatar
0 votes
0 answers
184 views

Bitcoin Merkle/Hash Tree implementation in Java

I'm learning about how full nodes can send a Merkle root + a list of hashes, so that a light client can verify a transaction. I couldn't find any good resources on how to implement it. I just knew ...
user avatar
0 votes
2 answers
128 views

Merkle tree hash - Computing hash manually doesnt match the one computed by SHA256D64

I am trying to go through the code to check the merkle tree hash computation done by BlockMerkleRoot in bitcoin core. The hash computed using online tools by appending transaction hashes is different ...
user avatar
0 votes
2 answers
191 views

Proof-of-inclusion: Merkle Tress, derivation paths

My assumption is that when transaction proof of inclusion occurs, it takes place only at full nodes, since this may happen when a block is mined (as a node has to evict transactions from its mempool ...
user avatar
0 votes
1 answer
46 views

Appending txns to merkle tree on PoW efficiency, true hash rate

As I understand, when miners add transactions to their candidate block from their mempool, they append the txn to the merkle tree, which requires more hashing, as well as the hashing/maths involved ...
user avatar
1 vote
1 answer
237 views

How are txns sorted correctly in Merkle trees between nodes and validated via Proof of Work

I am interested in exactly what happens to transactions in the pending block (block that is being mined at the time). From what I understand, transactions are the stored as a Merkle tree hash inside ...
user avatar
1 vote
1 answer
35 views

Is the hash of ZMQ channel blockhash a merkleroot hash?

I am using the ZMQ interface of my node to keep track of wallet activity like incoming transactions. I want to know the number of confirmations of my transaction but, to do that, I would need to know ...
user avatar
1 vote
1 answer
32 views

What exactly happens to leaves when forming nodes?

If you hash TXIDs with sha256 twice, you get the leaves of the merkle tree. As far as I understand the two outputs of the TXIDs are concatenated / paired. What does that mean? Are they added together?
user avatar
1 vote
1 answer
96 views

Does the Merkle Root get constantly updated inside the block or does it only get added once the block is completed?

So, pretty much just the title. I'm just wondering how the Merkle Root works exactly. I know it's the result of pairing transactions and then hashing them until the last transaction in the block, but ...
user avatar
  • 69
1 vote
0 answers
146 views

Endianess of txids when calculating Merkle Root from getblocktemplate

I am trying to solve a merkle root from a previously mined block. Specifically this block... https://www.blockchain.com/en/btc/block/000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506 ...
user avatar
  • 13
0 votes
0 answers
40 views

How Can i Extract a Z value of a specific Bitcoin Transaction that Belongs to a merkel tree/root transaction?

am trying to find a z value of a transaction that is signed in a merkle tree/root block , i coudn't find a raw tx id in hex of that specific transaction that signed with specific address while a raw ...
user avatar
  • 1
8 votes
1 answer
1k views

Adding instead of concatenating hashes in Merkle trees

Why aren't the hashes combined using a commutative operation such as addition instead of concatenating them? Any possible vulnerabilities or security flaws? thanks for your time and efforts.
user avatar
  • 127
1 vote
1 answer
168 views

Are hashes of Merkle tree roots unique throughout whole blockchain?

The "Mastering Bitcoin" book says that each block header contains a 32B long hash of the Merkle root for all the transactions it contains. If I extract all these Merkle roots from all the ...
user avatar
  • 139
1 vote
1 answer
140 views

Why binary trees? Is there any particular benefit to using binary trees instead of some higher radix?

Bitcoin stores transactions in binary Merkle trees. They take O(log2 n) to traverse. If I used something like a ternary tree, where each node (including the root) references three branches/leaves ...
user avatar
1 vote
1 answer
37 views

Question about Merkle path verification

I think I understand Merkle verification, but I just want to make sure. Consider this following picture where all the blue nodes were sent to me My question : if the document that I want to verify is ...
user avatar
3 votes
1 answer
365 views

Do full nodes store the complete merkle tree or do they regenerate it when creating a merkle proof?

I understand what the merkle root is for. And I understand that blocks don't store the merkle tree. Question 1) Is there any place that the complete merkle trees get stored? I don't mean the merkle ...
user avatar
1 vote
1 answer
166 views

Is this Merkle hash root problem existent in Bitcoin?

In the Wikipedia article about Merkle trees, I was just reading this, unable to understand where the problem lies: Second preimage attack The Merkle hash root does not indicate the tree depth, ...
user avatar
  • 115
1 vote
3 answers
106 views

How/where is the mapping of a transaction to a particular block stored?

According to the Bitcoin white paper, a block contains the fields "Previous Hash", "Nonce", and "Root Hash". The root hash is a merkle tree root node of all the ...
user avatar
  • 23
2 votes
1 answer
205 views

How does a Merkle proof differ from the Merkle tree?

I'm not sure how Merkle tree and Merkle proof are different. I thought Merkle proof is the same as the Merkle root in each block. However, it seems like Merkle proof contains all Merkle roots of all ...
user avatar
7 votes
1 answer
286 views

How do merkle trees ensure credibility to blockchain, when full node wrongly denies a presence of a txn in a block?

How can Merkle Trees ensure that a full node doesn't lie to a thin node that a txn t is not present in a block B if infact B contains t? How can a thin node tell if the full node is lying if the full ...
user avatar
8 votes
1 answer
200 views

CVE-2012-2459 , possible code and performance improvement, is my logic correct?

ok so, in my effort to create a fullnode from scratch both for learning purpose and need (not a topic for discussion, thanks), I was looking at the code that check Merkle Root to not be vulnerable to ...
user avatar
2 votes
2 answers
185 views

Merkle root with one transaction

I am trying to build a merkle root which contains only the coinbase transaction from bitcoind. After creating the coinbase transaction, do I need to convert it to little endian, hash it twice and then ...
user avatar
  • 176
5 votes
2 answers
225 views

Is Merkle tree pruning described in the whitepaper feasible/useful? If not, would there be any alternative?

When I was reading bitcoin-paper-errata-and-details.md written by David A. Harding, I realized that there's probably a common misunderstanding or over-simplification about Merkle tree pruning. What ...
user avatar
1 vote
1 answer
77 views

A Bitcoin soft fork idea to help compress the blockchain

I've thought about a soft fork that can help storage costs. Why don't we force miners to embed the height of the TX Merkle tree in the first two bytes of the 4-byte block header version? It would ...
user avatar
  • 9,819
1 vote
1 answer
87 views

How to find my transaction from root of Merkle Tree [closed]

How could I verify my transaction from the root of Merkle Tree.
user avatar
-1 votes
1 answer
119 views

Is it possible to dynamically add transactions to a merkle tree? [closed]

When i read about merkle trees.. I saw we shall build a system wherein we could club all the transactions that happend in like 10 minutes to stay in a block. I mean.. whatever is known.. the known ...
user avatar
2 votes
1 answer
382 views

RSA accumulator vs Merkle Proofs

For proof of inclusion (used by SPV nodes) Bitcoin relies on Merkle proofs. Why Merkle trees were chosen and not RSA accumulators, as they can be used to provide a shorter proof? What are the ...
user avatar
  • 135
1 vote
1 answer
54 views

Intuition for Simplicity's CheckSigHashAll

So, I downloaded Simplicity and started a REPL using cabal new-repl Simplicity. Then I enabled type applications using :set -XTypeApplications. Consider these invocations: > (pkwCheckSigHashAll @...
user avatar
0 votes
0 answers
76 views

Bitcoin merkle tree

I am sorry can someone help ... Does bitcoin account for forgery attack as a second pre-image attack and how is it implemented? Plus how does bitcoin avoid unbalanced merkle tree. Regards
user avatar
0 votes
0 answers
102 views

How to create "Merkle Path"?

Merkle path is always appeared in many examples relevant with verification of transaction. but they never explain how merkle path is generated. So, I was wondering that how merkle path is generated. ...
user avatar
  • 363
2 votes
3 answers
363 views

Does merkle root contain hashes of transactions from previous blocks?

Every block in a blockchain contains merkle root value. So for any block, there is some list of transactions and you create a merkle tree based on these transaction. For other blocks, same process ...
user avatar
0 votes
4 answers
407 views

A question about full nodes, lightweight nodes and merkle trees

What is the purpose of full nodes storing merkle roots? Why don't they save the transactions only? The hashes could be calculated only when a lightnode asks for them and the merkle roots could be ...
user avatar
0 votes
0 answers
35 views

What is the complete process and purpose of a block validation using merkle trees?

I need the whole details please. Like does that happen only in the current block? Or at past blocks do? And how exactly does this happen? Do full nodes send the proper hashes and then a local ...
user avatar
0 votes
1 answer
27 views

Question about Merkle trees and blocks

There is something I cannot understand about Merkle trees. I understand how they are calculated and etc., but I cannot understand how they are used on a blockchain. If a block stores only the Merkle ...
user avatar