This question already has an answer here:

I am new to ethereum and the blockchain, but I am wondering about blockchain databases. Mainly I am wondering how exactly the database data and the blockchain merge. For instance, in a database you have basically SELECT, INSERT, DELETE, and UPDATE. The data is stored in tables or in a graph, etc. Then you query the data, that's basically it.

In a blockchain, the data seems to be stored in a Merkle tree. This seems to allow for storing versions of data, to handle the database versioning problem. It also has something to do with validating the data, but I'm not too sure how this works yet, but it seems valuable.

To merge the two, it seems you need to store the database in both a Merkle Tree and a graph database (if you're doing graph data). I don't see how this should really work. In addition, I would like to know at what granularity you are making the "blockchain transactions", because these seem processor intensive and so if you made them on every CREATE or INSERT, etc., it seems like that would bog down the db. Please advise.

marked as duplicate by Ismael, Achala Dissanayake, Richard Horrocks, Rosco Kalis, shane Jan 20 at 18:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


This can possible clarify things for you: https://academy.b9lab.com/courses/B9lab/X16-0/2016/about

You have an incorrect assumption about blockchain's approach to databases. There isn't one. Developers can benefit from familiarization with classic data structures, and must optimize storage layout to support data access requirements.

General-purpose SQL is not supported. Have a look over here for an explanation and a popular pattern: https://medium.com/@robhitchens/solidity-crud-part-1-824ffa69509a

Hope it helps.

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