2.5.6 • Published 7 months ago

tool-db v2.5.6

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

Tool Db

ToolDb is a peer-to-peer model for a decentralized database, inspired by GundB

It is the mix of a lot of cool concepts into one;

  • Cryptographically secure.
  • Offline first.
  • Fully decentralized.
  • Capable of providing realtime updates.
  • Key-value/document storage.
  • Works in the Browser and Nodejs seamlessly.

For a more detailed documentation head here;

https://github.com/Manwe-777/tool-db-docs

(No live version just yet!, until the protocol is more finalized)

We push towards of the concept of federated servers, where we set up a p2p mesh network between any servers who want to join the swarm, and have those servers manage the connection and data sharing between them, while allowing client peers to connect to them to push updates to the database. This setup IS NOT a requirement! It is just what I think is the best and most reliable way of creating a p2p network for dApps using both desktop and web compatible technologies. Any peer has the capability of connecting to any other peer trough websockets, and modifiying the code to allow webRtc connections between web peers is absolutely possible.

Since anyone can join a federated server swarm to help growing the network we use cryptography (basic public and private key authenthication and signature validation) to ensure all messages are coming from the real authors of the data that they intend to modify; this way by joining a swarm all peers in it can help validate without even having full data; even a new server peer can help, because all information is stored on each message and we dont rely on any centralized database to fetch users data.

Please check the chain-swarm repository to see how a federated server swarm would look like, Tool Db only handles the connection and messaging between peers, but it does not have any logic for peer discovery. We do that using discovery-channel, but you can use any DHT/networking solution you want! even WebRTC between browsers works using the toolDbWebrtc transport.

Future work

While the database is currently functioning as expected, there are many things that could be added or improved to make it even better!

  • Allow data encryption (proably built in), add methods for ECC encryption, shared keys, etc.
  • Allow adding Noise/encryption to connections (probably based on the peer identity, requires initial keys exchange on connection)

Install

You can install ToolDb via npm or yarn;

npm install tool-db

or use it via script in your html;

<script src="https://unpkg.com/tool-db/bundle.js"></script>

That will include all of ToolDb exports in tooldb, then you can use it like;

const { ToolDb, sha256 } = tooldb;

Base usage

Creating a webrtc peers network is as easy as;

import { ToolDb } from "tool-db";
import ToolDbWebrtc from "@tool-db/webrtc-network";
import ToolDbECDSA from "@tool-db/ecdsa-user";
import ToolDbIndexedDb from "@tool-db/indexeddb-store";

const db = new ToolDb({
  debug: true,
  networkAdapter: ToolDbWebrtc,
  storageAdapter: ToolDbIndexedDb,
  userAdapter: ToolDbECDSA,
});

Notice we imported the required adapter modules; All three adapters are required and they are not included in this module by default; You should import each of them separately.

From there you can put and get data using the api;

db.putData("foo-key", "var").then(console.log);

There is a lot more you can do, like subscribe for updates, built-in users credentials validation based on ECC, create federated networks, run servers on Nodejs, auto-replicate data trough them, etc. Make sure more you read trough the documentation!

2.5.6

7 months ago

2.5.5

9 months ago

2.5.4

1 year ago

2.5.3

1 year ago

2.2.0

2 years ago

2.3.0

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.5.0

2 years ago

2.3.1

2 years ago

2.5.1

2 years ago

2.1.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

2 years ago

1.4.5

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.2.3

2 years ago

1.4.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.1.13

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago