Menu

Tree [6c8c8b] main /
 History

HTTPS access


File Date Author Commit
 .github 2023-02-03 imotai imotai [694f75] Update labeler.yaml
 docs 2023-02-06 imotai imotai [8b0d82] add document template (#303)
 src 2023-02-06 imotai imotai [6c8c8b] add typescript dbid case (#304)
 thirdparty 2023-02-06 imotai imotai [8b0d82] add document template (#303)
 tools 2023-02-06 imotai imotai [8b0d82] add document template (#303)
 .gitignore 2022-12-29 imotai imotai [91b410] Feat/remove the generated code (#254)
 .gitmodules 2023-02-06 imotai imotai [8b0d82] add document template (#303)
 CHANGELOG.md 2022-10-31 imotai imotai [c7c37f] feat: add storage (#113)
 CODE_OF_CONDUCT.md 2022-04-30 imrtstore imrtstore [21c286] feat:config the cicd flow of rtstore (#4)
 CONTRIBUTING.md 2022-11-14 imotai imotai [048b60] add the details of technology implementaion (#143)
 Cargo.toml 2023-02-06 imotai imotai [8b0d82] add document template (#303)
 LICENSE 2022-03-25 imrtstore imrtstore [925fb1] Initial commit
 README.md 2023-02-06 imotai imotai [8b0d82] add document template (#303)
 README_zh_cn.md 2023-02-03 xutweety xutweety [0e3259] update readme grammer and picture (#293)
 clippy.toml 2022-10-31 imotai imotai [c7c37f] feat: add storage (#113)
 install_env.sh 2022-11-27 ljshwyykl ljshwyykl [538147] Update install_env.sh (#182)
 mkdocs.yml 2023-02-06 imotai imotai [8b0d82] add document template (#303)
 rustfmt.toml 2022-10-31 imotai imotai [c7c37f] feat: add storage (#113)

Read Me

A ⭐️ is welcome!

![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/dbpunk-labs/db3/ci.yml?branch=main&style=flat-square) ![coverage](https://img.shields.io/codecov/c/github/dbpunk-labs/db3?style=flat-square) ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/db3-teams/db3?style=flat-square) ![contribution](https://img.shields.io/github/contributors/dbpunk-labs/db3?style=flat-square) ![GitHub issues](https://img.shields.io/github/issues/db3-teams/db3?style=flat-square) [![GitHub issues by-label](https://img.shields.io/github/issues/dbpunk-labs/db3/good%20first%20issue?style=flat-square)](https://github.com/dbpunk-labs/db3/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/dbpunk-labs/db3?style=flat-square) [![Twitter Follow](https://img.shields.io/twitter/follow/Db3Network?style=flat-square)](https://twitter.com/Db3Network) [![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/dbpunk-labs/db3/badge)](https://www.gitpoap.io/gh/dbpunk-labs/db3) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/sz3bmZx2uh) **English | [中文](./README_zh_cn.md)** ## DB3 Network DB3 Network is an open-source and decentralized firebase firestore alternative for building fully decentralized dApps quickly with minimal engineering effort.

## Why DB3 Network ![why db3](./docs/images/why_db3.svg) Currently, there are two types of Data architecture for dApp(decentralized application): centralized vs. decentralized. **Centralized**: use [Firebase](https://firebase.google.com) or [MongoDB](https://github.com/mongodb/mongo)to 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](https://thegraph.com/en/) 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 change. **High Performance** Currently, decentralization means terrible performance, but DB3 is trying to improve it significantly: * [Merkdb](https://github.com/dbpunk-labs/db3/issues/100) 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](./docs/query.md), the first decentralized query protocol to resolve Performance and incentive perfectly. **Data Ownership** We proposed [the document level ownership](https://github.com/dbpunk-labs/db3/issues/271), 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 ### Build

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 * [x] Start db3 console
./target/debug/db3 console
db3>-$ new-db
database address                           | transaction id
--------------------------------------------+----------------------------------------------
0xa9f5c8170aad7a0f924d89c6edacae6db24ef57d | 0ALy/hH7CQe9lv294K6dOxGP14xWHsbRs+/pXBZa8oU=
* [x] Show database
db3>-$ show-db --addr 0x7e16cb6524e2fc21ae9bf2d7ee18b05767b9dc33
 database address                           | sender address                             | releated transactions                        | collections
--------------------------------------------+--------------------------------------------+----------------------------------------------+-------------
 0x7e16cb6524e2fc21ae9bf2d7ee18b05767b9dc33 | 0x96bdb8e20fbd831fcb37dde9f81930a82ab5436b | EMYw64xlI2q4v1MShoKw3T60asNbWJ9//ca75M3JO3Q= |
* [x] 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=
* [x] Show collections in database
db3>-$ show-collection --addr 0xcfb524677673af15edebbec018b16d42d87b1251
 name  | index
-------+----------------------------------------------------------------------------
 books | {"name":"idx1","fields":[{"field_path":"test1","value_mode":{"Order":1}}]}
* [x] Create a document
db3>-$ new-doc --addr 0x997f631fcafeed5ee319c83683ae16e64783602b --collection-name books --documents '{"name": "John Doe","age": 43,"phones": ["+44 1234567","+44 2345678"]}'
send add document done with tx
+O9cK2cHLexZQvIITk4OTm8SxBhq7Yz7g+xZYiionWo=
* [ ] 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](https://github.com/dbpunk-labs/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](https://dev.to/), [Medium](https://medium.com/) or your personal blog. Together, we can make db3 network better! # The internal of db3 ![relationship](./docs/images/db3-overview.svg) # The Architecture ![arch](./docs/images/db3-architecture.svg) # How it works * [mutation](./docs/mutation.md) * [query session](./docs/query.md) * [dvm](./docs/dvm.md) * [merkdb](https://github.com/dbpunk-labs/db3/issues/100) # Other Decentralized Database * [the graph](https://github.com/graphprotocol/graph-node), a decentralized on-chain indexer * [Locutus](https://github.com/freenet/locutus), a decentralized key-value database * [ceramic network](https://github.com/ceramicnetwork/ceramic), a decentralized data network that brings unlimited data composability to Web3 applications * [kwil](https://github.com/kwilteam), the first permissionless SQL database for the decentralized internet * [spaceandtime](https://www.spaceandtime.io/), a decentralized data Warehouse * [OrbitDB](https://github.com/orbitdb/orbit-db) 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](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](CONTRIBUTING.md).
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.