P2P database: OrbitDB

Hello, everyone

I’m new to IPFS & I read about orbitdb and it seems a really nice idea.
Is there any similar solution to build a P2P DB on top of IPFS?

Cheers ^^

1 Like

OrbitDB is built on IPFS. Are you just looking for alternatives? If so, you can try the y-ipfs-connector library used by peerpad:

Thanks for your reply. Very helpful ^^

I’m also very interested in this topic in general, and been following OrbitDB recently.

Yeah, OrbitDB is very promising

The stuff in ipfs-shipyard, and especially y-jS-connector have gotten much more work recently. They have a cleaner implementation of CRDTs on a more mature version of ipfs pubsub. Check out the blog posts on https://ipfs.io/blog about pubsub and CRDTs. Also watch for new blog posts and tutorials soon.

Thanks @flyingzumwalt it’s much helpful.

hi @flyingzumwalt, thanks for referring to the yjs connector, I am currently playing around with it, super cool stuff, but do not fully understand it’s CRDT merging logic. I found the following notion on GitHub - y-js/y-array: Array type for Yjs

If two users insert something at the same position concurrently, the content that was inserted by the user with the higher user-id will be to the right of the other content. In the OT world we often speak of intention preservation, which is very loosely defined in most cases. This type has the following notion of intention preservation: When a user inserts content c after a set of content C_left, and before a set of content C_right, then C_left will be always to the left of c, and C_right will be always to the right of c. Since content is only marked as deleted (until all conflicts are resolved), this notion of intention preservation is very strong.

If both users performed a transformation on the same position of the same state, how can the intention be preserved for both if one “overrides” the other? I am new to this topic so I hope somebody can help me with some pointers to better understand the topic of OT and CRDTs.

Thanks so much!!!

@JamesC You may be interested in this video of a talk by Martin Kleppman which gives a very clear introduction to CRDTs for use in a collaborative text editor.

If I understand correctly, the answer to your question is there has to be some consistent way of resolving the conflict, and that’s what a CRDT is providing. (“Consistent” here means that when both users independently apply the conflict-resolution procedure, they both end up with the same document.) It is obviously logically impossible for two concurrent inserts at the same position to occupy the same space, so something has to give.

1 Like

@leavehouse this is the best video i have seen on CRDTs > thanks a lot for that, really pushed my understanding forward :slight_smile:

Hi everyone!

Original author of OrbitDB here. Thanks for the interest and discussion so far!

We just released a new version after months of hiatus, bringing a lot of stability, performance and new features to OrbitDB. The main new, big feature is the write-permissions. See the updated repo at https://github.com/orbitdb/orbit-db and the Changelog for v0.18.0 for more information.

We also added a brand new Getting Started Guide that should answer many of your questions. As for the underlying CRDT that OrbitDB uses, see ipfs-log (append-only log CRDT) or the Counter database’s G-Counter CRDT. The first is a operation-based and the second one is state-based.

To get an idea “how it looks in an app”, you can check the TodoMVC Example or the “browser demo” (source code).

OrbitDB doesn’t currently have a collaborative text-editor CRDT, so you’re better off with Peerpad for that. That said, we’d love to have a text-editing CRDT in there and it should be straight-forward to integrate, so if anyone’s interested to implement it, I’d be more than happy to help!

If you have any questions, feedback, suggestions or problem, would highly appreciate reporting them in https://github.com/orbitdb/orbit-db/issues :heart:

3 Likes

Hello, @haad
Congratulations !!!

Love to see all the amazing improvements. Thanks so much ^^