Adding the Gateway as a Trusted Peer
The bloXroute Gateway connects to the blockchain node as a peer. If the blockchain node runs out of peer slots, it will reject the Gateway connection with "too many peers" error. To overcome this, add the Gateway as a “trusted peer.”

ETH, BSC, Polygon

In order to connect the Gateway as a trusted peer, clients need to supply the node with the Gateway enode.

1. Obtain the Gateway enode.

There are two options. A. Use the enode generated automatically by the Gateway. You can look up the enode from the Gateway log during the startup process. You can grep for the word “enode.” Below is an example of the log reporting the enode.
Python Gateway
Go Gateway
1
“Gateway enode url: enode://08141a65c2b5fa0e9d1e562bd732743c07a1d2a2e921b0fe209a74b59dca2d0cbbc4bc3ea21138e405f6e77ba804c996e9b2ae2d20bab30bd6b58b2d041a85f5”
2
​
Copied!
1
"Started P2P networking self=enode://08141a65c2b5fa0e9d1e562bd732743c07a1d2a2e921b0fe209a74b59dca2d0cb[email protected]127.0.0.1:0"
2
​
Copied!
B. Generate a Gateway enode yourself from a private and public key pair. First generate a private and public key pair. (For detailed instructions on how to create a public and private key pair, go here.)
1
private key - d51c80e8bd5da33ddab5b7039b6bf72c8ba8b294408e56ed07780edfe7788ce8
2
public key - 3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1
3
​
Copied!
Restart the Gateway with additional argument --private-key based on the key you created prior.
1
--private-key d51c80e8bd5da33ddab5b7039b6bf72c8ba8b294408e56ed07780edfe7788ce8
2
​
Copied!
Use the public key to assemble the Gateway enode with the following format:
1
enode://3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1
2
​
Copied!

2 . Add the Gateway as a trusted peer in geth.

Open the node’s console and add the Gateway as a trusted peer using command admin.addTrustedPeer(<gateway_enode>) Note that the IP address and port do not need to be included.
1
admin.addTrustedPeer("enode://3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1")
2
​
Copied!
admin.addTrustedPeer doesn’t retain after a node restarts. To keep the Gateway as a trusted peer after a restart, you need to add it as trusted in the config file.
Edit the geth config file and add the Gateway to TrustedNodes in the [Node.P2P] section. You can generate a config file that match your current configuration by running geth dumpconfig
1
[Node.P2P]
2
...
3
TrustedNodes=["enode://3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1"]
4
​
Copied!
Last modified 13d ago