DEV Community

Discussion on: Blockchain: what is in a block?

Collapse
 
chamarapw profile image
ChamaraPW

There are 16 leaves in this tree. We construct our tree from the bottom up by pairing each leaf. Now, anybody can prove that the leaf I ( in orange ) is part of this block by having the path given in green. We have only 4 hashes, but that is enough to know if the leaf I belongs here. That is because with those informations, we are able to construct every single leaf we need( in yellow ). We can create IJ, IJKL, IJKLMNOP and the root and check if those hashes correspond. This is why it is very complicated to cheat a blockchain. To change one thing means you must change everything.
How can we prove that I is belong to this block.is it mathematical way or any other ways?can you explain little ?

Collapse
 
damcosset profile image
Damien Cosset

In this example, by having the path J, KL, MNOP and ABCDEFGH, you can re-created the hash of each pair.

You have the I hash and J hash, so you can create a hash IJ. Because you also have the hash KL, you can create the hash IJKL.... If one hash doesn't match the original, you know the I hash is corrupt.

Collapse
 
chamarapw profile image
ChamaraPW

thank you very much

Collapse
 
arvindpdmn profile image
Arvind Padmanabhan

Do we have I hash, J hash and so on? I thought a block contains only the Merkle root? When you say I hash and J hash, do you mean the transaction IDs that are included in the block? If so, they we can compute IJ hash, etc. until we arrive at the Merkle root? Does the block include IJ hash for validation purpose? Or it is just the Merkle root that can be used for validation? Thx

Thread Thread
 
damcosset profile image
Damien Cosset

Yes, I J K ... are transactions hashes that are included in the block here.

Whenever a transaction ( in this case I ) claims to be a part of a block, we can control if the hashes we get are the same.

Thread Thread
 
arvindpdmn profile image
Arvind Padmanabhan

One more doubt. Are intermediate hashes (eg. IJ hash) included in the block or is it only the Merkle root that is included?

Thread Thread
 
damcosset profile image
Damien Cosset

Intermediate hashes are included. If I understood this part correctly, the client wants to verify a transaction is part of a block. The client gets a bloom filter that will give him the necessary hashes to verify whether or not this transaction is part of the block.

This saves a lot of resources, because you only need a few "leaves" in the tree, and not the entire merkle tree. With the path you get, you can control if you get the same hashes.