Skip to content

Instantly share code, notes, and snippets.

/* Sketch of how muport identities could be used in OrbitDB */
const identitySignerFn = async (id, data) => {
// One can check here too that identity-to-be-signed is actually
// the same muport identity
if (id !== muport.getDid()) throw new Error("Trying to sign with a different identity!")
return await muport.sign(data)
}
const identityVerifierFn = async (identity) => {

Dynamic content in distributed applications

30mins

Description

At the heart of every application is a database. In the decentralized web, the peer-to-peer paradigm doesn't use servers, so how can we develop compelling applications and user experiences? This talk will demonstrate orbit-db, a distributed peer-to-peer database built on IPFS. We'll show how we can create traditional data models, such as a key-value store, in a distributed fashion and create applications without servers. We'll cover the underlying data structures and transport mechanisms provided by IPFS, take a look at CRDTs (Conflict-free Replicated Data Types) and show how they can be leveraged to create different types of databases. Using IPFS and orbit-db, we'll show examples of how to build news feeds, real-time chat and comment systems in distributed applications that can run purely in the browser.

Additional resources

orbit-db

orbit-db is a distributed, peer-to-peer database built on IPFS. By saving all data in IPFS and

'use strict'
const path = require('path')
const AccessController = require('./access-controller')
class OrbitDBAccessController extends AccessController {
constructor (orbitdb) {
super()
this._orbitdb = orbitdb
this._db = null
<!DOCTYPE html>
<html>
<head>
<title>Hello, WebVR! - A-Frame</title>
<meta name="description" content="Hello, WebVR! - A-Frame">
<script type="text/javascript" src="lib/aframe.min.js" charset="utf-8"></script>
<script type="text/javascript" src="lib/orbitdb.min.js" charset="utf-8"></script>
<script type="text/javascript" src="lib/ipfs-browser-daemon.min.js" charset="utf-8"></script>
</head>
<body>
/* Components for Orbit */
'use strict'
const styles = {
layout: {
flex: {
display: 'flex',
},
row: {
@haadcode
haadcode / pubsub.js
Last active November 24, 2016 06:28
'use strict'
const PubsubMessageStream = require('ipfs-pubsub-message-stream')
class Pubsub {
constructor (send: Function) {
this._subscriptions = {}
this._send = send
}
fs.init(1 * 1024 * 1024, (err) => {
if(err) {
logger.error("Couldn't initialize file system:", err)
} else {
logger.debug("FileSystem initialized")
}
})

clients

  • orbit-electron
  • orbit-textui (--> orbit-terminal?)

core

  • orbit-core (orbit_)
    • orbit-crypto
    • orbit-db
      • orbit-db-store
  • ipfs-log
'use strict';
// const ipfsd = require('ipfsd-ctl');
const IPFS = require('ipfs')
const ipfsd = require('ipfsd-ctl');
const OrbitDB = require('../src/OrbitDB');
const Timer = require('./Timer');
// usage: benchmark.js <network hash> <username> <channel>;