This project implements a storage provider for Tedchain Server using MongoDb as a persistence media.
It implements Records & Transactions storage and Anchors storage.
-
Edit the Tedchain 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": "Tedchain.Server", "dependencies": { "Tedchain.Server": "0.5.0-rc1-*", "Tedchain.Validation.PermissionBased": "0.5.0-rc1-*", "Tedchain.Anchoring.Blockchain": "0.5.0-rc1-*", "Tedchain.MongoDb": "0.1.0-alpha1" }, "userSecretsId": "Tedchain.Server", "commands": { "start": "Microsoft.AspNet.Hosting --webroot \"Webroot\" --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:8080" }, "frameworks": { "dnx451": { } } }
-
Edit the Tedchain 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": "tedchain" },
- 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": "tedchain" } }
- Edit the root storage section specifying the following parameters :
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).