Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this similar to orbitdb? #106

Closed
benzmuircroft opened this issue Nov 18, 2023 · 6 comments
Closed

Is this similar to orbitdb? #106

benzmuircroft opened this issue Nov 18, 2023 · 6 comments

Comments

@benzmuircroft
Copy link

benzmuircroft commented Nov 18, 2023

If it is can you show how to connect with libp2p

  • one peer to another
  • and pubsub

the orbitdb docs are a complete mess

  • can you show events
  • replication
  • messaging

thanks @tabcat

@tabcat
Copy link
Member

tabcat commented Nov 18, 2023

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
Copy link
Author

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
Copy link
Author

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

@tabcat
Copy link
Member

tabcat commented Nov 18, 2023

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
Copy link
Author

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

@saul-jb
Copy link
Contributor

saul-jb commented Nov 20, 2023

@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:

  • The bootstrap replicator won't work with the latest versions of Libp2p until chore!: update packages #107 goes through.
  • You need GossipSub and KadDHT modules added to Libp2p.
  • The nodes need to be discoverable via DHT.
  • The nodes need to be able to dial each other.

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))

@tabcat tabcat closed this as completed Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants