8000 GitHub - xuman2019/db3: DB3:Decentralized Firebase Firestore Alternative. Please star ⭐️
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

xuman2019/db3

 
 

Repository files navigation

A ⭐️ is welcome!

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

English | 中文

What's DB3 Network?

DB3 Network is an open-source, decentralized firebase firestore alternative to build dApps quickly with minimal engineering effort.

Why DB3 Network

why db3

Currently, there are two types of Data architecture for dApp(decentralized application): centralized vs. decentralized.

Centralized: use Firebase or MongoDBto store the data), both of which are developer-friendly. However, dApps would be regarded as less secure based on a central database.

Decentralized: use Ethereum or other blockchains to store the data and use the Graph to index data from it. The separation of the storage and the indexer would cost a lot of engineering efforts in future development.

With Db3 network, you can get both advantages of the above two choices.

Features

Schemaless

You can store data on DB3 Network without any changes.

High Performance

Currently, decentralization means terrible performance, but DB3 is trying to improve it significantly:

  • Merkdb is the storage engine of the DB3 Network, and it has high Performance and fast-proof generation.
  • Geo distribution: the nodes in every storage shard are geo-distributed, and the clients can execute queries against the nearest storage node.
  • Query session, the first decentralized query protocol to resolve Performance and incentive perfectly.

Data Ownership

We proposed the document level ownership, and every document has its owner, while only the owner holds the private key can update/delete the record. DB3 network generates the proofs and provides signatures to prove the membership (db3 has the specific document) and ownership.

Programmable

Dapp developers can develop data processing contracts and deploy them to the DB3 Network, just like the data backend in web2.

Ethereum Guarded Security

DB3 Network is a layer2 network on Ethereum and Ethereum guards all the assets.

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

Use Console

  • Start db3 console
./target/debug/db3 console
db3>-$ new-db
database address                           | transaction id
--------------------------------------------+----------------------------------------------
0xa9f5c8170aad7a0f924d89c6edacae6db24ef57d | 0ALy/hH7CQe9lv294K6dOxGP14xWHsbRs+/pXBZa8oU=
  • Show database
db3>-$ show-db --addr 0x7e16cb6524e2fc21ae9bf2d7ee18b05767b9dc33
 database address                           | sender address                             | releated transactions                        | collections
--------------------------------------------+--------------------------------------------+----------------------------------------------+-------------
 0x7e16cb6524e2fc21ae9bf2d7ee18b05767b9dc33 | 0x96bdb8e20fbd831fcb37dde9f81930a82ab5436b | EMYw64xlI2q4v1MShoKw3T60asNbWJ9//ca75M3JO3Q= |
  • Add a collection to database
db3>$ new-collection --addr 0xcfb524677673af15edebbec018b16d42d87b1251 --name books --index '{"name":"idx1","fields":[{"field_path":"test1","value_mode":{"Order":1}}]}'
send add collection done with tx
3V7r7VRg+9zUXeGNmqRR0YdVXWtBSl4sk+Z50h9BrOc=
  • Show collections in database
db3>-$ show-collection --addr 0xcfb524677673af15edebbec018b16d42d87b1251
 name  | index
-------+----------------------------------------------------------------------------
 books | {"name":"idx1","fields":[{"field_path":"test1","value_mode":{"Order":1}}]}
  • create a document
  • get a document
  • list documents
  • query documents by index

Build a dapp with db3.js

/*
|----------------------------|
| use db3js open a database  |
|----------------------------|
*/

// build sign function
const sign = await getSign()

// build database factory
const dbFactory = new DB3Factory({
    node: 'http://127.0.0.1:26659',
    sign,
    nonce
})

// open database with an address
const db = dbFactory.open("0x5ca8d43c15fb366d80e221d11a34894eb0975da6")

for more please go to db3.js

Project assistance

  • Add a GitHub Star⭐️ to the project.
  • Tweet about how to use DB3 network.
  • Write blogs about the project on Dev.to, Medium or your personal blog.

Together, we can make db3 network better!

The internal of db3

relationship

The Architecture

arch

How it works

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
  • OrbitDB is a serverless, distributed, peer-to-peer database

Thanks support

I stood on the shoulders of giants and did only simple things. Thank you for your attention.


Protocol Labs

Filecoin

License

Apache License, Version 2.0 (LICENSE-APACHE or http://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:Decentralized Firebase Firestore Alternative. Please star ⭐️

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.3%
  • Shell 0.7%
0