Author

Topic: Number of connections (Read 526 times)

legendary
Activity: 1584
Merit: 1280
Heisenberg Design Services
February 15, 2019, 01:53:12 PM
#20
ok, so i checked and it's actually the total maximum, inbound + outbound. Using -maxconnections=1 will connect 1 outbound peer, 0 inbound peers

sorry for any confusion, but that's how Bitcoin Core 0.17.1 handles it
Thanks for verifying and replying back. This should solve Artemis3 misconceptions about connections and they should be clear of everything by now.

Finally Solved.  Smiley
legendary
Activity: 3430
Merit: 3080
February 15, 2019, 01:18:34 PM
#19
-maxconnections= Maximum number of inbound+outbound connections?

if you are running a full node could you please check and say?

ok, so i checked and it's actually the total maximum, inbound + outbound. Using -maxconnections=1 will connect 1 outbound peer, 0 inbound peers

sorry for any confusion, but that's how Bitcoin Core 0.17.1 handles it
legendary
Activity: 1584
Merit: 1280
Heisenberg Design Services
February 15, 2019, 08:59:26 AM
#18
link + text quote on the 2nd post of this thread
Yes I have read that many a times even before this was quoted. But isn't @sipa pointing out the incoming connections apart from outgoing connections like for example if the full node is already connected to 50 connections (42+8) and then the user sets -maxconnections= say 45 that would reduce the total incoming connections to the particular node to 37 from the initial 42.

8 in, 8 out
I was once running a full node may be around a year back. During that time, I have seen that my node connected to 8 outbound nodes. While seeing through the debug window, the total connections is given as 8!

Also what does this mean?

maxconnections sets a limit on the total number of connections, so if you set it to eight, your node will probably initiate connections to other eight nodes before any node can initiate a connection to it.

Why is .conf file stating that

-maxconnections= Maximum number of inbound+outbound connections?

Carlton Banks, if you are running a full node could you please check and say?

legendary
Activity: 3430
Merit: 3080
February 15, 2019, 07:16:57 AM
#17
8 in, 8 out
Is this true? Need someone to verify this probably.

link + text quote on the 2nd post of this thread
legendary
Activity: 1584
Merit: 1280
Heisenberg Design Services
February 15, 2019, 07:00:47 AM
#16
To explain things clearly, i would try to explain in a brief way for what I have understood and read about these maxconnections in .conf file. Since there is a lot of misconceptions surrounding you, I would try to explain from everything I have read so far.
Forgive me if the post is too long.

A node is certainly which just have connection with the bitcoin network. They don't check that transactions are following the consensus rules or what so ever. They are probably used only for holding private keys, broadcasting transactions, viewing transactions etc. They don't connect with other nodes and receive transactions to confirm them. A full node connects to large number of other nodes in the network and try to

[1] Validate that the created blocks are following the consensus
[2] Check for double-spending

These can only be done if you connect yourself to a large number of other nodes, connecting to limited nodes would make you centralized and depend upon certain specific nodes. Full Nodes do have the power of rejecting a transaction from not getting mined if they feel that the transaction doesn't seem to follow the consensus rules. Even the other nodes considered a transaction as valid and a particular node consider them invalid, the transactions are rejected.

The native bitcoin client works similar to downloading a file via torrent software. Your node first initiates the connection to other peers. This connection is called outbound/outgoing connections. Whenever your client starts to connect to other connections, your signal strength which is present on the bottom right corner increases gradually. Your signal strength touches green or becomes full only when your client starts accepting incoming connections which will happen only after your outbound connections reaches the maximum 8.

What does maxconnections=8 means? 0 incoming?

Yes its true, they are 0 incoming connections as far as i have read the technical documentation present. Your client won't receive incoming connections automatically. You need to manually configure your firewall and open port 8333 to allow others to connect to you. If you are just having 8 connections you are a leecher (in torrenting terms) and you are hurting the network more. You are not seeding anything, which is quite bad.

then what does any value under 8 means? Leaving the fact that "its not a full node", though I wonder how do you call a node like that then?

If you don't receive other's nodes transactions to verify, then what would be the purpose of running a full node? The important aim of running a full node is that it should verify for double spending, if other's don't connect to you for relaying their transaction how does it become a full node?

If the maxconnections value just means the number of incoming, as i was understanding from other posters

NO, your understanding is still certainly wrong. They are the sum of both outbound+inbound connections. In the stackexchange post @sipa has said that whatever higher than 8 can be controlled by -maxconnections. That's why he has said you can control incoming connections assuming no one would have outbound connections less than 8.

Then it makes perfect sense, i could use maxconnections=4 and that would be 4+8.
If you are using maxconnections=4, then you are connecting only to 4 outbound connections which is certainly very bad to the network.


I now see that the value 8 is hardcoded for outgoing connections (unless you edit the code and recompile), so you can only manipulate incoming by maxconnections.

NO, please read the code properly. The code states you cannot increase the outbound connections higher than 8. Whereas if you specify as low as 1 or 2 in maxconnections you will connect to 1 or 2 outbound connections. If you specify 9 or 10 in maxconnections you will connect to 8 outbound and you will allow 1 or 2 inbound based on the input. Try checking yourself by inputting those values and in

Debug > Information

you will see how many incoming and outgoing nodes are connected right now?


If this is not a full node, what it is?

NO, it doesn't function as a full node rather they act as a normal bitcoin wallet holding the private keys as you are not verifying any of the other node transactions and just relaying transactions as normal SPV wallets do.

What are nodes using values 1~8 for maxconnections
They just function as normal bitcoin wallets.

P.S People assume that just downloading the whole 150+ GB blockchain data will make them a full node. That is certainly wrong and a misconception.Full Nodes are the heart and the working blocks of the bitcoin system which has more power than a miner.

8 in, 8 out
Is this true? Need someone to verify this probably.
legendary
Activity: 3430
Merit: 3080
February 14, 2019, 08:04:47 PM
#15
What does maxconnections=8 means?

8 in, 8 out

The answer is 1 post before your first post in this thread (quoted from the bitcoin.stackexchange.com link)
legendary
Activity: 2030
Merit: 1569
CLEAN non GPL infringing code made in Rust lang
February 14, 2019, 06:57:46 PM
#14
Could you please be more clear in framing your question? I can't get your point clearly, but based on my understanding you seem to ask how many incoming connections you allow apart from the 8 outgoing connections if you have specified those above mentioned values?
You have already partially answered my question, but this detail eludes me:

While you are specifying maxconnections at default, you allow at most 117 incoming connections to connect to you and 8 outgoing connections are by default connected from your node.
Here you subtract 8 from the default 125, resulting in 117. With the 865 example you subtract 8 again so, 857. Fine and easy to understand. Now the problem lies with the value 8 or less...

What does maxconnections=8 means? 0 incoming? then what does any value under 8 means? Leaving the fact that "its not a full node", though I wonder how do you call a node like that then?

bitcoind -maxconnections=8
Using at most 8 automatic connections (1024 file descriptors available)

If the maxconnections value just means the number of incoming, as i was understanding from other posters, it would mean that the default of 125 would be 125+8 instead of 125-8. Then it makes perfect sense, i could use maxconnections=4 and that would be 4+8. I now see that the value 8 is hardcoded for outgoing connections (unless you edit the code and recompile), so you can only manipulate incoming by maxconnections.

bitcoind -maxconnections=4
Using at most 4 automatic connections (1024 file descriptors available)

If this is not a full node, what it is? What are nodes using values 1~8 for maxconnections?
legendary
Activity: 3430
Merit: 3080
February 14, 2019, 11:12:26 AM
#13
So, if your next question is "How can I increase the 8 outbound connections to a higher limit?"

They are hard-coded in the net.h of the client code.

Code:
/** Maximum number of outgoing nodes */
static const int MAX_OUTBOUND_CONNECTIONS = 8;

Change that to whatever higher limit you need and fork out or create a PR in git and see that if it gets accepted by the community. (This has been suggested many a times but those are not to be changed and put even more load on the declining nodes).

I would strongly deter doing the above, and so would many others.


That's bad for the network in principle, network-wide inbound connection slots are a resource that shouldn't be used unnecessarily. And there is no reason to use more outbound connections than are needed to sync the chain.

If you want to improve the network, then contribute incoming connections so that more people can join. i.e. open a port and get your bitcoin node to listen for other nodes on that port. Editing the hardcoded maximum outbounds is essentially the opposite; occupying other nodes incoming slots over and above what a single node needs, limiting the network instead of expanding it.
legendary
Activity: 1584
Merit: 1280
Heisenberg Design Services
February 14, 2019, 10:13:49 AM
#12
So to clarify, this value means: How many nodes i let connect to me, while I'm always connected to 8 nodes regardless?
Could you please be more clear in framing your question? I can't get your point clearly, but based on my understanding you seem to ask how many incoming connections you allow apart from the 8 outgoing connections if you have specified those above mentioned values?

If so,

Leaving it undefined (commented out) bitcoind outputs (and logs) this:
Using at most 125 automatic connections (1024 file descriptors available)
While you are specifying maxconnections at default, you allow at most 117 incoming connections to connect to you and 8 outgoing connections are by default connected from your node.

If 1 (either bitcoin.conf or -maxconnections=1, it shows this:
Using at most 1 automatic connections (1024 file descriptors available)
While you are specifying maxconnections to 1, your node doesn't function as a full node and I am tired of answering this. You cannot do that/ probably it's useless to run a full node dude if you are having maxconnections set to 1.


Using "2000" like the OP wanted, it shows this:
Using at most 865 automatic connections (1024 file descriptors available)
Your node would be connected to 8 connections and you allow at most 857 incoming connections to connect to your node. By this way, you would receive transaction information if any of those 857 connections broadcast them and vice versa.

So, if your next question is "How can I increase the 8 outbound connections to a higher limit?"

They are hard-coded in the net.h of the client code.

Code:
/** Maximum number of outgoing nodes */
static const int MAX_OUTBOUND_CONNECTIONS = 8;

Change that to whatever higher limit you need and fork out or create a PR in git and see that if it gets accepted by the community. (This has been suggested many a times but those are not to be changed and put even more load on the declining nodes).
legendary
Activity: 2030
Merit: 1569
CLEAN non GPL infringing code made in Rust lang
February 14, 2019, 08:15:03 AM
#11
Leaving it undefined (commented out) bitcoind outputs (and logs) this:
Using at most 125 automatic connections (1024 file descriptors available)

If 1 (either bitcoin.conf or -maxconnections=1, it shows this:
Using at most 1 automatic connections (1024 file descriptors available)

Using "2000" like the OP wanted, it shows this:
Using at most 865 automatic connections (1024 file descriptors available)

So to clarify, this value means: How many nodes i let connect to me, while I'm always connected to 8 nodes regardless?
legendary
Activity: 1584
Merit: 1280
Heisenberg Design Services
February 13, 2019, 08:52:21 PM
#10
Hmm so if i specify maxconnections=1 this means i have 8 OUT and 1 IN correct?
NO, you are making this more complex! If you just specify maxconnections=1 it wouldn't make any sense at all, what I thought was you were adding just 1 connection apart from the minimum 8 connections. If your node connects to only 1 other node connection it doesn't function as a full node at all and you are doing more bad to the network.

But if i query bitcoind (also written in the wiki) it shows this:

Quote from: bitcoind -?
 -maxconnections=
       Maintain at most connections to peers (default: 125)

So where did your 8 come from?
As the above user said, 8 is the maximum outbound connections. Whenever you start your client and it gets synced to blocks, it gets connected to 8 other nodes. I assume this is also the minimum one, as suggested in git, wiki and in this forum. Probably you shouldn't change the maxconnections, since connecting to maximum nodes is considered healthy for the network and would be fair for bitcoin to work in a trustless way.

Other coin wallets based on core such as dogecoin-qt and litecoin-qt wouldn't allow you to connect less than 8 connections. I assume that is the same for bitcoin too.

P.S I am not aware how TOR node functions and edited my previous post for better understanding.
legendary
Activity: 2702
Merit: 3045
Top Crypto Casino
February 13, 2019, 06:15:34 PM
#9
But if i query bitcoind (also written in the wiki) it shows this:

Quote from: bitcoind -?
 -maxconnections=
       Maintain at most connections to peers (default: 125)
Correct, the default number for connections is 125

Quote
So where did your 8 come from?
8 is the maximum number of outgoing connections (outbound), subsequently, you may have 117 incoming connections (inbound).
legendary
Activity: 2030
Merit: 1569
CLEAN non GPL infringing code made in Rust lang
February 13, 2019, 02:30:04 PM
#8
Hmm so if i specify maxconnections=1 this means i have 8 OUT and 1 IN correct?

But if i query bitcoind (also written in the wiki) it shows this:

Quote from: bitcoind -?
 -maxconnections=
       Maintain at most connections to peers (default: 125)

So where did your 8 come from? I did read in the wiki that, when you can't get incoming connections this goes down to 8.

Quote from: Setting up a Tor hidden service
If you use a Bitcoin full node over Tor, then usually it will only be able to make outgoing connections. Therefore, you will only get a maximum of 8 total connections.
legendary
Activity: 1584
Merit: 1280
Heisenberg Design Services
February 13, 2019, 01:54:05 PM
#7
This is why i am confused about the value 1.
If there were separate values for IN and OUT it would be more clear to me, but you are saying this means INcoming only?
I have misread your earlier post. I thought you were asking about setting up 1 connection higher than the default 8 connections. Note that, you are a full node only if you have at least 8 active connections. Setting that to 1 doesn't make sense actually and the qt wallet wouldn't function as a full node if you are just connected to only one other node. Having 8 or lesser connections is considered bad to the network and you are overloading the bitcoin network unnecessarily in the name of running a node.

Maximum number of inbound+outbound connections.
Yes that's true, the maxconnections is the sum of outbound connections (which is by default 8 and would probably get connected as soon as your client is ready) and inbound connections. With maxconnections you can control the incoming/inbound connections as the outbound would be fixed to 8 always.

Now for bigger values, does it pick half for inbound and half for outbound, or something else? Ie. does the value 2 means: 1 in, 1 out? Or it could be 2 in only, later 2 out only, later 1 in 1 out?
The bitcoin protocol would function similar to downloading a file via torrent. You first connect to other nodes (outbound) and get the information and would seed(inbound) the information for other nodes once you have got that.
legendary
Activity: 3430
Merit: 3080
February 13, 2019, 11:53:07 AM
#6
While we are at it, Can someone tell me the effect of setting maxconnections=1? Does it become half duplex or something?

I think it fills outbound slots first, certainly if a node is catching up then inbound slots do not get negotiated until catch up to the chain tip is complete.
legendary
Activity: 2030
Merit: 1569
CLEAN non GPL infringing code made in Rust lang
February 13, 2019, 11:25:04 AM
#5
While we are at it, Can someone tell me the effect of setting maxconnections=1? Does it become half duplex or something?
If you set maxconnections=1 then you are allowing a maximum of only 1 incoming connection to connect to your node. This won't save your RAM memory if you are thinking so. Reducing the incoming connections to 1 would reduce the usage of RAM to just few kb. Setting up the incoming connections to very low is similar to not allowing anyone to download your content even though you are seeding a file after successfully downloading it. As per Gavin's reddit post if you are limiting your incoming connections to a very low value (say 1) you are probably not helping the community by running a full node. Then there is no need for running a full node after all if you are not allowing anyone to connect to you.

Setting up your maxconnections to insane levels like OP is also not a good idea. You are thinking of contributing to the network rather you are destroying your own PC by overloading them. If you really need to connect to more connections then you could manually increase your file descriptors by using the ulimit command.

The comment in bitcoin.conf says:

# Maximum number of inbound+outbound connections.

This is why i am confused about the value 1.

Now for bigger values, does it pick half for inbound and half for outbound, or something else? Ie. does the value 2 means: 1 in, 1 out? Or it could be 2 in only, later 2 out only, later 1 in 1 out?

If there were separate values for IN and OUT it would be more clear to me, but you are saying this means INcoming only?
legendary
Activity: 1584
Merit: 1280
Heisenberg Design Services
February 13, 2019, 09:24:45 AM
#4
While we are at it, Can someone tell me the effect of setting maxconnections=1? Does it become half duplex or something?
If you set maxconnections=9 (8+1) then you are allowing a maximum of only 1 incoming connection to connect to your node. This won't save your RAM memory if you are thinking so. Reducing the incoming connections to 1 would reduce the usage of RAM to just few kb. Setting up the incoming connections to very low is similar to not allowing anyone to download your content even though you are seeding a file after successfully downloading it. As per Gavin's reddit post if you are limiting your incoming connections to a very low value (say 1) you are probably not helping the community by running a full node. Then there is no need for running a full node after all if you are not allowing anyone to connect to you.

Setting up your maxconnections to insane levels like OP is also not a good idea. You are thinking of contributing to the network rather you are destroying your own PC by overloading them. If you really need to connect to more connections then you could manually increase your file descriptors by using the ulimit command.
legendary
Activity: 2030
Merit: 1569
CLEAN non GPL infringing code made in Rust lang
February 12, 2019, 07:01:05 PM
#3
While we are at it, Can someone tell me the effect of setting maxconnections=1? Does it become half duplex or something?
legendary
Activity: 2912
Merit: 1309
February 12, 2019, 09:53:48 AM
#2
what is the best number of connections today?

I discovered a setting: "maxconnections" inside bitcoin.conf / bitcoind -help also.

I tried 2000 but at startup, I get a message that a maximum of 845 by hardware limitations is only possible.

even if this is a very old thread you pumed up Smiley
Nice to read Satoshi.

To answer: The limitation is based on the file descriptors on your system:
 nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);

so if you can tune your OS you can do more than your 845.
look here the warning from Pieter Wuilli: https://bitcoin.stackexchange.com/questions/8109/how-does-one-attain-1-000-connections-like-blockchain-info/8140#8140


Quote
Bitcoin by default will not make more than 8 outgoing connections, and -maxconnections only controls how many incoming connections you allow. Feel free to set this higher, but it will take time before others connect to you in large numbers.

Please don't change this, as there is no need. Connectable peers on the network are a scarce resource, and essential to the decentralization. If people go try connect to all of them like some sites do, we'll very quickly run out.
hero member
Activity: 561
Merit: 521
Trustless IceColdWallet
February 12, 2019, 08:59:23 AM
#1
what is the best number of connections today?

I discovered a setting: "maxconnections" inside bitcoin.conf / bitcoind -help also.

I tried 2000 but at startup, I get a message that a maximum of 845 by hardware limitations is only possible.
Jump to: