Setting Up a Local Gateway

Below are instructions for setting up the required bloXroute local gateway.

Requirements:

  1. The instructions below assume you already have a server, are running a node and that you are using Docker. In addition to using the docker start up command, you can set up a local gateway using the startup script provided here.

  2. Please make sure you have downloaded the certificates available in the bloXroute account portal. Save the certificate and secret hash to a folder. For example, /usr/local/bloxroute-certificate

  3. You should generate a private and public key pair. (For detailed instructions on how to create a public and private key pair, go here.)

Installation

To pull the latest gateway version, run the following command:

docker pull bloxroute/bloxroute-gateway-go:latest

Running your gateway

To run your gateway, copy the command below and modify it as needed. See the table below for additional information about various parameters and how you might need to change them. You will need the enode value and IP address of your blockchain node. The --eth-ws-uri argument is optional, however we do recommend using it.

docker run --name bxgateway-go -d \
-v /home/ubuntu/gateway_log:/app/bloxroute/logs \
-v /home/ubuntu/ssl:/app/bloxroute/ssl \
-p 1801:1801 -p 28333:28333 bloxroute/bloxroute-gateway-go:v2.123.1 \
--blockchain-network <Mainnet> \
--ws --port 1801 \
--enodes enode://<BLOCKCHAIN_NODE_PUBLIC_KEY>@<NODE_IP>:<NODE_PORT> \
--enr enr:<enr> \
--private-key <YOUR_PRIVATE_KEY> \
--eth-ws-uri ws://<ETH node IP address>:8546

Setting your 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 a "too many peers" error. To overcome this, add the Gateway as a β€œtrusted peer.”

The below instructions are for adding a gateway as a trusted peer in Geth. Over 70% of the nodes in the Ethereum Mainnet use Geth. If your node runs a different client and you do not know how to change the commands below accordingly, please contact support.

  1. You will need to obtain the gateway enode. You can look up the enode from the Gateway log during the startup process by grep-ing for the word β€œenode”.

  2. 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://GATEWAY_PUBLIC_KEY")
  1. Edit the geth config file and add the Gateway to TrustedNodes in the [Node.P2P] section. You can generate a config file that matches your current configuration by running geth dumpconfig. This step is required as admin.addTrustedPeer is not retained after a node restarts. If you do not change this configuration, you will need to add the gateway as a trusted peer every time you restart your node.

[Node.P2P]
...
TrustedNodes=["YOUR_ENODE"]

Last updated