Skip to content
/ db3 Public
forked from dbpunk-labs/db3

DB3 is a community-driven layer2 decentralized database network.

License

Notifications You must be signed in to change notification settings

omahs/db3

 
 

Repository files navigation

db3_logo

GitHub Workflow Status (with event) coverage GitHub commit activity contribution GitHub issues GitHub issues by-label GitHub release (latest SemVer) Twitter Follow Discord

What's DB3 Network?

DB3 is a community-driven layer2 decentralized database network.

  1. Infinite Storage Space

    Scalability is the key to the web3 explosion, db3 will use the following strategies to achieve web3 scale

    • PC can meet the minimum system requirements so everyone can join the db3 network to provide storage space.
    • Using dynamic sharding to achieve scale out. when a storage shard chain has not enough space to store mutation, it will split itself into two subchains.
    • Using cold data archive to recycle storage space. history cold blocks and cold state data will be archived to FileCoin and the storage node will always has storage space to store new data.
  2. Blazed Fast and Provable On-chain Query

    Currently, decentralization means bad performance but db3 is trying to make a big improvement in performance

    • Merkdb is the storage engine of db3 network and it not only has high performance but also the fast-proof generation

    • Geo distribution, the nodes in every storage shard are geo-distributed and the clients can execute querys against the nearest storage node

    • Query session, the first decentralized query protocol to resolve performance and incentive perfectly

  3. Crypto Native Data Ownership

    In the decentralized network, only the private key owners can update their data and they can keep privacy by encrypting their data with the public key

  4. On-chain Programmable

    Dapp developers can develop data processing contracts and deploy them to the db3 network just like developing data backend in web2

  5. Ethereum Guarded Security

    DB3 network is a layer2 network on Ethereum and all the assets are guarded by Ethereum

If you want to know what these features exactly mean? go to the background introduction

Getting Started

Start A Local Testnet

git clone https://github.com/dbpunk-labs/db3.git
cd db3 && bash install_env.sh && cargo build
# start localnet
cd tools &&  sh start_localnet.sh
# open another terminal , enter db3 dir and run db3 shell
./target/debug/db3 shell
>get ns1 k1
>put ns1 k1 v1
submit mutation to mempool done!
>get ns1 k1
k1 -> v1
>account
 total bills  | storage used | mutation | querys | credits
 0.000000 db3 | 38.00        | 2        | 0      | 10 db3

Developers Friendly SDK

// connect to db3 node
const db3_instance = new DB3("https://127.0.0.1:26659");
const doc_store = new DocStore(db3_instance);
const doc_index = {
    keys: [
        {
            name: 'address',
            keyType: DocKeyType.STRING,
        },
        {
            name: 'ts',
            keyType: DocKeyType.NUMBER,
        },
    ],
    ns: 'ns1',
    docName: 'transaction',
};
const transacion = {
    address: '0x11111',
    ts: 9527,
    amount: 10,
};
// insert a document
const result = await doc_store.insertDocs(doc_index, [transacion], _sign, 1);
// query a document
const query = {
    address: '0x11111',
    ts: 9527,
};
const docs = await doc_store.getDocs(doc_index, [query], _sign);

more examples

The Relationship Between Roles

relationship

The Architecture

arch

more technical details

Other Decentralized Database

  • the graph, a decentralized on-chain indexer
  • Locutus, a decentralized key-value database
  • ceramic network, a decentralized data network that brings unlimited data composability to Web3 applications
  • kwil, the first permissionless SQL database for the decentralized internet
  • spaceandtime, a decentralized data Warehouse

License

Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. See CONTRIBUTING.md.

About

DB3 is a community-driven layer2 decentralized database network.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 94.0%
  • Java 5.1%
  • Shell 0.9%