├── .gitignore ├── Distribution ├── .gitkeep ├── Block.js ├── Chain.js └── Index.js ├── LICENSE ├── README.md ├── Source ├── Block.ts ├── Chain.ts └── Index.ts ├── Tests └── index.js ├── chainDB.svg ├── package-lock.json ├── package.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.code-workspace -------------------------------------------------------------------------------- /Distribution/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChristoPy/chainDB/3a705f3126591afb36724bc268cc82cff27832b0/Distribution/.gitkeep -------------------------------------------------------------------------------- /Distribution/Block.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | var HashJS = require("hash.js"); 4 | var BlowFish = require("egoroof-blowfish"); 5 | var Hash = HashJS["sha"]; 6 | var GENESIS_BLOCK_HASH = Hash.sha256().update("chainDB").digest("hex"); 7 | var Block = /** @class */ (function () { 8 | function Block(Name, Content, PreviousBlockHash) { 9 | this.Name = Name; 10 | this.PreviousBlockHash = PreviousBlockHash || GENESIS_BLOCK_HASH; 11 | this.Content = Content; 12 | this.TimeStamp = new Date().toLocaleTimeString(); 13 | } 14 | Block.prototype.Encrypt = function () { 15 | this.__EncryptBlockContent__(); 16 | this.__CalculateHash__(); 17 | }; 18 | Block.prototype.Decrypt = function () { 19 | return this.__DecryptBlockContent__(); 20 | }; 21 | Block.prototype.__CalculateHash__ = function () { 22 | var ThingsToBeHashed = this.Name + " - " + this.Content + " - " + this.PreviousBlockHash + " - " + this.TimeStamp; 23 | this.BlockHash = Hash.sha256().update(ThingsToBeHashed).digest("hex"); 24 | }; 25 | Block.prototype.__EncryptBlockContent__ = function () { 26 | var BF = this.__ConfigureBlowFish__(); 27 | this.Content = BF.encode(JSON.stringify(this.Content)); 28 | }; 29 | Block.prototype.__DecryptBlockContent__ = function () { 30 | var BF = this.__ConfigureBlowFish__(); 31 | return BF.decode(Uint8Array.from(Object["values"](JSON.parse(this.Content))), BlowFish.TYPE.STRING); 32 | }; 33 | Block.prototype.__ConfigureBlowFish__ = function () { 34 | var BF = new BlowFish(this.PreviousBlockHash, BlowFish.MODE.ECB, BlowFish.PADDING.NULL); 35 | BF.setIv(this.PreviousBlockHash.slice(0, 8)); 36 | return BF; 37 | }; 38 | return Block; 39 | }()); 40 | exports["default"] = Block; 41 | -------------------------------------------------------------------------------- /Distribution/Chain.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | var FS = require("fs"); 4 | var Path = require("path"); 5 | var Block_1 = require("./Block"); 6 | var OS = require("os"); 7 | var Chain = /** @class */ (function () { 8 | function Chain(Name) { 9 | this.Chain = []; 10 | if (!Name) { 11 | throw new Error("The chain must have a name."); 12 | } 13 | this.Name = Name; 14 | this.__DBPath__ = Path.join(OS.homedir(), ".chainDB/" + this.Name); 15 | this.Chain = (FS.existsSync(Path.join(this.__DBPath__, "chainDB")) ? this.__GetFile__("chainDB", true) : []); 16 | this.__MakeChainPath__(); 17 | } 18 | Chain.prototype.NewBlock = function (Name, Content) { 19 | this.CurrentBlock = new Block_1["default"](Name, Content, this.__PreviousBlockHash__()); 20 | this.CurrentBlock.Encrypt(); 21 | this.Chain.push({ 22 | Name: this.CurrentBlock.Name, 23 | PreviousBlockHash: this.CurrentBlock.PreviousBlockHash, 24 | CurrentBlockHash: this.CurrentBlock.BlockHash 25 | }); 26 | this.__MakeFile__(this.CurrentBlock.BlockHash, JSON.stringify(this.CurrentBlock.Content), null); 27 | this.__MakeFile__("chainDB", JSON.stringify(this.Chain)); 28 | }; 29 | Chain.prototype.GetBlock = function (BlockName, Return) { 30 | var _this = this; 31 | if (Return === void 0) { Return = "all"; } 32 | var ReturnEspecification = ["all", "last", "first"]; 33 | var Found = this.Chain.filter(function (Block) { return Block.Name === BlockName; }); 34 | if (Found.length === 0) { 35 | return null; 36 | } 37 | switch (Return) { 38 | case "first": return this.__DecryptBlock__(Found[0]); 39 | case "last": return this.__DecryptBlock__(Found[Found.length - 1]); 40 | default: return Found.map(function (BlockFound) { return JSON.parse(_this.__DecryptBlock__(BlockFound)); }); 41 | } 42 | }; 43 | Chain.prototype.__DecryptBlock__ = function (BlockData) { 44 | if (!BlockData) { 45 | throw new Error("A Block Must Be Given To Be Decrypted."); 46 | } 47 | var BlockDataContent = this.__GetFile__(BlockData.CurrentBlockHash); 48 | var DecryptedBlock = new Block_1["default"](BlockData.Name, BlockDataContent, BlockData.PreviousBlockHash); 49 | DecryptedBlock.BlockHash = BlockData.CurrentBlockHash; 50 | return DecryptedBlock.Decrypt(); 51 | }; 52 | Chain.prototype.__MakeChainPath__ = function () { 53 | try { 54 | FS.mkdirSync(this.__DBPath__); 55 | } 56 | catch (SomeError) { 57 | if (SomeError.code !== "EEXIST") { 58 | throw SomeError; 59 | } 60 | } 61 | }; 62 | Chain.prototype.__GetFile__ = function (FileName, Parse, Encode) { 63 | if (Parse === void 0) { Parse = false; } 64 | if (Encode === void 0) { Encode = "utf-8"; } 65 | var File; 66 | try { 67 | File = FS.readFileSync(Path.join(this.__DBPath__, FileName), Encode); 68 | } 69 | catch (SomeError) { 70 | throw (SomeError); 71 | } 72 | if (File) { 73 | return (Parse ? JSON.parse(File) : File); 74 | } 75 | }; 76 | Chain.prototype.__MakeFile__ = function (FileName, Content, Encode) { 77 | if (Encode === void 0) { Encode = "utf-8"; } 78 | try { 79 | FS.writeFileSync(Path.join(this.__DBPath__, FileName), Content, Encode); 80 | } 81 | catch (SomeError) { 82 | throw (SomeError); 83 | } 84 | }; 85 | Chain.prototype.__PreviousBlockHash__ = function () { 86 | return this.Chain.length > 0 ? this.Chain[this.Chain.length - 1].CurrentBlockHash : null; 87 | }; 88 | return Chain; 89 | }()); 90 | exports["default"] = Chain; 91 | -------------------------------------------------------------------------------- /Distribution/Index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var FS = require("fs"); 3 | var Path = require("path"); 4 | var OS = require("os"); 5 | var Chain_1 = require("./Chain"); 6 | try { 7 | FS.mkdirSync(Path.join(OS.homedir(), ".chainDB")); 8 | } 9 | catch (SomeError) { 10 | if (SomeError.code !== "EEXIST") { 11 | throw SomeError; 12 | } 13 | } 14 | var chainDB = /** @class */ (function () { 15 | function chainDB() { 16 | } 17 | chainDB.prototype.New = function (Name) { 18 | this.DB = new Chain_1["default"](Name); 19 | }; 20 | chainDB.prototype.Add = function (Name, Content) { 21 | this.DB.NewBlock(Name, Content); 22 | }; 23 | chainDB.prototype.First = function (Name) { 24 | return this.DB.GetBlock(Name, "first"); 25 | }; 26 | chainDB.prototype.Last = function (Name) { 27 | return this.DB.GetBlock(Name, "last"); 28 | }; 29 | chainDB.prototype.All = function (Name) { 30 | return this.DB.GetBlock(Name); 31 | }; 32 | return chainDB; 33 | }()); 34 | module.exports = new chainDB(); 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Christopher Ribeiro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
chainDB
2 | 3 |
4 | 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?). 5 | 6 |
7 | 8 | [![CodeFactor](https://www.codefactor.io/repository/github/christopy/chaindb/badge/master)](https://www.codefactor.io/repository/github/christopy/chaindb/overview/master) 9 | 10 |
11 |
12 | 13 | 14 | ## Installation 15 | ```npm install @christopy/chaindb --save``` 16 | 17 | 18 | ## Creating a Chain 19 | ```js 20 | // Get chainDB. 21 | const Chain = require ("@christopy/chaindb"); 22 | 23 | // Create the Chain. 24 | Chain.New ("My awesome blockchain DB"); 25 | ``` 26 | 27 | ## Adding Blocks 28 | To add a Block, just specify your name and your content. 29 | ```js 30 | // Add a Block with a title of "phrase" and your content as "lorem ipsum". 31 | Chain.Add ("phrase", "lorem ipsum"); 32 | 33 | // Add a Block with a title of "user" and your content as an Object. 34 | Chain.Add ("user", { 35 | name: "john", 36 | last_name: "doe" 37 | }); 38 | 39 | // Add a Block with a title of "user" and your content as an Object. 40 | Chain.Add ("user", { 41 | username: "ChristoPy", 42 | age: 19 43 | }); 44 | ``` 45 | 46 | ## Picking Blocks 47 | To get Blocks, just specify your name and if you want the first, the last or all Blocks added with that name. 48 | If no Blocks where found, returns null. 49 | ```js 50 | // Get the first Block added to the Chain with "user" as your name. 51 | const FirstUser = Chain.First ("user"); // {name: "john", last_name: "doe"} 52 | 53 | // Get the last Block added to the Chain with "user" as your name. 54 | const LastUser = Chain.Last ("user"); // {username: "ChristoPy", age: 19} 55 | 56 | // Get all Blocks added to the Chain with "user" as your name. 57 | const AllUsers = Chain.All ("user"); // [{name: "john", last_name: "doe"}, {username: "ChristoPy", age: 19}] 58 | 59 | // Tryies to get a Block that don't exists on the Chain. 60 | const AllHeroes = Chain.All ("superheroes"); // null 61 | ``` 62 | 63 | ## Why blockchain? 64 | Why not blockchain? 65 | 66 | ## Version 67 | 2.0.3 68 | 69 | ## Thanks 70 | Icon made by [chanut](https://www.flaticon.com/authors/chanut "chanut") from www.flaticon.com -------------------------------------------------------------------------------- /Source/Block.ts: -------------------------------------------------------------------------------- 1 | import * as HashJS from "hash.js"; 2 | import * as BlowFish from "egoroof-blowfish"; 3 | 4 | const Hash = HashJS["sha"]; 5 | const GENESIS_BLOCK_HASH = Hash.sha256 ().update ("chainDB").digest ("hex"); 6 | 7 | export default class Block { 8 | 9 | public Name:String; 10 | public PreviousBlockHash:String; 11 | public Content:string; 12 | public TimeStamp:String; 13 | public BlockHash:Sha256; 14 | 15 | constructor (Name:String, Content:any, PreviousBlockHash:String) { 16 | 17 | this.Name = Name; 18 | this.PreviousBlockHash = PreviousBlockHash || GENESIS_BLOCK_HASH; 19 | this.Content = Content; 20 | this.TimeStamp = new Date ().toLocaleTimeString (); 21 | } 22 | 23 | Encrypt () { 24 | 25 | this.__EncryptBlockContent__ (); 26 | this.__CalculateHash__ (); 27 | } 28 | 29 | Decrypt ():any { 30 | 31 | return this.__DecryptBlockContent__ (); 32 | } 33 | 34 | private __CalculateHash__ () { 35 | 36 | const ThingsToBeHashed = `${this.Name} - ${this.Content} - ${this.PreviousBlockHash} - ${this.TimeStamp}`; 37 | this.BlockHash = Hash.sha256 ().update (ThingsToBeHashed).digest ("hex"); 38 | } 39 | 40 | private __EncryptBlockContent__ () { 41 | 42 | const BF = this.__ConfigureBlowFish__ (); 43 | this.Content = BF.encode (JSON.stringify (this.Content)); 44 | } 45 | 46 | private __DecryptBlockContent__ ():any { 47 | 48 | const BF = this.__ConfigureBlowFish__ (); 49 | return BF.decode (Uint8Array.from (Object["values"] (JSON.parse (this.Content))), BlowFish.TYPE.STRING); 50 | } 51 | 52 | private __ConfigureBlowFish__ ():BlowFish { 53 | 54 | const BF = new BlowFish (this.PreviousBlockHash, BlowFish.MODE.ECB, BlowFish.PADDING.NULL); 55 | BF.setIv (this.PreviousBlockHash.slice (0, 8)); 56 | 57 | return BF; 58 | } 59 | } -------------------------------------------------------------------------------- /Source/Chain.ts: -------------------------------------------------------------------------------- 1 | import * as FS from "fs"; 2 | import * as Path from "path"; 3 | import Block from './Block'; 4 | import * as OS from "os"; 5 | 6 | 7 | export default class Chain { 8 | 9 | public Name:string; 10 | public Chain = []; 11 | private CurrentBlock:Block; 12 | private __DBPath__:string; 13 | 14 | constructor (Name:string) { 15 | 16 | if (!Name) { 17 | 18 | throw new Error ("The chain must have a name."); 19 | } 20 | 21 | this.Name = Name; 22 | this.__DBPath__ = Path.join (OS.homedir (), `.chainDB/${this.Name}`); 23 | this.Chain = (FS.existsSync (Path.join (this.__DBPath__, "chainDB")) ? this.__GetFile__ ("chainDB", true) : []); 24 | 25 | this.__MakeChainPath__ (); 26 | } 27 | 28 | public NewBlock (Name:string, Content:any) { 29 | 30 | this.CurrentBlock = new Block (Name, Content, this.__PreviousBlockHash__ ()); 31 | this.CurrentBlock.Encrypt (); 32 | 33 | 34 | this.Chain.push ({ 35 | 36 | Name: this.CurrentBlock.Name, 37 | PreviousBlockHash: this.CurrentBlock.PreviousBlockHash, 38 | CurrentBlockHash: this.CurrentBlock.BlockHash 39 | }); 40 | 41 | this.__MakeFile__ (this.CurrentBlock.BlockHash, JSON.stringify (this.CurrentBlock.Content), null); 42 | this.__MakeFile__ ("chainDB", JSON.stringify (this.Chain)); 43 | } 44 | 45 | public GetBlock (BlockName:String, Return:String = "all") { 46 | 47 | const ReturnEspecification:any = ["all", "last", "first"]; 48 | const Found = this.Chain.filter (Block => Block.Name === BlockName); 49 | 50 | if (Found.length === 0) { 51 | 52 | return null; 53 | } 54 | 55 | switch (Return) { 56 | 57 | case "first": return this.__DecryptBlock__ (Found[0]); 58 | case "last": return this.__DecryptBlock__ (Found[Found.length-1]); 59 | default: return Found.map (BlockFound => JSON.parse (this.__DecryptBlock__ (BlockFound))); 60 | } 61 | } 62 | 63 | public __DecryptBlock__ (BlockData:any) { 64 | 65 | if (!BlockData) { 66 | 67 | throw new Error ("A Block Must Be Given To Be Decrypted."); 68 | } 69 | 70 | const BlockDataContent = this.__GetFile__ (BlockData.CurrentBlockHash); 71 | 72 | const DecryptedBlock = new Block (BlockData.Name, BlockDataContent, BlockData.PreviousBlockHash); 73 | DecryptedBlock.BlockHash = BlockData.CurrentBlockHash; 74 | 75 | return DecryptedBlock.Decrypt (); 76 | } 77 | 78 | private __MakeChainPath__ ():void { 79 | 80 | try { 81 | 82 | FS.mkdirSync (this.__DBPath__); 83 | 84 | } catch (SomeError) { 85 | 86 | if (SomeError.code !== "EEXIST") { 87 | 88 | throw SomeError; 89 | } 90 | } 91 | } 92 | 93 | private __GetFile__ (FileName:string, Parse:boolean = false, Encode:any = "utf-8"):any { 94 | 95 | let File; 96 | 97 | try { 98 | 99 | File = FS.readFileSync (Path.join (this.__DBPath__, FileName), Encode); 100 | } catch (SomeError) { 101 | 102 | throw (SomeError); 103 | } 104 | 105 | if (File) { 106 | 107 | return (Parse ? JSON.parse (File) : File); 108 | } 109 | } 110 | 111 | private __MakeFile__ (FileName:any, Content:string, Encode:any = "utf-8"):any { 112 | 113 | try { 114 | 115 | FS.writeFileSync (Path.join (this.__DBPath__, FileName), Content, Encode); 116 | } catch (SomeError) { 117 | 118 | throw (SomeError); 119 | } 120 | } 121 | 122 | private __PreviousBlockHash__ ():any { 123 | 124 | return this.Chain.length > 0 ? this.Chain [this.Chain.length - 1].CurrentBlockHash : null; 125 | } 126 | } -------------------------------------------------------------------------------- /Source/Index.ts: -------------------------------------------------------------------------------- 1 | import * as FS from "fs"; 2 | import * as Path from "path"; 3 | import * as OS from "os"; 4 | 5 | import Chain from "./Chain"; 6 | 7 | 8 | try { 9 | 10 | FS.mkdirSync (Path.join (OS.homedir (), ".chainDB")); 11 | 12 | } catch (SomeError) { 13 | 14 | if (SomeError.code !== "EEXIST") { 15 | 16 | throw SomeError; 17 | } 18 | } 19 | 20 | class chainDB { 21 | 22 | public DB:Chain; 23 | 24 | public New (Name:string) { 25 | 26 | this.DB = new Chain (Name); 27 | } 28 | 29 | public Add (Name:string, Content:any) { 30 | 31 | this.DB.NewBlock (Name, Content); 32 | } 33 | 34 | public First (Name:string):object { 35 | 36 | return this.DB.GetBlock (Name, "first"); 37 | } 38 | 39 | public Last (Name:string):object { 40 | 41 | return this.DB.GetBlock (Name, "last"); 42 | } 43 | 44 | public All (Name:string):Array { 45 | 46 | return this.DB.GetBlock (Name); 47 | } 48 | } 49 | 50 | export = new chainDB (); -------------------------------------------------------------------------------- /Tests/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Get chainDB. 3 | * @type {Object} 4 | */ 5 | const DB = require ("./../Distribution/Index.js"); 6 | 7 | /** 8 | * Create a Chain. 9 | */ 10 | DB.New ("Test"); 11 | 12 | /** 13 | * Add two Blocks inside it. 14 | */ 15 | DB.Add ("Standard Title", "lorem ipsum"); 16 | DB.Add ("Standard Title inside an Array", ["lorem ipsum"]); 17 | 18 | /** 19 | * Add two another blocks with the same Name as before. 20 | */ 21 | DB.Add ("Standard Title", "123"); 22 | DB.Add ("Standard Title inside an Array", ["123"]); 23 | 24 | 25 | /** 26 | * Get the first Block with the name as "Standard Title inside an Array"; 27 | */ 28 | console.log (DB.First ("Standard Title inside an Array")); 29 | 30 | /** 31 | * Get the last Block with the name as "Standard Title inside an Array"; 32 | */ 33 | console.log (DB.Last ("Standard Title inside an Array")); 34 | 35 | /** 36 | * Get all Blocks with the name as "Standard Title inside an Array"; 37 | */ 38 | console.log (DB.All ("Standard Title inside an Array")); 39 | 40 | 41 | 42 | /** 43 | * Get the first Block with the name as "Standard Title"; 44 | */ 45 | console.log (DB.First ("Standard Title")); 46 | 47 | /** 48 | * Get the last Block with the name as "Standard Title"; 49 | */ 50 | console.log (DB.Last ("Standard Title")); 51 | 52 | /** 53 | * Get all Blocks with the name as "Standard Title"; 54 | */ 55 | console.log (DB.All ("Standard Title")); -------------------------------------------------------------------------------- /chainDB.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 41 | 43 | 44 | 46 | image/svg+xml 47 | 49 | 50 | 51 | 52 | 53 | 58 | 63 | 67 | 71 | 75 | 79 | 83 | 87 | 91 | 95 | 96 | 99 | 101 | 103 | 105 | 113 | 121 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@christopy/chaindb", 3 | "version": "2.0.3", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/node": { 8 | "version": "10.9.4", 9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.9.4.tgz", 10 | "integrity": "sha512-fCHV45gS+m3hH17zgkgADUSi2RR1Vht6wOZ0jyHP8rjiQra9f+mIcgwPQHllmDocYOstIEbKlxbFDYlgrTPYqw==", 11 | "dev": true 12 | }, 13 | "egoroof-blowfish": { 14 | "version": "2.1.0", 15 | "resolved": "https://registry.npmjs.org/egoroof-blowfish/-/egoroof-blowfish-2.1.0.tgz", 16 | "integrity": "sha512-loZ/a/GLWP0dDM202eol4cngntU4/yWaGjG+fCJ8ZGZb37zKmSIukyXW18d/x37yc/ft429Z0WduEhAiiahkMw==" 17 | }, 18 | "hash.js": { 19 | "version": "1.1.3", 20 | "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", 21 | "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", 22 | "requires": { 23 | "inherits": "^2.0.3", 24 | "minimalistic-assert": "^1.0.0" 25 | } 26 | }, 27 | "inherits": { 28 | "version": "2.0.3", 29 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 30 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 31 | }, 32 | "minimalistic-assert": { 33 | "version": "1.0.0", 34 | "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", 35 | "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=" 36 | }, 37 | "typescript": { 38 | "version": "3.0.3", 39 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", 40 | "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", 41 | "dev": true 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@christopy/chaindb", 3 | "version": "2.0.3", 4 | "description": "A noSQL database based on blockchain technology", 5 | "main": "Distribution/Index.js", 6 | "scripts": { 7 | "test": "node Tests/index.js", 8 | "build": "tsc --build tsconfig.json" 9 | }, 10 | "keywords": [ 11 | "nosql-databases", 12 | "nosql", 13 | "blockchain", 14 | "blockchain-technology", 15 | "database", 16 | "databases", 17 | "block", 18 | "blocks", 19 | "chaindb", 20 | "chain", 21 | "db", 22 | "js" 23 | ], 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/ChristoPy/chainDB.git" 27 | }, 28 | "author": "Christopher Ribeiro ", 29 | "license": "MIT", 30 | "bugs": { 31 | "url": "https://github.com/ChristoPy/chainDB/issues" 32 | }, 33 | "homepage": "https://github.com/ChristoPy/chainDB#readme", 34 | "dependencies": { 35 | "egoroof-blowfish": "^2.1.0", 36 | "hash.js": "^1.1.3" 37 | }, 38 | "devDependencies": { 39 | "@types/node": "^10.9.4", 40 | "typescript": "^3.0.3" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "moduleResolution": "node", 5 | "baseUrl": ".", 6 | "outDir": "Distribution" 7 | } 8 | } --------------------------------------------------------------------------------