Skip to content

numerum-tech/openchain-mongo-storage

 
 

Repository files navigation

MongoDB storage provider for Openchain Server

This project implements a storage provider for Openchain Server using MongoDb as a persistence media.

It implements Records & Transactions storage and Anchors storage.

Installation

  • Edit the Openchain webapp project.json

    • Remove dnxcore5 in the frameworks section (mongodb driver currently lacks support for dnxcore)
    • Add MongoDB storage provider as a dependency
    {
        "version": "0.5.0-rc1",
        "entryPoint": "Openchain.Server",
    
        "dependencies": {
            "Openchain.Server": "0.5.0-rc1-*",
            "Openchain.Validation.PermissionBased": "0.5.0-rc1-*",
            "Openchain.Anchoring.Blockchain": "0.5.0-rc1-*",
            "Openchain.MongoDb": "0.1.0-alpha1"
        },
    
        "userSecretsId": "Openchain.Server",
    
        "commands": {
            "start": "Microsoft.AspNet.Hosting --webroot \"Webroot\" --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:8080"
        },
    
        "frameworks": {
            "dnx451": {
            }
        }
    }
  • Edit the Openchain webapp config.json

    • Edit the root storage section specifying the following parameters :
      • provider : MongoDb
      • connection_string : MongoDB connection string to your MongoDb instance
      • database : Name of the MongoDb database to use
    "storage": {
        "provider": "MongoDb",
        "connection_string": "mongodb://localhost",
        "database": "openchain"
    },
    • Edit the anchoring storage section :
      • provider : MongoDb
      • connection_string : MongoDB connection string to your MongoDb instance
      • database : Name of the MongoDb database to use
    "anchoring": {
        //...
        "storage": {
            "provider": "MongoDb",
            "connection_string": "mongodb://localhost",
            "database": "openchain"
        }
    }

Running

At first startup, needed collections and indexes are created.

3 collections are used :

  • records containing records details
  • transactions containing transactions details
  • pending_transactions containing transactions still being committed to the database (this collection is always nearly empty).

About

MongoDB-based storage engine for Openchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%