In order to connect the Gateway as a trusted peer, you need to supply geth 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 logs 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-keybased on the key you created prior.
Use the public key to assemble the Gateway enode with the following format:
2 . Add the Gateway as a trusted peer in geth.
Open the geth console and add the Gateway as a trusted peer using command
addTrustedPeer(<gateway_enode>) or to the trusted-peers.json file in your data directory (this should be same folder that your chaindata and keystore folders are in). Note that the IP address and port do not need to be included.