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. To overcome this, add the Gateway as a “trusted peer.”

Ethereum

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

1. Obtain the Gateway enode.

You have 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.

“Gateway enode url: enode://08141a65c2b5fa0e9d1e562bd732743c07a1d2a2e921b0fe209a74b59dca2d0cbbc4bc3ea21138e405f6e77ba804c996e9b2ae2d20bab30bd6b58b2d041a85f5”

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.)

private key - d51c80e8bd5da33ddab5b7039b6bf72c8ba8b294408e56ed07780edfe7788ce8
public key - 3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1

Restart the Gateway with additional argument --private-key based on the key you created prior.

--private-key d51c80e8bd5da33ddab5b7039b6bf72c8ba8b294408e56ed07780edfe7788ce8

Use the public key to assemble the Gateway enode with the following format:

enode://3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1

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.

admin.addTrustedPeer("enode://3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1")

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

[Node.P2P]
...
TrustedNodes=["enode://3bae79125dce1c6671ebfdb3e8e68095604af31be53d8d4b17424df9af11850163cd8d19a16d05800ab979a52a12da4d59b6d4c88a955f3360e9f2ac818152d1"]