in ,

orbitdb / orbit-db, Hacker News

orbitdb / orbit-db, Hacker News
                    

        

  

OrbitDB is a node serverless, distributed, peer-to-peer database . OrbitDB uses IPFS as its data storage and IPFS Pubsub to automatically sync databases with peers. It’s an eventually consistent database that uses CRDTs for conflict-free database merges making OrbitDB an excellent choice for decentralized apps (dApps), blockchain applications and offline-first web applications.

it is live at (Live demo 1 , Live demo 2 , or P2P TodoMVC app !

OrbitDB provides various types of databases for different data models and use cases:

(log node : an immutable (append-only) log with traversable history. Useful for “latest N” (use cases or as a message queue.) feed : a mutable log with traversable history. Entries can be added and removed. Useful for

  • “shopping cart” (type of use cases, or for example as a feed of blog posts or “tweets”. (keyvalue) : a key-value database just like your favorite key-value database. docs node: a document database to which JSON documents can be stored and indexed by a specified key. Useful for building search indices or version controlling documents and data. counter

    node: Useful for counting events separate from log / feed data.

    All databases are implemented on top of ipfs -log , an immutable, operation-based conflict-free replicated data structure (CRDT) for distributed systems. If none of the OrbitDB database types match your needs and / or you need case-specific functionality, you can easily implement and use a custom database store of your own.

    (Project status & support)

    Status: node in active development

  • (NOTE!) OrbitDB is alpha-stage Matrix software. It means OrbitDB hasn’t been security audited and programming APIs and data formats can still change. We encourage you to reach out to the maintainers if you plan to use OrbitDB in mission critical systems.

    This is the Javascript implementation and it works both in node Browsers and node Node.js with support for Linux and OS X and Windows. The minimum required version of Node.js is now 8.6.0 due to the usage of … spread syntax. LTS versions (even numbered versions 8, , etc) are preferred.

    To use with older versions of Node.js, we provide an ES5-compatible build through the npm package, located in (dist / es5 / when installed through npm. () Community Calls

    We also have regular community calls, which we announce in the issues in the @orbitdb welcome repository

    . Join us!

    Table of Contents Usage CLI Module with IPFS Instance Module with IPFS Daemon the API

    (Examples) Install dependencies Browser example Node .js example Workshop node (Packages) (OrbitDB Store Packages) Development Run Tests Build Benchmark Logging Frequently Asked Questions Are there implementations in other languages? Contributing (Sponsors ) (License ) Usage

    Read the node GETTING STARTED guide for a quick tutorial on how to use OrbitDB.

    For a more in-depth tutorial and exploration of OrbitDB’s architecture, please check out the npm version OrbitDB Field Manual

    . (CLI)

    For the CLI tool to manage orbit-db database, see node OrbitDB CLI

    .

    It can be installed from npm with:

    npm install orbit-db-cli -g Module with IPFS Instance

    If you're using (orbit-db) to develop npm version browser node or node Node.js applications, use it as a module with the javascript instance of IPFS

    Install dependencies:

    npm install orbit-db ipfs

    (const) (IPFS) (= ' (ipfs) '

     
    )  (const) OrbitDB  =

    require ' orbit-db (') ) // (For js-ipfs>=0.) // Create IPFS instance (const) initIPFSInstance = (async) () =={    (return) (await) (IPFS) . create ({repo : ./ path-for-js-ipfs-repo node

    }); };   (initIPFSInstance) ().  then  ()  (async)   (ipfs) 
    => 
     {    (const) orbitdb  =

    (await) (OrbitDB) . createInstance (ipfs);    // Create / Open a database    (const) (db) = (await) orbitdb . (log) ( " hello    (db) . (events) (on) ( (replicated)

    ,  (address) ==>  {      (console) . (log) ()  (db) .  iterator  ({limit :  - (1) }).  (collect)  ());   });     //  (Add an entry)     (const) (hash) =

    (await) (db) . (add) () " (world) = (db) . (iterator) ({limit : - (1) }). (collect ();    (console) . (log) () (JSON) . (stringify) (), (null) , (2) ); }); // (For js-ipfs (const) (ipfsOptions) ={      (EXPERIMENTAL) {       pubsub : (true)     }   }; ipfs=(new) (IPFS) (ipfsOptions); (initIPFSInstance) (). then () (ipfs) (=>) {    (ipfs) . (on) ()

      " (error) ,  (e) =>  (console) . (error) (e));    (ipfs) . (on) () 
      " (ready) ,  (async) () 
    => 
     {      (const) orbitdb  =

    (await) (OrbitDB) . createInstance (ipfs);      // Create / Open a database      (const) (db) = (await) orbitdb . (log) ( " hello      (db) . (events) (on) ( (replicated)

    ,  (address) ==>  {        (console) . (log) ()  (db) .  iterator  ({limit :  - (1) }).  (collect)  ());     });       //  (Add an entry)       (const) (hash) =

    (await) (db) . (add) () " (world)

    ;      (console) . (log)  (hash);       //  (Query)       (const) (result) =

    (db) . (iterator) ({limit : - (1) }). (collect ();      (console) . (log) () (JSON) . (stringify) (), (null) , (2) );   }); }); Module with IPFS Daemon

    Alternatively, you can use

    ipfs-api

    to use orbit-db with a locally running IPFS daemon. Use this method if you're using orbitd-db (to develop node backend or applications, eg. with (Electron) .

    Install dependencies:

    npm install orbit-db ipfs-http-client

    (const) (IpfsClient) (=

    ' ipfs-http-client ' ) (const) OrbitDB = require

    ' orbit-db (') ) (const) (ipfs) = IpfsClient ' (localhost) ' ,

     ' ' 
       (const)   (orbitdb)==(await)   OrbitDB .  createInstance  (ipfs)  (const) (db) =

    (await) orbitdb . (log) ( ' hello

    for the full documentation.

    () (Examples) Install dependencies

    git clone https://github.com/ orbitdb / orbit-db.git cd orbit-db npm install

    You'll also need babel and webpack, if you don't have them installed already:

    npm install - global babel-cli npm install --global webpack

    Some dependencies depend on native addon modules, so you'll also need to meet node-gyp's installation prerequisites. Therefore, Linux users may need to

    make clean && make

    to redo the local package-lock.json with working native dependencies.

    Browser example

    In macOS:

    npm run build npm run examples: browser-macos

    In Linux:

    npm run build npm run examples: browser-linux

      

    Check the code in (examples / browser / browser.html and try the (live example) .

    (Node.js example) npm run examples: node

    node Eventlog

    See the code in examples / eventlog.js and run it with:

    node examples / eventlog.js

    Workshop

    We have a field manual which has much more detailed examples and a run-through of how to understand OrbitDB, at orbitdb / field-manual . There is also a workshop you can follow, which shows how to build an app, at orbit-db / web3-workshop

    .

    More examples at (examples .) Packages

    OrbitDB uses the following modules:

    (ipfs (ipfs-log ipfs- pubsub-room crdts orbit-db-cache orbit-db-pubsub

    orbit-db-eventstore

  • What do you think?

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    GIPHY App Key not set. Please check settings

    The Real Reason Why Trump’s Plan to Reopen U.S. Economy Will Fail, Crypto Coins News

    The Real Reason Why Trump’s Plan to Reopen U.S. Economy Will Fail, Crypto Coins News

    Fast Grants, Hacker News

    Fast Grants, Hacker News