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

Add more examples #2684

Closed
1 of 7 tasks
dadepo opened this issue Jun 1, 2022 · 4 comments
Closed
1 of 7 tasks

Add more examples #2684

dadepo opened this issue Jun 1, 2022 · 4 comments

Comments

@dadepo
Copy link
Contributor

dadepo commented Jun 1, 2022

Description

I'll like to start contributing to rust-libp2p. A way I think I could use to get my feet wet is to add more examples of how to use rust-libp2p.

I am thinking of porting some of the examples in js-libp2p that are not present here and which I think are interesting enough.

Before I go ahead, I'll like to ask if this is a welcome contribution.

Specifically I am thinking of adding these examples:

  • auto-relay
  • echo
  • peer-and-content-routing
    • Bootstrap list of Peers when booting a node
    • Pubsub based Peer Discovery
  • discovery mechanisms

And those that is not in the js-libp2p examples but I think might be interesting

  • Identify protocol

Motivation

The examples helps makes onboarding to rust-libp2p easier.

Are you planning to do it yourself in a pull request?

Yes

@dadepo
Copy link
Contributor Author

dadepo commented Jun 1, 2022

Looked into how the Bootstrap list of Peers when booting a node would look like in rust-libp2p as this seems to be the simplest: connect to a provided list of peers.

I have not been able to find a direct way to have discovery via bootstrap peers. Looking through the existing examples, the only place where I see bootnodes used is in ipfs-kad.rs but this involves using a DHT and from what I understand from that example, it is adding the bootnodes into the kademlia DHT.

The js-libp2p example was able to just make use of the bootnodes, without kademlia. Any pointers on how to go about doing same in rust-libp2p?

I alsp checked the protocols here and I do not see any mention of bootnodes.

@thomaseizinger
Copy link
Contributor

I'll like to start contributing to rust-libp2p. [...] Before I go ahead, I'll like to ask if this is a welcome contribution.

Thank you and yes, definitely!

Some of the current examples also use slightly different styles. Aligning those is also something we've been meaning to do. I think @elenaf9 has some thoughts on this.

The js-libp2p example was able to just make use of the bootnodes, without kademlia. Any pointers on how to go about doing same in rust-libp2p?

I've had limited exposure to the other implementations but from what I know, rust-libp2p is structured fairly different. rust-libp2p itself does not differentiate between built-in p2p functionality like bootnodes and user-defined protocols like Kademlia. Everything uses the same abstraction: NetworkBehaviour.

At the moment, I don't think we support bootnodes as such but it would be fairly trivial to create a NetworkBehaviour whose only job it is to maintain connections to a specified set of nodes.

@mxinden
Copy link
Member

mxinden commented Jun 3, 2022

At the moment, I don't think we support bootnodes as such but it would be fairly trivial to create a NetworkBehaviour whose only job it is to maintain connections to a specified set of nodes.

As an aside, I would guess that most larger networks don't want all nodes to stay connected to the defined bootnodes. That doesn't scale. E.g. in IPFS nodes use the bootnodes for bootstrapping only.

@thomaseizinger
Copy link
Contributor

Let me know if you still want to contribute some new examples.

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