Skip to content

Repository files navigation

chainDB
A noSQL database based on blockchain technology. It's purpose is to store data using a simple append only system (maybe a future way to edit Blocks?).

CodeFactor

Installation

npm install @christopy/chaindb --save

Creating a Chain

// Get chainDB.constChain=require("@christopy/chaindb");// Create the Chain.Chain.New("My awesome blockchain DB");

Adding Blocks

To add a Block, just specify your name and your content.

// Add a Block with a title of "phrase" and your content as "lorem ipsum".Chain.Add("phrase","lorem ipsum");// Add a Block with a title of "user" and your content as an Object.Chain.Add("user",{name: "john",last_name: "doe"});// Add a Block with a title of "user" and your content as an Object.Chain.Add("user",{username: "ChristoPy",age: 19});

Picking Blocks

To get Blocks, just specify your name and if you want the first, the last or all Blocks added with that name. If no Blocks where found, returns null.

// Get the first Block added to the Chain with "user" as your name.constFirstUser=Chain.First("user");// {name: "john", last_name: "doe"}// Get the last Block added to the Chain with "user" as your name.constLastUser=Chain.Last("user");// {username: "ChristoPy", age: 19}// Get all Blocks added to the Chain with "user" as your name.constAllUsers=Chain.All("user");// [{name: "john", last_name: "doe"}, {username: "ChristoPy", age: 19}]// Tryies to get a Block that don't exists on the Chain.constAllHeroes=Chain.All("superheroes");// null

Why blockchain?

Why not blockchain?

Version

2.0.3

Thanks

Icon made by chanut from www.flaticon.com

About

A noSQL database based on blockchain technology

Topics

Resources

Stars

16 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages