Advanced usage

Installing the timelord on Debian / Ubuntu

1. To run a timelord, you need a synchronized BPX Chain full node. If you don't have it already, follow the steps of this tutorial first.

2. The timelord software is not included in official binary .deb / .rpm releases. You have to build it from the source code. Login as root and install the git client first.

apt-get install git

3. The timelord installer script requires root access to install some dependencies from APT repositories. Add BPX services user to sudoers by the following command:

usermod -a -G sudo bpxv3

4. Now it's time to switch to BPX services user:

su - bpxv3

4. Fetch the source code of the latest Beacon Client release:

git clone https://github.com/bpx-network/bpx-beacon-client

5. Install the Beacon Client from the source. This may take several minutes.

cd bpx-beacon-client
. install.sh

6. Install the timelord software:

. install-timelord.sh

7. Press Control + D to log out and return to the root console.

8. Create the timelord service descriptor file:

nano /etc/systemd/system/bpx-timelord.service

Insert the following file content:

[Unit]
Description=BPX Timelord

[Service]
Type=forking
User=bpxv3
WorkingDirectory=/home/bpxv3/bpx-beacon-client
ExecStart=bash -c ". activate && bpx start timelord-launcher-only timelord-only"
ExecStop=bash -c ". activate && bpx stop timelord-only timelord-launcher-only"
Restart=always

[Install]
WantedBy=multi-user.target

Save the file by pressing Control + O and close the editor with Control + X.

9. Refresh startup services configuration

systemctl daemon-reload

10. Activate automatic startup of timelord service

systemctl enable bpx-timelord

Regular timelord

If you want to run a regular timelord used by BPX consensus algorithm for generating new blocks, just start the timelord with default configuration: 

systemctl start bpx-timelord

Bluebox timelord

To run the bluebox timelord which compresses old blocks in the chain, you need to edit the configuration file:

nano /home/bpxv3/.bpx/beacon/config/config.yaml

Save the file and exit. Then start the timelord:

systemctl start bpx-timelord

How to set up 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 geth command line:
ExecStart=bpx-geth --syncmode snap --http --http.api web3,eth,net --http.corsdomain "*"

If you want your RPC endpoint to provide archive data also, replace the mentioned line to 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 DNS zone and point it to your BPX full node IP address.

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 nginx HTTP server and certbot:

apt-get install nginx python3-certbot-nginx

4. Configure nginx as a reverse proxy for 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 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 e-mail address for notifications related to the certificate, then select the option to redirect all HTTP traffic to HTTPS.

7. Done. Test your RPC endpoint by adding https://bpx-dataseed.yourdomain.com instead of the public RPC address in your wallet, e.g. Metamask. Let the BPX developers know that you host your own RPC endpoint. If it works stably for a few months, we will post information about it on our website and social media.