0

I'm pretty new to the BC and specifically Ethereum world and I'm just starting to scratch the surface of the potential applications of this powerful technology.

As I'm approaching to build my first project ever I'd like to create a simple dApp to validate data on the db of a web platform. Basically this dApp would have two functions:

  • The first posts the SHA-256 hash of a data on the BC;
  • The second retrieves a specific hash stored on the BC and validates it against the one stored in the db to check if it has been altered or not.

Obviously the amount of hashes would start from one and scale continuously over time as new data are entered on the db. What would be the best way to achieve my goals? Would a Distributed Hash Table be the right fit? And lastly what would be the transaction costs of this solution?

Thanks in advance for helping me. Looking forward to your advice.

0

You can create a smart contract on the blockchain that will be used to keep track of the hashes. Storing the hash is cheap as compared to storing data on ethereum.

Transaction costs can be calculated using:

Cost = Gas Cost * Estimated Gas Required

You can use web3j functions to calculate the gas cost and estimated gas required to carry out the transaction. The following functions could be useful:

web3.eth.estimateGas(callObject [, callback])
web3.eth.getGasPrice([callback])

Storing 32 bytes hash takes around 25000 gas which is around $0.1545,

Regarding DHT vs Blockchain, It would depend on how you plan to design your system as DHT is good for lookup and provides you the key, value mapping whereas blockchain provides you tamper-proof data. DHT is decentralized but not every node will keep the data unlike in blockchain.

| improve this answer | |
  • Hi Arpit thank you so much for the advice. I think that BC would then be the best and more secure solution to store the hashes. So by putting the hashes on the BC how should it be done? More specific: each hash will be standing alone on the BC or there's a way to "collect" those? And if those stand alone how could be retrieved? With a function having the hash as parameter? – Erik Capoccetta Jun 26 at 15:45

Your Answer

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

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