7.5 Peer Count Limits
Peers in blockchain networks are other nodes your client connects to for data synchronization and message propagation. Maintaining a healthy number of peer connections is essential for exchanging block and transaction data and attesting other node's messages. Depending on your hardware and the volatility of your connections, peer limits can be adjusted.
Further details about connectivity can be found on the Peer Networks and Peer Connectivity pages of the 🧠Theory section.
It's not recommended to set network peer limits higher than 100 for homestakers, as it can have negative impacts on the network's topology while gaining little to none propagation rate or stability.
The following steps are performed on your 📟 node server.
1. Check Peer Connections​
To get insights into the current connections, you can check the peer connections from your local node. Every node operates two independent peer-to-peer networks: the execution and the consensus layer. Each of these networks handles communication with other nodes differently and maintains separate sets of peers. Monitoring both layers is essential to ensure healthy connectivity and network participation.
- Execution Peers
- Consensus Peers
The execution endpoint allows to fetch the peer counts and lots of other client-specific intormation.
JSON-RPC is a lightweight communication protocol encoded in JSON, allowing calls to be sent to a service or server. Each execution client exposes a related interface at port 8545
to retreive calls to interact with the Ethereum network though the local node.
By default, the LUKSO Network Configuration allows to retrieve network data for all execution clients.
1. Install Querying Tool: Install the JSON query service for data processing from the RPC endpoint.
sudo apt install jq
2. Call Execution Endpoint: While the node is running, call the JSON RPC of the execution client.
# Retrieve Execution Peers
curl -s -X POST -H "content-type: application/json" \
--data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' \
http://localhost:8545 | jq -r '.result' | xargs printf '%d\n'
Full Command Explanation
Command | Description |
---|---|
curl -s -X POST -H <text> --data <text> <port> | Executes -X a silent -s HTTP POST request to the given <port> , while attaching custom header -H and --data content as <text> payload. |
jq -r '.result' | Filters the raw -r JSON object and extracts the .result value of the data object. |
xargs printf '%d\n' | Converts the hexadecimal result to a human-readable decimal %d number. |
The output should be something in the range from 5 to 50 peers.
37
If the command couldn't be executed, have a look at the Problem Scanning page to learn how to attach execution clients.
The consensus endpoint allows to fetch the peer counts and lots of other client-specific intormation.
A REST API is a web-based interface for querying structured data. Ethereum consensus clients expose their status and internal metrics on various ports like 3500
, 5051
, or 5052
, to allow users to access information such as synchronization progress, network stability, node metadata, or the current chain head.
By default, the LUKSO Network Configuration opens the REST API ports for all consensus clients.
1. Install Querying Tool: Install the JSON query service for data processing from the REST API endpoint.
sudo apt install jq
2. Call Endpoints: While the node is running, call the REST endpoint of the consensus client.
- Teku
- Prysm
- Lighthouse and Nimbus-Eth2
# Check Number of Consensus Peers
curl -s http://localhost:5051/eth/v1/node/peer_count | jq
# Check Number of Consensus Peers
curl -s http://localhost:3500/eth/v1/node/peer_count | jq
# Check Number of Consensus Peers
curl -s http://localhost:5052/eth/v1/node/peer_count | jq
The output should be something in the range from 5 to 70 peers.
59
If you have low or volatile peer counts, continue to stop the node and raise the peer count limits.
2. Stop Node Operation​
Depending on your setup method, there are different ways to stop your node before configuring the IP or raising the peer limits.
- LUKSO CLI
- Service Automation
cd <lukso-working-directory>
lukso stop
Exchange <lukso-working-directory>
with the path of the node folder.
sudo systemctl stop lukso-validator
Force Client Shutdown
- Geth
- Erigon
- Nethermind
- Besu
- Teku
- Nimbus-Eth2
- Lighthouse
- Prysm
sudo pkill geth
sudo pkill erigon
sudo pkill nethermind
sudo pkill besu
sudo pkill teku
sudo pkill nimbus_beacon_node
sudo pkill nimbus_validator_client
sudo pkill lighthouse
The Lighthouse client uses a single binary for both the consensus and validator processes.
sudo pkill prysm
sudo pkill validator
4. Raise Peer Limits​
Most clients come with conservative default peer limits, which can be increased to maintain more simultaneous connections and improved stability and data propagation. However, peer counts above 100 can negatively affect the network topology and are not recommended.
You should always have more than 15 stable peers after a setup time of 4 to 6 hours. If your peer count is not raising, it indicates a misconfiguration. Check that your firewall allows all necessary client ports to receive data.
Ensure your router is capable of handling higher loads and requests when raising the peer limit above the default.
- Execution Peers
- Consensus Peers
Depending on your execution client, the peer limit can be adjusted with different properties.
- Geth
- Erigon
- Nethermind
- Besu
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/geth/
vim geth.toml
cd <lukso-working-directory>/configs/<network>/geth/
nano geth.toml
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/erigon/
vim erigon.toml
cd <lukso-working-directory>/configs/<network>/erigon/
nano erigon.toml
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/nethermind/
vim nethermind.cfg
cd <lukso-working-directory>/configs/<network>/nethermind/
nano nethermind.cfg
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/besu/
vim besu.toml
cd <lukso-working-directory>/configs/<network>/besu/
nano besu.toml
The following properties need to be exchanged:
<lukso-working-directory>
with the path to the node folder.<network>
with the name of your node's network.
Change the peer limit within the settings, then save and exit the file.
- Geth
- Erigon
- Nethermind
- Besu
Update the MaxPeers property.
# Default Value
MaxPeers = 50
# Updated Value
MaxPeers = <custom-peer-limit>
Update the maxpeers property.
# Default Value
"maxpeers" = 100
# Updated Value
"maxpeers" = <custom-peer-limit>
Update the MaxActivePeers property within the Network object.
# Default Value
"Network": {
"MaxActivePeers": 50
}
# Updated Value
"Network": {
"MaxActivePeers": <custom-peer-limit>
}
Update the max-peers property.
# Default Value
'max-peers' = 25
# Updated Value
'max-peers' = <custom-peer-limit>
Exchange <custom-peer-limit>
with the maximum number of active peers maintained by your node.
Ensure there are no missing spaces, characters or unintended linebreaks before saving the configuration file.
Depending on your consensus client, the peer limit can be adjusted with different properties.
- Prysm
- Teku
- Lighthouse
- Nimbus-Eth2
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/prysm/
vim prysm.yaml
cd <lukso-working-directory>/configs/<network>/prysm/
nano prysm.yaml
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/teku/
vim teku.yaml
cd <lukso-working-directory>/configs/<network>/teku/
nano teku.yaml
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/lighthouse/
vim lighthouse.toml
cd <lukso-working-directory>/configs/<network>/lighthouse/
nano lighthouse.toml
Open the configuration file using your preferred text editor.
- Vim
- Nano
cd <lukso-working-directory>/configs/<network>/nimbus2/
vim nimbus.toml
cd <lukso-working-directory>/configs/<network>/nimbus2/
nano nimbus.toml
The following properties need to be exchanged:
<lukso-working-directory>
with the path to the node folder.<network>
with the name of your node's network.
Change the peer count within the settings, then save and exit the file.
- Prysm
- Teku
- Lighthouse
- Nimbus
Update the p2p-max-peers property.
# Default Value
p2p-max-peers: 70
# Updated Value
p2p-max-peers: <custom-peer-limit>
Update the p2p-peer-upper-bound property.
# Default Value
p2p-peer-upper-bound: 100
# Updated Value
p2p-peer-upper-bound: <custom-peer-limit>
Update the target-peers property.
# Default Value
target-peers = 100
# Updated Value
target-peers = <custom-peer-limit>
Set the max-peers property in a new line at the end of the file.
max-peers = <custom-peer-limit>
Exchange <custom-peer-limit>
with the maximum number of active peers maintained by your node.
Ensure there are no missing spaces, characters or unintended linebreaks before saving the configuration file.
5. Restart the Node​
Depending on your setup method, there are different ways to start your node after the IP address or peer limits have changed.
- LUKSO CLI Node
- LUKSO CLI Validator
- Service Automation
cd <lukso-working-directory>
lukso start --checkpoint-sync
Exchange <lukso-working-directory>
with the path of the node folder.
cd <lukso-working-directory>
lukso start --validator --transaction-fee-recipient "<your-fee-recipient-address>" --checkpoint-sync
The following properties need to be exchanged:
<lukso-working-directory>
with the path of the node folder<your-fee-recipient-address>
with the wallet address receiving staking profits
sudo systemctl start lukso-validator
After the clients were started, verify that their services are still up.
sudo lukso status