Skip to content

Instantly share code, notes, and snippets.

@shamb0t
Created September 5, 2018 07:03
Show Gist options
  • Save shamb0t/5ca98a24dae3568a5ba8802feabf9147 to your computer and use it in GitHub Desktop.
Save shamb0t/5ca98a24dae3568a5ba8802feabf9147 to your computer and use it in GitHub Desktop.
const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')
const ipfsOptions = {
repo: 'PATH/TO/YOUR/IPFS/REPO/HERE',
EXPERIMENTAL: {
pubsub: true
}
}
// Create IPFS instance
const ipfs = new IPFS(ipfsOptions)
ipfs.on('ready', () => {
// Create OrbitDB instance
const orbitdb = new OrbitDB(ipfs)
})
@berre74
Copy link

berre74 commented Sep 14, 2018

Thanks again for your help, It worked like a charm, but ended up by doing like this (could you tell me if there's a good reason as why NOT to do this?) I found out, it gives me more flexibility in my architecture, and more stability:

  1. starting the IPFS process seperately (localhost:5001)
  2. connect OrbitDb with the ipfs-api:
    const IPFSAPI = require('ipfs-api')
    const OrbitDB = require('orbit-db')
    const ipfs = IPFSAPI('localhost', 5001)
    const orbitdb = new OrbitDB(ipfs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment