DEV Community

Cover image for When you plan to build a dApp, you need DB3 Network
xutweety for DB3 Network

Posted on

When you plan to build a dApp, you need DB3 Network

The Background

Ethereum has defined the novel dapp data architecture successfully.

Image description

The novel dapp data architecture has the following improvement:

  • immutable, when the protocol has been deployed, all the codes are immutable

  • transparent, the smart contract can be verified by anyone and any organization

  • Permissionless, everyone can use the protocol in the world
    but Ethereum has some limitations e.g. scalability problems and high storage cost and it can not cover the requirement of the storage-heavy dapps. So a hybrid data architecture so called web2.5 is used for the storage-heavy dapps.

Image description

The problem in the above is the hybrid data architecture will break the improvement that the web3 native application data architecture brings to us and the db3 network is trying to resolve the problem

Image description

What’s the DB3 Network

Image description

DB3 is a community-driven layer2 decentralized database network with the following core features:

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.

Blazed Fast and Provable On-chain Query

Currently, decentralization means bad performance but db3 is trying to make a big improvement in performance. Merkdb 2 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

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

On-chain Programmable

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

Ethereum Guarded Security

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

db3.js-Developer-friendly SDK

db3.js is the db3 network 2 javascript API and you can write and query JSON documents against the db3 network with db3.js and you can combine the web3.js and db3.js to build a fully decentralized storage-heavy application. the web3 developers can use this API to put and get documents with the db3 miner node directly.

Image description

request.onsuccess = function () {
  console.log("Database opened successfully");
  const db = request.result;
  // 1
  const transaction = db.transaction("cars", "readwrite");
  //2
  const store = transaction.objectStore("cars");
  const colourIndex = store.index("cars_colour");
  const makeModelIndex = store.index("colour_and_make");
  //3
  store.put({ id: 1, colour: "Red", make: "Toyota" });
  store.put({ id: 2, colour: "Red", make: "Kia" });
  store.put({ id: 3, colour: "Blue", make: "Honda" });
  store.put({ id: 4, colour: "Silver", make: "Subaru" });
  //4
  const idQuery = store.get(4);
  const colourQuery = colourIndex.getAll(["Red"]);
  const colourMakeQuery = makeModelIndex.get(["Blue", "Honda"]);
  // 5
  idQuery.onsuccess = function () {
    console.log('idQuery', idQuery.result);
  };
  colourQuery.onsuccess = function () {
    console.log('colourQuery', colourQuery.result);
  };
  colourMakeQuery.onsuccess = function () {
    console.log('colourMakeQuery', colourMakeQuery.result);
  };
  // 6
  transaction.oncomplete = function () {
    db.close();
  };
};
Enter fullscreen mode Exit fullscreen mode

The overview of db3 network architecture

Image description

Why does DB3 Network focus on the storage-heavy dapps

image

Image description

The more dynamic data the dapp used , the more users that the dapp will onboard.So we think the storage-heavy dapps are the future of web3

Other Decentralized Databases

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

if you are interested in the db3 network, please give us a star on GitHub

Top comments (0)