Tutorials
- Usage
- Setting up Metamask wallet for BPX Chain (Chrome extension)
- Setting up Metamask wallet for BPX Chain (Mobile app)
- Installing and running BPX full node on Windows
- Installing and running BPX full node on Debian / Ubuntu
- Farming
- Development
- Advanced usage
Usage
Setting up Metamask wallet for BPX Chain (Chrome extension)
1. Open MetaMask. Expand the list of available networks.
2. Scroll to the bottom and select "Add a custom network".
3. Fill out the form as follows and click "Save":
Network name: BPX Chain
Default RPC URL: https://rpc.bpxchain.cc
Chain ID: 279
Currency symbol: BPX
Block explorer URL: https://explorer.bpxchain.cc
4. You should see a success notification. Expand the list of available networks again.
5. Select "BPX Chain", which should now be on the list.
6. Your wallet is now ready to use.
Setting up Metamask wallet for BPX Chain (Mobile app)
1. Open MetaMask. Expand the list of available networks.
2. Select "Add Network".
3. Go to the "Custom networks" tab.
4. Fill out the form as follows and confirm:
Network name: BPX Chain
Default RPC URL: https://rpc.bpxchain.cc
Chain ID: 279
Currency symbol: BPX
Block explorer URL: https://explorer.bpxchain.cc
5. Proceed through the next steps by tapping "Confirm", "Switch to network", and "Got it".
6. Your wallet is now ready to use.
Installing and running BPX full node on Windows
1. Download the EXE installers for the latest releases of the Execution Client and Beacon Client.
2. Run the Execution Client installer first. Depending on your Windows version, different warnings may appear. In these cases, click "More info", then select "Run anyway", and "Yes".
3. Follow all the installer steps by clicking "I Agree", "Next" and "Install". Once the installation process is complete, close the installer.
4. A shortcut to the BPX Execution Client will be created in the Start Menu. Launch it from there.
5. Allow the Windows Firewall to open the execution client port. The execution client will start, and you should see its console window.
6. Now run the Beacon Client installer. Navigate through the Microsoft Defender pop-ups as before.
7. Accept the license agreement and proceed through the subsequent installation steps.
8. Once the installation is complete, click the "Get Started" button.
9. Allow to open the required port as before.
10. Beacon Client GUI will be launched. Select the Node mode.
11. At this point, both clients will begin synchronizing with the network. This process may take several hours or even days.
12. Once synchronization is complete, your full node will be ready to operate.
Never stop the Execution Client by closing the console window. Instead, use the Control + C shortcut and wait for the client to save all data to disk and shut down gracefully.
Installing and running BPX full node on Debian / Ubuntu
- Log in as root. Use wget to download the DEB packages for the latest releases of the Execution Client and Beacon Client. Replace X.X.X with the latest versions tags.
wget "https://github.com/bpx-chain/bpx-execution-client/releases/download/X.X.X/bpx-execution-client_X.X.X+stable_amd64.deb"
wget "https://github.com/bpx-chain/bpx-beacon-client/releases/download/X.X.X/bpx-beacon-client-cli_X.X.X-1_amd64.deb"
2. Install both packages. Replace X.X.X with the downloaded versions tags.
dpkg -i bpx-execution-client_X.X.X+stable_amd64.deb bpx-beacon-client-cli_X.X.X-1_amd64.deb
3. Create a new user account for BPX Chain services.
adduser bpxchain
Set a password for the new account. You can leave the additional information fields empty.
4. Switch to the newly created account.
su - bpxchain
5. Initialize the Beacon Client configuration.
bpx init
6. Press Control + D to log out and return to the root console.
7. Create a configuration file for the BPX Execution Client systemd service using any text editor, for example nano:
nano /etc/systemd/system/bpx-execution.service
Insert the following file content:
[Unit]
Description=BPX Execution Client
[Service]
Type=simple
User=bpxchain
ExecStart=bpx-geth --http
Restart=always
[Install]
WantedBy=multi-user.target
Save the file by pressing Control + O and close the editor with Control + X.
8. Follow the same procedure to create a configuration file for the Beacon Client service:
nano /etc/systemd/system/bpx-beacon.service
Insert the following file content:
[Unit]
Description=BPX Beacon Client
[Service]
Type=forking
User=bpxchain
ExecStart=bpx start beacon
ExecStop=bpx stop -d all
Restart=always
[Install]
WantedBy=multi-user.target
9. Reload the system services configuration.
systemctl daemon-reload
10. Enable automatic startup of the BPX Chain services.
systemctl enable bpx-execution
systemctl enable bpx-beacon
11. Start both services.
systemctl start bpx-execution
systemctl start bpx-beacon
12. Your full node has just started and will begin the initial synchronization of the blockchain. This process may take several hours or even days. Use the following command to watch the sync status.
su - bpxchain
watch -n 10 bpx show -s
Farming
Farming BPX on Windows
1. To start farming BPX, you need a fully synchronized full node. If you don’t have one, follow all the steps of this tutorial, but in the step shown in the screenshot below, choose the Farming Mode instead of Node Mode. Then, proceed directly to the Step 4.
2. If you already have a running full node, go to Settings and change the operating mode to Farming.
3. Wait for the additional processes required for farming to start. Allow the Windows Firewall to open the required port, just like during the client installation.
4. Go to the Farming tab. Expand the menu in the upper right corner and select "Manage Farming Rewards".
5. Delete the default zero address and paste your BPX wallet address where you want to receive block rewards, such as your MetaMask wallet address. Save the changes.
6. Go to the Plots tab. Expand the ADD KEY menu and select Import Existing.
7. Enter the mnemonics that were used to create your plots and click Next.
9. Use the "Add Plot Directory" button to add each folder containing your plots. Once all directories are added, click "Close".
10. Farming will begin immediately after adding the first plots directory. You can check whether your plots pass through the filter in the Farming tab.
Farming BPX on Debian / Ubuntu
1. To start farming BPX, you need a fully synchronized full node. If you don’t have one, follow all the steps of this tutorial.
2. Log in as the BPX Chain services user, or switch to this account from the root console with the following command:
su - bpxchain
3. Set the wallet address where you want to receive block rewards. Replace 0xAAAA...
with for instance, your MetaMask address.
bpx rpc beacon set_coinbase '{"coinbase": "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}'
4. Import the key that was used to create your plots. Run the following command and enter the 12 or 24 secret words. You can add an optional label for this key, or simply press Enter to skip.
bpx keys add
5. Use the following command to add all folders with your plots. Replace /mnt/hdd1
with the actual path.
bpx plots add -d /mnt/hdd1
6. Return to the root console. Modify the Beacon Client service configuration using any text editor, for example nano:
nano /etc/systemd/system/bpx-beacon.service
Replace the line:
ExecStart=bpx start beacon
With:
ExecStart=bpx start beacon farmer
Save the file by pressing Control + O and close the editor with Control + X.
7. Reload the system services configuration.
systemctl daemon-reload
8. Restart the Beacon Client with the farmer process enabled.
systemctl restart bpx-beacon
9. Your farmer is active and set to automatically start on system boot. Use the commands below to check the farming status.
su - bpxchain
bpx farm summary
Development
Deploying a smart contract on BPX mainnet using Remix IDE
- Open Remix IDE.
2. In our example, we will use one of the sample contracts from the IDE. This contract provides two functions: the first, store
, allows you to save any number in the contract, while the second, retrieve
, enables you to read the stored number. Open the contracts/1_Storage.sol
file.
3. Compile the contract by right-clicking on the file name and selecting Compile.
4. When the source code is error-free and the compilation is successful, you will see a green success icon.
5. Go to the Deploy tab.
6. Expand the Environment list and select Injected Provider - MetaMask.
7. Now MetaMask will prompt you for permission to connect to Remix IDE. Agree to the connection.
8. After successfully connecting, you should see your account address and its balance in the highlighted field.
9. Click "Deploy" to begin deploying your contract. Confirm the suggested gas settings.
10.In the MetaMask popup window, change the gas settings by clicking on "Site suggested," then select the "Market" option. After that, confirm the transaction.
11. Your contract is now deploying. If you open the MetaMask window, you should see a new pending transaction.
12. Once the transaction is confirmed by the blockchain, you will see its confirmation and a new entry in the Deployed Contracts section. Your contract has been successfully deployed.
13. You can use the highlighted button to copy the address of your new contract.
14. You can interact with your contract directly from the IDE. Expand the list of contract methods to access them.
15. Let's call the first function (store
) to save a number in our sample contract. Enter a random number in the text field next to the "store" button, and then press the "store" button.
16. Confirm the transaction in your wallet as you did when deploying the contract. Saving data to a smart contract requires a transaction on the blockchain.
17. When the transaction is confirmed, call the second method (retrieve
) to read the number stored in the smart contract. Click the "retrieve" button, and the blockchain will return the value stored in the contract.
Advanced usage
Installing a timelord on Debian / Ubuntu
1. To run a timelord, you need a fully synchronized full node. If you don’t have one, follow all the steps of this tutorial.
2. The timelord software is not included in the official binary .deb or .rpm releases. You need to build it from the source code. Log in as root and install the Git client first.
apt-get install git
3. The timelord installer script requires root access to install certain dependencies from APT repositories. Add the BPX Chain services user to the sudoers with the following command:
usermod -a -G sudo bpxchain
4. Switch to the BPX Chain services user account:
su - bpxchain
4. Clone the BPX Beacon Client git repository:
git clone https://github.com/bpx-network/bpx-beacon-client
5. Install the Beacon Client from the source. This process may take several minutes.
cd bpx-beacon-client
. install.sh
6. Install the timelord module:
. install-timelord.sh
7. Press Control + D to log out and return to the root console.
8. Create a configuration file for the timelord systemd service:
nano /etc/systemd/system/bpx-timelord.service
Insert the following file content:
[Unit]
Description=BPX Timelord
[Service]
Type=forking
User=bpxchain
WorkingDirectory=/home/bpxchain/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
9. Reload the system services configuration.
systemctl daemon-reload
10. Enable automatic startup of the new service.
systemctl enable bpx-timelord
Regular Timelord
If you want to run a regular timelord used by BPX consensus algorithm for generating new blocks, simply start the timelord with the 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/bpxchain/.bpxchain/beacon/config/config.yaml
- In the timelord section, set
bluebox_mode
toTrue
- In the beacon section, set
send_uncompact_interval
to recommended value of300
Save the file and exit. Then start the timelord service:
systemctl start bpx-timelord
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
, while blocking access to potentially dangerous RPC methods, such asadmin
orpersonal
--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 period, we will promote it on our website and in other places.