Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Blockchain by (12.8k 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.8k points)

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

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94k users

Browse Categories