That is a conceptual question that I am asking here. We are trying to developp an application to securely store the hashes of some files in the blockchain. Everything is automated (taking a file as input, computing the hash, connecting to the Parity Client and calling the notarize function of our contract).

However, we are struggling to answer the question of the accessibility to data: imagine you proceed about 300 transactions per day. If then, from a "proof" point of view, you are asked to retrieve the hash of a given file, how could it be fastly done?

1) We need the Tx hash of the transaction. Thus, we would have to parse every transaction, see the input data, convert to ascii and compare that to a local calculation of the file to be proved. And repeat every step till we find the good input data (if there is one) ---> that's very time consuming and therefore not feasable.

2) Store every detail of every transaction in a DB. But then, we cannot reach our goal, which is to securely store data: integrity of DB can be compromised.

Do you have any clue, about how to build such an access-application? Thank you a lot!

  • This is confusing. If you are saving the hash in your contract, you just need to retrieve the hash from the contract. I do not understand why you need to get the hash of the transaction that originally notarized the file hash. You just need to store every hash with an id for a particular file, and then submit the Id to the contract and get the hash. am I missing something.
    – Jaime
    Apr 10 '18 at 7:25

Two things:

First, with a getter you can call your data structure with no cost, if you're not writing anything you're not dependant on blockchain time. You can virtually fetch your whole data structure at once and then manage it client side or something. Ideally you have some kind of organization so you don't have to fetch everything though.

Secondly, no, storing anything in a database doesn't mean it can be compromised. It's actually something a lot of people do:

  • store the full data in a DB
  • store hashes of the data in a contract
  • make checking functions to make sure that the data in the DB match the hashes. If they don't, you know that your DB has been modified.

But you need some kind of structure to find your data, indexation, anything. Maybe something based on date if it's easy to know when given data was stored, or simple indexation if you have the file and you want to see if it was stored (you can generate the hash and see if it exists instantly).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy