Author

Topic: Maximum number of connections in bitcoin client (Read 8574 times)

sr. member
Activity: 306
Merit: 250
Code:
net.cpp
Line 40 > static const int MAX_OUTBOUND_CONNECTIONS = 8;

https://github.com/bitcoin/bitcoin/blob/fc5d85c4bbb5fd5964117d4faf698ef2bf4ec634/src/net.cpp#L40

Maybe it helps  Grin

full member
Activity: 340
Merit: 101
How is it possible to increase max_outbound_connections?
I want to increase the speed of the blockchain download.
So far I only have 8. BTW: can I also use the same options with dogecoin-client?
Looks exactly the same as Satoshi-Client.
legendary
Activity: 2912
Merit: 1060
I just launched nodes in nyc and ams
Sfo and Asia coming
sr. member
Activity: 362
Merit: 262
legendary
Activity: 2912
Merit: 1060
Sweet I'm trying to get 1000 connections
legendary
Activity: 1623
Merit: 1608
I keep seeing two numbers, is it 8 or 125?

By default, if the value on the bottom right side of Bitcoin-Qt says "8 connections to the Bitcoin network", you are most likely behind a firewall and you are not accepting incoming connections. In that case, you are acting like a leech and you are just putting burden on the network.

Normally, if the message at the bottom right side is something higher than 8 connections, you are contributing to the network by accepting incoming connections.

I keep a Bitcoin-Qt node running non-stop and I have never reached 90 active connections. Apart from the configuration, I believe it also depends on the upstream speed of your network and the processing capability of your machine.

member
Activity: 130
Merit: 58

Exactly. There's drop from ~60k nodes (all time history of charts) to ~40k nodes. Many people are saying that it's an indicator for bitcoin population and decreasing nodes == bitcoin rejection.


As far as I see bitcoinstatus.rowit.co.uk is not updated any more.
The graphs last until October. (I dont know which year).
legendary
Activity: 2912
Merit: 1060
I keep seeing two numbers, is it 8 or 125?
legendary
Activity: 1386
Merit: 1097

Exactly. There's drop from ~60k nodes (all time history of charts) to ~40k nodes. Many people are saying that it's an indicator for bitcoin population and decreasing nodes == bitcoin rejection.

OT: I must say that I don't think so. From my neighborhood I'm the only one person who's using official client on my personal computer and it's mostly just because it's configured as "trusted node" for pool :-). Other people around me are starting to use web wallets because they have many benefits for common users (like instant access from everywhere) and also because maintaining full blockchain on personal computers and notebooks is simply annoying. Thanks to this, I believe that although count of bitcoin nodes is slightly decreasing, bitcoin population is still increasing, they just don't run official client, thus they're off the statistics.

Totally OT: As maintaining blockchain is going to be harder and harder, I believe that people will switch to lightweight clients like electrum - clients which don't handle even blockheaders, just private keys. It's great way to be almost completely safe (in contrary of web wallets) and not burn own computer while receiving transaction only once a week.
o
member
Activity: 76
Merit: 10
Afaik, number of actively listening nodes is decreasing, but there are still thousands of them. Unfortunately I don't remember site which is crawling them and make graphs with timeline.

This one? http://bitcoinstatus.rowit.co.uk/

Hmm..? Ive never seen more than 8 connections. I am behind 2 NATs though, I assume that has something to do with it..

Yes, MAX_OUTBOUND_CONNECTIONS in default client is 8 and because you're behind nat, other clients cannot open connection to you. However 8 connections is enough for normal client node.

8 connections is certainly more than enough if it is completely random, but it is a bit small in real case I think.

The standard bitcoin client will likely not connect to over 1000 nodes as it's limited by select()'s fd_set size of 1024. I'm not sure if this is true of windows. My client, which uses kqueue, has connected to over 5000 nodes at once.

I think it is the right reason since my connection never over 1000, I have suspected that there is some 1024 but none of it in the source codes. So it should be the system limit. It is build in ubuntu.
hero member
Activity: 910
Merit: 1005
The standard bitcoin client will likely not connect to over 1000 nodes as it's limited by select()'s fd_set size of 1024. I'm not sure if this is true of windows. My client, which uses kqueue, has connected to over 5000 nodes at once.
legendary
Activity: 1386
Merit: 1097
Hmm..? Ive never seen more than 8 connections. I am behind 2 NATs though, I assume that has something to do with it..

Yes, MAX_OUTBOUND_CONNECTIONS in default client is 8 and because you're behind nat, other clients cannot open connection to you. However 8 connections is enough for normal client node.
legendary
Activity: 1386
Merit: 1097
EDIT: BTW, what is the normal maximum number of connections you get now and at the time you start the pool.

Pool has only custom number in MAX_OUTBOUND_CONNECTION to make building p2p network faster after startup, but I'm using default maxconnections. As pool node is (obviously) permanent and almost without downtime, I have 125 connections all the time. After I moved pool to another IP, pool reached outbound connections pretty easily (in few hours), but it took few days until clients resolved new IP and 125 slots got filled.

Afaik, number of actively listening nodes is decreasing, but there are still thousands of them. Unfortunately I don't remember site which is crawling them and make graphs with timeline.
hero member
Activity: 518
Merit: 500
Hmm..? Ive never seen more than 8 connections. I am behind 2 NATs though, I assume that has something to do with it..
o
member
Activity: 76
Merit: 10
I have tried to see how many active client nodes in the network. By running it for few days, the maximum number of connections I get is around 900.

So is it truely the size of bitcoin network at any moment? It is a bit weak in my opinion, isn't it?

A pool certainly have many connections so you set a limit yourself, but I would consider most client is the standard version that does not reach the limit.

EDIT: BTW, what is the normal maximum number of connections you get now and at the time you start the pool.

net.cpp, version 0.3.24:
Code:
if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
       closesocket(hSocket);

* yes, there's -maxconnection switch so user can adjust how many connections he want to keep
* when this number is reached, new connections are dropped

Yes, both maxconnections and MAX_OUTBOUND_CONNECTIONS needs to set to a very large number.
legendary
Activity: 1386
Merit: 1097
net.cpp, version 0.3.24:
Code:
if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
       closesocket(hSocket);

* yes, there's -maxconnection switch so user can adjust how many connections he want to keep
* when this number is reached, new connections are dropped
hero member
Activity: 868
Merit: 1008
900!  The most I've ever seen is around 150 and that's after running for several weeks (and usually it hovers around 100).  What version are you running?  Is there an option to increase the number of connections it tries to maintain?
legendary
Activity: 1386
Merit: 1097
Not every client is running on public port and not every client is willing to talk with you when you'll try to connect them. For example my pool server is rejecting new connections when it reaches some number to prevent overloading.
o
member
Activity: 76
Merit: 10
I have tried to see how many active client nodes in the network. By running it for few days, the maximum number of connections I get is around 900.

So is it truely the size of bitcoin network at any moment? It is a bit weak in my opinion, isn't it?
Jump to: