orbitdb / orbitdb

Peer-to-Peer Databases for the Decentralized Web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

db.address wont open and opening a new db gives me the same address

benzmuircroft opened this issue · comments

I've tried this on normal orbitdb and on the new one with helia and it happens on both.

What I'm Attempting: To initially create a db. get the address. use the db.address as a string to reconnect to the existing db

If i create my db

db.u = await orbitdb.open('u', {
    type: 'keyvalue',
    AccessController: IPFSAccessController({ write: ['*'] })
  })
console.log(db.u.address)

then store db.u.address in my variable net.u

then update db.u = await orbitdb.open(net.u, { my app hangs here.

full code:

let net = {
  u: '/orbitdb/zdpuAqhiS4ZdYjiwK8EV5EsuXDz59EgyxwsGQ26DN3jujmXGW'
}
let db = {}
let helia, orbitdb

async function go() {
  const HELIA = await import('helia')
  const { createOrbitDB, IPFSAccessController } = await import('@chris.troutner/orbitdb-helia')
  helia = await HELIA.createHelia()
  orbitdb = await createOrbitDB({ ipfs: helia })
  console.log(orbitdb.identity.id)
  db.u = await orbitdb.open(net.u, { // hangs here
    type: 'keyvalue',
    AccessController: IPFSAccessController({ write: ['*'] })
  })
  console.log(db.u.address)
}

If I generate a new db called 'u' it gets the same key /orbitdb/zdpuAqhiS4ZdYjiwK8EV5EsuXDz59EgyxwsGQ26DN3jujmXGW every time. I don't understand what I'm to do.

const { createOrbitDB, IPFSAccessController } = await import('@chris.troutner/orbitdb-helia')

This is not the official @orbitdb/core package. You will need to ask the maintainer of the above package.

Closing but please reopen if you have an issue running the official @orbitdb/core package.