在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:orbitdb/orbit-db开源软件地址:https://github.com/orbitdb/orbit-db开源编程语言:JavaScript 94.2%开源软件介绍:OrbitDBOrbitDB is a serverless, distributed, peer-to-peer database. OrbitDB uses IPFS as its data storage and IPFS Pubsub to automatically sync databases with peers. It's an eventually consistent database that uses CRDTs for conflict-free database merges making OrbitDB an excellent choice for decentralized apps (dApps), blockchain applications and local-first web applications. Test it live at Live demo 1, Live demo 2, or P2P TodoMVC app! OrbitDB provides various types of databases for different data models and use cases:
All databases are implemented on top of ipfs-log, an immutable, operation-based conflict-free replicated data structure (CRDT) for distributed systems. If none of the OrbitDB database types match your needs and/or you need case-specific functionality, you can easily implement and use a custom database store of your own. Project status & support
NOTE! OrbitDB is alpha-stage software. It means OrbitDB hasn't been security audited and programming APIs and data formats can still change. We encourage you to reach out to the maintainers if you plan to use OrbitDB in mission critical systems. This is the Javascript implementation and it works both in Browsers and Node.js with support for Linux, OS X, and Windows. Node version 16 is supported. To use with older versions of Node.js, we provide an ES5-compatible build through the npm package, located in Table of ContentsUsageRead the GETTING STARTED guide for a quick tutorial on how to use OrbitDB. For a more in-depth tutorial and exploration of OrbitDB's architecture, please check out the OrbitDB Field Manual. Database browser UIOrbitDB databases can easily be managed using a web UI, see OrbitDB Control Center. Install and run it locally:
Module with IPFS InstanceIf you're using Install dependencies:
const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')
;(async function () {
const ipfs = await IPFS.create()
const orbitdb = await OrbitDB.createInstance(ipfs)
// Create / Open a database
const db = await orbitdb.log("hello")
await db.load()
// Listen for updates from peers
db.events.on("replicated", address => {
console.log(db.iterator({ limit: -1 }).collect())
})
// Add an entry
const hash = await db.add("world")
console.log(hash)
// Query
const result = db.iterator({ limit: -1 }).collect()
console.log(JSON.stringify(result, null, 2))
})() Module with IPFS DaemonAlternatively, you can use ipfs-http-client to use Install dependencies:
const IpfsClient = require('ipfs-http-client')
const OrbitDB = require('orbit-db')
const ipfs = IpfsClient('localhost', '5001')
const orbitdb = await OrbitDB.createInstance(ipfs)
const db = await orbitdb.log('hello')
// Do something with your db.
// Of course, you may want to wrap these in an async function. APISee API.md for the full documentation. ExamplesInstall dependencies
Some dependencies depend on native addon modules, so you'll also need to meet node-gyp's installation prerequisites. Therefore, Linux users may need to
to redo the local package-lock.json with working native dependencies. Browser example
Using Webpack:
Check the code in examples/browser/browser.html and try the live example. Node.js example
Eventlog See the code in examples/eventlog.js and run it with:
WorkshopWe have a field manual which has much more detailed examples and a run-through of how to understand OrbitDB, at orbitdb/field-manual. There is also a workshop you can follow, which shows how to build an app, at orbit-db/web3-workshop. More examples at examples. PackagesOrbitDB uses the following modules:
OrbitDB Store Packages
Community-maintained Typescript typings are available here: https://github.com/orbitdb/orbit-db-types DevelopmentRun Tests
Build
Benchmark
See benchmarks/ for more benchmarks. LoggingTo enable OrbitDB's logging output, set a global ENV variable called
Frequently Asked QuestionsWe have an FAQ! Go take a look at it. If a question isn't there, open an issue and suggest adding it. We can work on the best answer together. Are there implementations in other languages?Yes! Take a look at these implementations:
The best place to find out what is out there and what is being actively worked on is likely by asking in the Matrix. If you know of any other repos that ought to be included in this section, please open a PR and add them. ContributingTake a look at our organization-wide Contributing Guide. You'll find most of your questions answered there. Some questions may be answered in the FAQ, as well. If you want to code but don't know where to start, check out the issues labelled "help wanted". SponsorsThe development of OrbitDB has been sponsored by: If you want to sponsor developers to work on OrbitDB, please reach out to @haadcode. LicenseMIT © 2015-2019 Protocol Labs Inc., Haja Networks Oy |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论