6

I'm working on my first P2P app using C# core and gRPC and I'm finding it difficult to understand the concepts of how nodes find each other and build a routing table.

For my design I'd like to only have nodes and no listener/directory/discovery servers.

I'll have a list of a few "known nodes" that can start off the chain of finding and connecting to peers but can't figure out a workflow for it.

Questions:

1) How are ID's assigned to each node?

2) How does peer discovery work?

- Known node is running and is the only node on the network.
- New node connects to known node and requests full peer list?
- Connect to each peer on the list?

3) Since each node is a client and a server, does there needs to be 2 connections between each node?

user3953989
  • 218
  • 1
  • 7

1 Answers1

4

You have to know someone to get in the club.

When you download p2p software it has a list of known stable peers. So long as one of them is up it'll give you the latest list of peers. Baring that you can always start your own p2p network by distributing a connection string to your friends.

There's plenty of complexity you can add to that to load balance and such but this is essentially how peers find peers. The software jump starts it and after that it's word of mouth.

Well, unless you go around port scanning. But that's a bit rude.

candied_orange
  • 102,279
  • 24
  • 197
  • 315
  • 1
    "*Well, unless you go around port scanning. But that's a bit rude.*": I laughed. Thanks! Specially because port scanning was my first thought. – Machado Jun 06 '18 at 13:44
  • Thanks! This makes sense but I'm trying to understand the part where you say "it'll give you the list of peers". Does that mean every peer in the entire network or just their connected peers? I'd imagine passing around an entire list would be a headache. – user3953989 Jun 06 '18 at 13:49
  • 2
    @user3953989 You connect to me I tell you the peers I know about that you're interested in. That might not be every peer I've ever seen. It might only be peers that I know have what you're looking for today. Whether those peers are connected to me is completely irrelevant to you when you're trying to connect to them yourself. – candied_orange Jun 06 '18 at 13:54