Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (12.7k points)

We are developing an application where we want to store the data of the user on the ethereum blockchain. My thought process is something like this

  • Have a contract that interfaces with the UI.
  • When the user enters info on the UI, it triggers the solidity smart contract
  • The smart contract will, in turn, trigger an event through oraclejs that will store the data on a database

I want to know if there is a better way to do this.

1 Answer

0 votes
by (29.5k points)
edited by

Hi, as you know storing in Blockchain is a costly operation. So, you can store the data in oracle DB and store the row hash to the blockchain.

mapping (uint=> byets32) dataHashById;

Then, whenever you fetch the data from DB, you have to make hashing of that row and verify against the hash from the blockchain.

also keep in mind Everytime when you change the row in oracledb you have to make a transaction in Blockchain as you maintain oracledb as well as Blockchain. You have to synch these two

Hope this helps

Give yourself time to explore this field properly. Enroll in Blockchain Online Training now.

Browse Categories