is not allowed to write to the log (even after deleting the orbitdb dir)
benzmuircroft opened this issue · comments
let db = {}
let net ={
u: '/orbitdb/xxxxxxxx' // changed from real id auto created earlier by orbitdb
}
db.u = await orbitdb.open(net.u, {
type: 'keyvalue',
AccessController: IPFSAccessController({ write: ['*'] })
})
const hash = await db.u.put('benz', { name: 'benz', pass: 'xxx' }) // Key "yyyyyyyyyyyyyyyyyyyy" is not allowed to write to the log
db.u.drop() // has no effect
I even manually deleted my orbitdb folder
does write ['*'] mean nothing? I should be able to write and delete in my own db I just don't see what is wrong.
If I run the same code on another ubuntu machine then it times out at opening the db here: db.u = await orbitdb.open(net.u, {
im running node v20.9.0 on both machines and the are both ubuntu but they are both being weird with the same code on both!
machine A) opens the db but does not allow the user who created it to write to it
machine B) does not open it, hangs and times out with UnhandledPromiseRejectionWarning
I even delete the orbitdb and node_modules folders for the project and re-ran npm install
- probably you ran your db twice and second time you can not write. This is if your identity is another one then the first time. But since it is writable to all it, it should actually write. Check https://github.com/orbitdb/orbitdb/blob/main/test/orbitdb-write-access.test.js
- if you want to replicate with another machine, you first have to connect / dial a multi address.
- there are replication tests and other tests in the directory. In case they work for you, it should be possible to adapt for a nodejs or browser app
- if you have a repo, I could have a look...
Imho, replication should work without manually connecting peers, afaik OrbitDB already connects them via libp2p pubsub. You can check this by having a look at the p2plib peers. You can also ping the peers with libp2p ping function.
databases only replicate, if both db's identities have write permission.
I don't have a repo. I'm just on the 2 computers. I think what I did was first run I created the db without write: ['*']
an so on next run i could not write. how do I just start again?
if you want to replicate with another machine, you first have to connect / dial a multi address
Is there an example? I am pretty overwhelmed with the way the docs are all over the place and some of it is outdated. I literally have a million tabs open and a tone of notes and snippets collected
I would like to just delete that db and start again
You can just create a new db. As soon as you have a new address, you can forget about the old one.
I am more focused on the browser-to-browser (local first) and not so much on the replication between orbitdb's (js-ipfs) nodes. But what helped me last year (it's an even older version) was https://github.com/orbitdb/web3-workshop.
I don't know if that would still work, but it explains everything step by step. I am not sure if it does the replication correctly right now since the browser peers need to be connected via an WebRTC star node.
In my opinion, right now, the older versions are not worth looking at anymore since js-ipfs became Helia and OrbitDB is getting ported to Helia. (see helia branch) Helia is more or less "everything" different and re-written. And so is the helia branch of OrbitDB too.
In order to understand everything better, I had to step back and focus on the basics of libp2p and Helia first.This is what I am doing right now. I am currently writing my own examples (for Svelte) to understand everything better. I start with libp2p!
You can check this out for example: https://github.com/libp2p/universal-connectivity
thanks for your help,
About the Orbitdb helia; that's what I want to use but it said that it's not ready or at least If I did find the helia repo it looks the same like it's not ready there ether!?!?
NOTE! js-ipfs and related packages are now superseded by IPFS's Helia project and are no longer being maintained. As part of this migration, OrbitDB will be soon switching to Helia.
that link (switching to Helia) just takes me to https://github.com/ipfs/helia
I'm not sure where to go to use the helia version of orbit
Also: universal-connectivity does not show how to use orbit with it. I think your team needs to delete all of the old code because it is incredibly crazy to navigate though and find out what to look at. Plus I know it's all modular but, I need tutorials on putting it all together.
you can add orbitdb helia to your project like so:
npm install "https://github.com/orbitdb/orbitdb.git#helia"
(that's how I am doing it)
ok,
the usage section shows it using ipfs-core though!?
yes, this seems outdated:
see:
The version 1.0 release of OrbitDB uses js-ipfs. The reason for this has been well documented. OrbitDB is moving to Helia but without funding the project relies on volunteers. The OrbitDB Helia upgrade has also been well documented.
If your issues are related to IPFS and Helia. I would recommend directing questions to the Helia and libp2p projects especially if you are having explicit issues with them (bugs, config issues, etc).
Lastly, Libp2p, Helia and js-ipfs are new technologies solving a very complex problem. Therefore, a good understanding of those projects is required in order to use OrbitDB to its full capacity. There is, however, a quick way to become familiar with P2P integrations using OrbitDB and js-ipfs/Helia. You can leverage the extensive number of unit tests that are bundled with OrbitDB. I would recommend using these as a first step.
I suggest starting here. If you can get this working, expand the examples using this. If you are still experiencing issues due to a limitation or bug within OrbitDB please feel free to re-open this issue or start a new one.