Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Merkle Trees #5

Open
lancekrogers opened this issue Oct 27, 2017 · 3 comments
Open

Implement Merkle Trees #5

lancekrogers opened this issue Oct 27, 2017 · 3 comments
Assignees

Comments

@lancekrogers
Copy link
Member

lancekrogers commented Oct 27, 2017

We need to implement merkle trees built from transaction hashes and add the merkle root to each block. This can be used to verify the transactions in a block. This is a fundamental concept of blockchain and is needed to build a trustworthy blockchain.

@jcopley
Copy link

jcopley commented Oct 27, 2017

Agreed, but is the merkle root strictly necessary if we hash the entire block? IIRC, correctly, what gets hashed in bitcoin's proof of work algorithm is the block header, not the entire block. In that case, a merkle root is essential to make sure the transaction data is verified.

Either way, this brings up another issue: our transactions have no Id, which is necessary in order to reference previous transactions.

@lancekrogers
Copy link
Member Author

My understanding is that the hashing of the block header is used as a seed for the proof of work algorithm so that the same nonce cant be used to generate blocks every time. If this is the case we could hash the entire block of transactions and use that value instead of the merkle root but each client will have to store all the transaction hashes in memory in order to validate each transaction. I have a feeling that this may bog down the nodes so I think itd be best to use the merkle root since it was chosen in bitcoin to solve this problem.

And youre right, I will go ahead and create an issue to add transaction hash ids as well.

@itsromiljain
Copy link

This means we should be hashing only the Block header not the complete Block. In that case Block consists of two parts - Block header and rest of Block content. And Block header will have the merkle root of all the transactions in that block. I hope i got this conversation correct.

@rcherukuri83 rcherukuri83 self-assigned this Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants