I am struggling with the project for my thesis. I need to develop a Đapp, which can

  1. store a query ID as an integer and a large string array (which is
    actually the output of a query to a database, given as a CSV file),
  2. if the user provides an ID and another CSV file, the Đapp has to return the values, which do not match the ones stored on the blockchain for the given query ID.

For this reason, Ethereum's modified Merkle Patricia trie should be used. I should store the values of the CSV file in a trie, where the hashed values are the leaves and they are hashed pairwisely again and again, until reaching the root hash. Then, if the user provides an ID and a dataset, I should compare the root hash of the dataset with the one stored on the blockchain. If they don't match, I have to compare the hashes in the next level. Based on this comparison, I should go into the direction, where there is a mismatch and find the leaves in the end that do not match.

I'm really stuck with it and I'm not sure, how I should proceed. Should I implement a store and a validation function in Solidity? Or what is the right way to start? I would love to see a sample application, which is similar.

2 Answers 2


You might find it useful to look at the zeppelin smart contract that verifies a merkle proof for a given root and leaf ;



So, probably it's not the most effective solution, but I decided to store the data in a mapping(uint256=>bytes32[])at the end, where the integer is the ID of the query and the byte array contains the hashed rows. This way I can easily get the byte array which belongs to a given ID. However, then I need to iterate through the whole array to verify each entry, but I couldn't come up with a better idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.