4

I need little direction on what must be maintained in BC and what must be maintained outside BC. For example I have to maintain book info like name, title, author, book cover as image, price. Can I maintain all the attributes in blockchain? Should I keep the images outside blockchain?

Also how can we keep the information of an entity in sync between the 2 sources?

Thanks in advance for your time and help!

6

In general the blockchain is not meant to to save a lot of data. Data storage in ethereum is quite expensive. One approach would be to save a hash of the data in the blockchain and store the actual data in a database or on IPFS or Swarm. It is definitely a good idea to keep images outside the blockchain. If you store images in IPFS or Swarm you will get a hash of the data and you would store the hash in the blockchain. Since the is calculated based on the actual data of the image you also can make sure that the image was not changed after you stored it.

The right approach to sync between the two source is to use events. You can define events in your smart contracts. When you call a function of the smart contract the event will be fired. You can catch the events in your application. If the transaction was successful you can write the data to your database or to IPFS/Swarm.

This is more like a general explanation. If you need detailed guidance on how to implement this kind of approach you can write a comment and I will post some links where you can find the detailed information.

I hope that helps

  • Thank you so much for the info, it would be of great help if you could provide other useful links. – Arun Kumar Nov 22 '17 at 12:11
  • Would be interesting to read those links you suggested – HeyJude Mar 28 at 20:36

protected by Community May 11 '18 at 10:33

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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