ethereum / devp2p

Ethereum peer-to-peer networking specifications
971 stars 273 forks source link

Not getting any inbound connections #248

Closed ana-prdekalo closed 9 months ago

ana-prdekalo commented 10 months ago

Hello,

I've been writing my own node in Rust for fun, this time I'm stuck on the issue that I'm not getting inbound connections. As I've been doing more work on BSC than ETH, this is a peer network I'm testing against.

Currently, I run GETH's cmd/devp2p crawler to obtain BSC nodes (I crawl, then filter using ForkIDs). Finally, these nodes are "fed" to my rudimentary implementation. The communication between my node and the "real ones" goes smoothly both on P2P and ETH layers (capabilities).
My next steps are to allow other nodes to connect to mine and finally to fully implement the discover (DiscV4) protocol.

Unfortunately, I'm not getting any valid connection requests on my TCP listener and I'm not sure why. I'm probably missing some part of logic, but I cannot find anything in the docs (I'm not saying it's missing, just that I'm unable to find it).

When establishing an outbound connection I'm using the same port as I'm using in my TCP & UDP listeners.

My understanding is, that once I connect to peers and exchange P2P Hello messages, the peer I'm connected to will add me to its DHT, so when other peers send DiscV4 FindNode packet to my neighbor, my node should be in the Neighbours response, am I correct? I've also implemented the DiscV4 Pong response to the Ping packet (but I'm not yet sending any Pings of my own), and I'm sending my enr as a response to ENRRequest packets.

I have tested all of these against the prod GETH node, and packets sent out by my node are valid, ports are open, ForkId returned in ENRResponse is correct, etc. What I've noticed is that non-BSC nodes do send ENRRequests and some of them do try to establish a TCP connection, but BSC nodes just send Ping packets and they don't try to establish a TCP connection to my node.

Can anyone please tell me what am I missing? What are the minimal features I need to implement in order that other nodes in the network to find me and try to establish a connection with me?

ana-prdekalo commented 9 months ago

Forgot about this issue. The problem was that I was missing boot nodes 🤦‍♂️By that I mean, everything started working once I tried to connect to boot nodes.