简体   繁体   中英

Storing users data on ethereum blockchain

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 inturn 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.

The blockchain is used for its property of transparency, immutability, security and no downtime. If you use public blockchain the user data will be visible in the transaction and anyone can see it. To utilize the full potential of blockchain I would recommend either using Private Blockchain or encrypt the data while storing in the block.

As storing in Blockchain is costly operation you can store the data in oracle db and store the rowhash(I recommend sha256()) to the blockchain.

mapping (uint=> byets32) dataHashById;

Now whenever you fetch the data from db, you have to make hashing of that row and verify against the hash from blockchain. Thats it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM