Setting up a private RPC server on Debian / Ubuntu
- 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
andnet
,meanwhilewhileit blocksblocking access to potentially dangerous RPC methods,e.g.such asadmin
orpersonal
--http.corsdomain "*"
allows your RPC endpoint to be used in dAppsinacross all domains
If you want your RPC endpoint to provide archive data also,as well, replace the mentioned line towith 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 domaindomain's DNS zone and point it to the IP address of your BPX full node IP address.node.
BPX developers recommendation: allAll 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:certbot:
apt-get install nginx python3-certbot-nginx
4. Configure nginx as a reverse proxy for Geth: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 certbotCertbot wizard, provide your e-mailemail address for notifications related to the certificate, then select the option to redirect all HTTP traffic to HTTPS.
7. Done.It's done. Test your RPC endpoint by adding https://bpx-dataseed.yourdomain.com
instead of the public RPC address in your wallet, e.g.such Metamask.as MetaMask.
Let the BPX developers know that you hostare hosting your own RPC endpoint. If it worksoperates stablyreliably for a fewcertain months,time, we will postshare information about it on our website and social media.