Blockchain decentralized distributed web peer database: orbitdb

Jiedao jdon 2021-04-30 02:53:03 阅读数:29

blockchain decentralized distributed web peer

OrbitDB It's a server less distributed peer-to-peer database .OrbitDB Use IPFS As its data store , And use IPFS Pubsub Automatically synchronize the database with peers . It's the ultimate consistent database , Use CRDT Do a conflict free database merge , send OrbitDB Become a decentralized application (dApps)、 Blockchain applications and offline priority Web Great choice for apps .

Can be found in this 《 Getting started 》 in Read about how to Information about getting started .

OrbitDB It's a peer-to-peer database , This means that each peer has its own specific database instance . Automatically replicate databases between peers , This results in an up-to-date view of the database when updates are made from any peer . in other words , The database is pulled to the client .

This means that each application contains the full database they are using . With clients / Server model , This in turn changes the data model , On the client / In the server model , Usually all entries have a large database : stay OrbitDB in , The data should be stored according to the access rights of the data ,“ Partition ” or “ Fragmentation ”. for example , Similar to Twitter In the ,tweet It won't be saved in a global file written by millions of users at the same time “ tweets” In the database , It's that every user has their own tweet database . To focus on users , The peer will subscribe to the user's contribution , That is, copy its feed database .

OrbitDB and IPFS Can be in Node.js Applications and browser applications .


from npm install orbit-db and ipfs

npm install orbit-db ipfs

It is required in the program OrbitDB and IPFS And create an instance :

const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')
async function main () {
  // Create IPFS instance
  const ipfsOptions = { repo : './ipfs', }
  const ipfs = await IPFS.create(ipfsOptions)
  // Create OrbitDB instance
  const orbitdb = await OrbitDB.createInstance(ipfs)

orbitdb  Now we can use it to interact with the database OrbitDB example .

See more :Github Information about getting started


版权声明:本文为[Jiedao jdon]所创,转载请带上原文链接,感谢。