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

50 Views Asked by At

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 ipfs, orbitdb

async function go() {
  const IPFS = await import('ipfs-core')
  const { createOrbitDB, IPFSAccessController } = await import('@orbitdb/core')
  ipfs = await IPFS.create()
  orbitdb = await createOrbitDB({ ipfs })
  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.

0

There are 0 best solutions below