NethermindEth / NethermindEth/juno

A node in p2p mode should be able to be discoverable without providing it's external IP

Open
#2,268 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2P
Dominant language
Go
Stars
444
Forks
244
Avg merge
2d 15h
Merged PRs (30d)
78

Description

The problem

When a customer connects to the p2p network, they shouldn't need to specify their own public IP always. That's a bad UX.

For example, when one starts using a torrent client to download files, they don't need to figure out their public ip in order to get things moving, the torrent client takes care of ensuring the computer is discoverable by the peers and auto adjust.

Current State

As of Nov 2024, when a peer connects to the p2p network, it advertises it's private ip + public ip (if set in the args). These two get's advertised to the network and saved in the dht throught the addressFactory

As a first step to get the nodes from Juno be able to be used as "discover" nodes so people could connect to the network, I've made a first implementation in https://github.com/NethermindEth/juno/pull/2011 by adding a new flag where who ever is running juno could set their own public ip.

I also created a PoC with figuring out what's the public IP of a machine, and advertising it to the peers: See more

How to work on this issue

  1. Understand how to advertise the current node's address
  1. Enable relay service

    • Probably the EnableRelayService should still be turned on for the 'bootstrap' nodes (when I tested it was enabled)
    • It might be necessary to update the addressFactory to go throught the list of initial peers (bootstrap nodes) and advertise those IP
  2. Figure out how to do proper DCUtR

  • Once the connection is made throught the relay, we should try as soon as possible make that connection directly, otherwise the costs for having data being transfered throught the bootstrap nodes will make it expensive to run bootstrap nodes
    • holePunching is already enabled, so it might just work - need testing!
  • I'd avise looking at other projects that also use go-libp2p and see how they do. A good example is https://github.com/taubyte/tau and https://github.com/minaprotocol/mina
  1. Test with nodes running behind a NAT
  • For nodes running behind a NAT, the first step is to try to advertise to the NAT that we want to start listening to a specific port. This should be already enabled here, but it needs testing
  • Setup 2 nodes running behind 2 different NAT (for example 2 people from the team running their nodes on their local computers). Start the connection throught the relay, and then see if they will start connecting directly (even though the relay address will still have to be advertised and saved in the dht)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with p2p/p2p.go, especially the addressFactory and the EnableAutoRelayWithStaticRelays, EnableRelayService, holePunching, and NAT-port configuration mentioned in the issue. Compare the related PRs and test nodes behind different NATs; done means nodes can be discovered without a configured external IP and can transition from relay connections to direct connections through DCUtR.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.