Why use NoSQL for Smart Contracts off-the-blockchain data

A common question when building your Blockchain DApp (decentralized application) is what kind of database you want to use for your off-the-blockchain data.

The dilemma is between the standard a bit old-school SQL(relational) type and the more modern NoSQL JSON based data structures.

Why relational table-type SQL is not the best approach for Blockchain applications:

  • Need to define the table schema definition up front
  • If you need to update, the schema becomes difficult to manage
  • Does not support hierarchical data
  • Additional code layers are needed, which creates more complex application architecture

Why using NoSQL is better approach:

  • No need to define scheme
  • The use of JSON fields
  • Supports hierarchical data
  • Query based on key or partial key range
  • Less code – just use built-in structure JSON serialization (marshalling and unmarshalling) supported by many languages

References:

  1. LevelDB http://leveldb.org/
  2. DocumentDB – https://azure.microsoft.com/en-us/services/documentdb/
  3. CouchDB – http://couchdb.apache.org/

Leave a Reply

Your email address will not be published. Required fields are marked *