You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am behind a NAT. The time spent running a node is irrelevant to the number of peer connections I get. I only ever get the connections to peers supplied by the --peers argument.
I should be able to initiate connections to peers whom I learned about from the bootstrap peers. But for some reason that is not happening.
I am seeing this also. Yeah it should be that my node (behind NAT) learns about new peers from the first (--peers) it connects to, and then connects to the new ones, and so on, up to --max-num-peers.
Four months later, peer discovery continues to be pretty bad. Yes we have had other, higher-priority issues to focus on, but maybe part of the reason why no external contributors decided to take this task on is because of its poor definition. So in the hope to attract external contributors' attention (and otherwise to track our own progress) here is a proposed decomposition into subtasks.
Personally, I prefer fixing existing issues over developing new features. With that in mind, I would prioritize the last bullet point, fixing #488 and that probably involves fixing the first bullet point also.
I wanted to register for the record some interesting behavior. I am running a node on my desktop computer. I specified one bootstrapper node through the CLI. For several hours now, I am connected to only that bootstrapper node. The log looks like this:
2025-08-23T19:10:15.023756031Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:12:13.807600914Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:14:12.591645063Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:16:15.471662626Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:18:14.255608625Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:20:13.039643498Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:22:11.823624784Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:24:14.703712673Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:26:13.487671558Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:28:12.271655239Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:30:15.151577482Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:30:27.192712819Z INFO ThreadId(01) neptune_cash::main_loop: Last block from peer is new canonical tip: 8d4b6498c0490066b6c31f81f60e2895ce9fac1c885e696122ed7a9a39970da85539e20100000000; height: 2780
2025-08-23T19:32:13.935649079Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:34:12.719447873Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:34:35.511676663Z INFO ThreadId(01) neptune_cash::main_loop: Last block from peer is new canonical tip: 6b43b31fa9fdd10452b9201ded0d52024ebc5d7522ed034f93333e5011fe5e52d8eec50500000000; height: 2781
2025-08-23T19:36:15.599515086Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:38:14.383557461Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:40:13.167472977Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:42:11.951852749Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:44:14.831728621Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:46:13.615713077Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:48:12.399702652Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:50:03.128592252Z INFO ThreadId(01) neptune_cash::main_loop: Last block from peer is new canonical tip: 27afb5b577376af270352eec145b6a2fbda626689f9d9256132feaf6084439c13f10c20200000000; height: 2782
2025-08-23T19:50:15.279542585Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:52:14.063732824Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:54:12.847661523Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:55:49.24633409Z INFO ThreadId(01) neptune_cash::main_loop: Last block from peer is new canonical tip: a5444ce440388da33b341fc61004e6f1a47afaf48f47267f32f92ff38bb8fef5e582df0800000000; height: 2783
2025-08-23T19:56:11.631783653Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T19:58:14.511558416Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:00:13.295591066Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:00:59.985272537Z INFO ThreadId(01) neptune_cash::main_loop: Last block from peer is new canonical tip: 5e9dbeeabb5534979fc5c5b2287430db32cbc7348a38e3b30816891badfd412228d6ae0800000000; height: 2784
2025-08-23T20:02:12.079464469Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:04:14.959650169Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:05:33.977486555Z INFO ThreadId(01) neptune_cash::main_loop: Last block from peer is new canonical tip: 2d60e76d9865d5890b4264785a7df38006e8f22b6db26d3dbc31297293e481cb0367010500000000; height: 2785
2025-08-23T20:06:13.743634501Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:08:12.527569055Z INFO ThreadId(02) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:10:15.407639064Z INFO ThreadId(23) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:12:14.191657408Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:14:12.975629922Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
2025-08-23T20:16:11.759536671Z INFO ThreadId(19) neptune_cash::connect_to_peers: Connection to [::ffff:58.6.138.203]:9798 closing
I think this is what's going on:
The node has successfully asked the bootstrapper node which peers it knows. The bootstrapper responded with a list of some 25 peers.
The node has selected peer [::ffff:58.6.138.203]:9798 as the first peer to establish a connection to.
The connection fails due to some firewall or NAT issue.
The node does not recognize the failure to establish the connection. Consequently, the node keeps trying to establish the connection, ending in the same result.
The node does not attempt to connect to other peers on the list of peers the bootstrapper node responded with, possibly because the first connection is still outstanding.
Come to think of it, I vaguely recall something about avoiding connections to mutual peers. So then [::ffff:58.6.138.203]:9798 might only be used as an intermediate connection to get its peer list. This might explain why the node does not recognize the persistent failure. Of course, if this intermediate connection fails, this avoid-mutual-peers mechanism cannot proceed.
Based on this understanding I would organize tasks as follows (in addition to the tasks listed above):
Quit avoiding mutual peers. This is a concern for after the node is well connected; requiring it up front presents an obstacle for peer discovery.
Monitor connection failures. Break out of the loop if the failure count exceeds a constant.
Run multiple peer discovery processes in parallel.
As a side note, the difficulty I am having to establish that or any connection makes good testing ground for hole punching.
Time to close this thread. Most, if not all, of the feature-deficiencies are addressed by the Libp2p Network Stack #828. Not all todos in this thread were closed but the integration of the libp2p network stack does call their motivation into question. If any issues persist, open a new GitHub Issue.
Activity
dan-da commentedon Feb 13, 2025
I am seeing this also. Yeah it should be that my node (behind NAT) learns about new peers from the first (--peers) it connects to, and then connects to the new ones, and so on, up to --max-num-peers.
this should be a pretty high prio to fix.
gump1995 commentedon Feb 14, 2025
中国用户连接不上。请求帮助
aszepieniec commentedon Feb 14, 2025
Noted. Do you think it is because of NAT? If not, can you speculate on what the cause might be? In that case I guess it should be a separate issue.
aszepieniec commentedon Feb 14, 2025
This is not quite true: I noticed I got a fourth connection after only specifying three peers through the CLI.
Still, peer discovery is worth improving. Compared to other cryptocurrencies I've tried, it is slow.
aszepieniec commentedon Jun 15, 2025
Four months later, peer discovery continues to be pretty bad. Yes we have had other, higher-priority issues to focus on, but maybe part of the reason why no external contributors decided to take this task on is because of its poor definition. So in the hope to attract external contributors' attention (and otherwise to track our own progress) here is a proposed decomposition into subtasks.
aszepieniec commentedon Jun 15, 2025
PeerMessages without breaking.--peersin CLI.)skaunov commentedon Jul 4, 2025
Am I correct it's best to start with connections relaying (hole punching). What are the other nice to begin with parts?
aszepieniec commentedon Jul 6, 2025
Personally, I prefer fixing existing issues over developing new features. With that in mind, I would prioritize the last bullet point, fixing #488 and that probably involves fixing the first bullet point also.
aszepieniec commentedon Aug 23, 2025
I wanted to register for the record some interesting behavior. I am running a node on my desktop computer. I specified one bootstrapper node through the CLI. For several hours now, I am connected to only that bootstrapper node. The log looks like this:
I think this is what's going on:
Come to think of it, I vaguely recall something about avoiding connections to mutual peers. So then [::ffff:58.6.138.203]:9798 might only be used as an intermediate connection to get its peer list. This might explain why the node does not recognize the persistent failure. Of course, if this intermediate connection fails, this avoid-mutual-peers mechanism cannot proceed.
Based on this understanding I would organize tasks as follows (in addition to the tasks listed above):
As a side note, the difficulty I am having to establish that or any connection makes good testing ground for hole punching.
jan-ferdinand commentedon Dec 1, 2025
There are additional ideas on how to improve peer discovery and bootstrapping in this comment.
aszepieniec commentedon Jan 29, 2026
Time to close this thread. Most, if not all, of the feature-deficiencies are addressed by the Libp2p Network Stack #828. Not all todos in this thread were closed but the integration of the libp2p network stack does call their motivation into question. If any issues persist, open a new GitHub Issue.