hldb / welo

peer-to-peer, collaborative states using Merkle-CRDTs
Other
32 stars 2 forks source link

Is this similar to orbitdb? #106

Closed benzmuircroft closed 9 months ago

benzmuircroft commented 9 months ago

If it is can you show how to connect with libp2p

the orbitdb docs are a complete mess

thanks @tabcat

tabcat commented 9 months ago

Welo is a fork/rewrite of OrbitDB, it is very similar although this will likely be less true in the future.

The hardest part of using both libraries has always been connecting nodes together so they can replicate... also I need to add debug/error logs.

These are libp2p issues so i recommend checking their examples (they used to have more, not sure where they went), but another place that might help are the replication tests and test utils in welo.

benzmuircroft commented 9 months ago

I can't understand the tests. All examples of the web for all of this ipfs stack are ether old or missing. there is no full examples. I have about 70 tabs open

benzmuircroft commented 9 months ago

Why would you create a project, then leave out examples of what it does??

tabcat commented 9 months ago

I am one person doing this and I work on it in my free time atm.

Why would you create a project, then leave out examples of what it does??

here is an example: https://github.com/hldb/todomvc I'll add it to the readme

I can't understand the tests

If you cannot understand the tests then I don't know how you plan to understand any other typescript code.

I'll tell you whats needed for replication

welo nodes need to be handed a helia instance where: 1) the libp2p nodes are gossipsub peered 2) helia is able to retrieve content from peer

if you need docs, come back later, sorry!

benzmuircroft commented 9 months ago

yeah, you are correct! I need normal javascript docs not typescript (ts makes me go cross eyed) 😂

saul-jb commented 9 months ago

@benzmuircroft Replication becomes much easier if you use the new replicators:

import { createWelo, pubsubReplicator, bootstrapReplicator } from "welo";

const welo = await createWelo({
    ipfs: helia,
    replicators: [bootstrapReplicator(), pubsubReplicator()]
});

Bootstrap handles initial replication and the pubsub handles updates after the fact.

A few caveats here:

Those last 3 points are covered in Libp2p examples.

The Usage section in the readme covers most of the setup, all that is missing is how to fetch a existing manifest:

import { Address } from "welo";

// Replace with database.address.toString()
const address = "/hldb/bafyreidot66zv6eq25crosptxshl6gm4axx2vzds2xsbumok6az5x7r4uq";

const manifest = welo.fetch(Address.fromString(address))