Skip to main content

Setting up a private RPC server on Debian / Ubuntu

  1. Set up and sync your BPX Chain full node following this guide. When creating the execution client systemd service, add some new parameters to the bpx-geth command line:
ExecStart=bpx-geth --syncmode snap --http --http.api web3,eth,net --http.corsdomain "*"
  • --http.api web3,eth,net makes only safe APIs available to the public: web3, eth and net, while blocking access to potentially dangerous RPC methods, such as admin or personal
  • --http.corsdomain "*" allows your RPC endpoint to be used in dApps across all domains

If you want your RPC endpoint to provide archive data as well, replace the mentioned line with the following one:

ExecStart=bpx-geth --syncmode full --gcmode archive --http --http.api web3,eth,net --http.corsdomain "*"

2. Create an A record in your domain's DNS zone and point it to the IP address of your BPX full node.

BPX developers recommendation: All private RPC endpoints should be named bpx-dataseed, so if your domain is yourdomain.com, please name your RPC server bpx-dataseed.yourdomain.com.

3. Install the nginx HTTP server and certbot:

apt-get install nginx python3-certbot-nginx

4. Configure nginx as a reverse proxy for bpx-geth:

nano /etc/nginx/sites-available/bpx-dataseed.yourdomain.com
upstream geth {
        least_conn;
        server 127.0.0.1:8545;
}

server {
        server_name bpx-dataseed.yourdomain.com;

        location / {
                proxy_pass http://geth;
        }
}

Save file and exit.

5. Enable the new site and restart nginx:

ln -s /etc/nginx/sites-available/bpx-dataseed.yourdomain.com /etc/nginx/sites-enabled/bpx-dataseed.yourdomain.com
systemctl restart nginx

6. Obtain a free SSL certificate from Letsencrypt to enable HTTPS:

certbot --nginx -d bpx-dataseed.yourdomain.com

During the Certbot wizard, provide your email address for notifications related to the certificate, then select the option to redirect all HTTP traffic to HTTPS.

7. It's done. Test your RPC endpoint by adding https://bpx-dataseed.yourdomain.com instead of the public RPC address in your wallet, such as MetaMask.

Let the BPX developers know that you are hosting your own RPC endpoint. If it operates reliably for a certain time, we will share information about it on our website and social media.