Tutorials
- Usage
- Setting up Metamask wallet for BPX network (Google Chrome extension)
- Setting up Metamask wallet for BPX network (Mobile app)
- Installing and running BPX full node on Windows
- Installing and running BPX full node on Debian / Ubuntu
- Farming
- Development
- Deploying smart contract on BPX mainnet using Remix IDE
- Deploying ERC-20 token on BPX mainnet using Remix IDE
- Advanced usage
Usage
Setting up Metamask wallet for BPX network (Google Chrome extension)
- Find Metamask in Chrome Web Store. Click "Add to Chrome" to begin installation.
2. Confirm installation in pop-up window and wait for the installation to complete.
3. On the welcome screen, accept the terms of use and select "Create a new wallet".
4. On the next screen, choose whether you consent to some usage statistics be collected by the wallet developers or not. For example, we choose "No thanks".
5. Set a password that will be used to unlock the wallet and accept transactions. Tick the password recovery warning checkbox and click "Create a new wallet".
6. On the next screen, click "Secure my wallet (recommended)".
7. Use the "Reveal Secret Recovery Phrase" button to see the generated secret words. Write down this 12 words and save it a place that you trust and only you can access. You will need them every time you want to log in to your wallet again on a new device or after reinstalling.
8. In the next step, the wallet will check if you have saved the secret words. You have to fill in the missing ones.
9. Go through the next informational steps and close the "What's new" window. You should see the main wallet screen. Now we will add the BPX network to the wallet. Expand "Ethereum Mainnet" and select "Add network".
10. Scroll to the bottom of the list and select "Add a network manually".
11. Complete the form as follows and click "Save":
Network name: BPX V3
New RPC URL: https://rpc.bpxchain.cc
Chain ID: 279
Currency symbol: BPX
Block explorer URL: https://explorer.bpxchain.cc
12. In the popup window select "Switch to BPX V3". Your wallet is now ready to use.
13. For convenience, you can pin the Metamask icon to be always visible
14. To copy your full wallet receiving address, click on the "Account 1" header.
Setting up Metamask wallet for BPX network (Mobile app)
- Install Metamask from App Store / Google Play.
- Open the app. Tap Get started on the welcome screen.
3. Select "Create a new wallet".
4. On the next screen, choose whether you consent to some usage statistics be collected by the wallet developers or not. For example, we choose "No thanks".
5. Scroll down the terms of use, tick a checkbox and tap Accept.
6. Set a password that will be used to unlock the wallet and accept transactions. Optionally enable unlocking with Face ID. Tick the password recovery warning checkbox and tap "Create password".
7. On the next two screens, select "Start" to backup your wallet keys.
8. Use the "View" button to see the generated secret words. Write down this 12 words and save it a place that you trust and only you can access. You will need them every time you want to log in to your wallet again on a new device or after reinstalling.
9. In the next step, the wallet will check if you have saved the secret words. You have to click on all of them in the same order as they were previously shown.
10. Go through the next informational steps by tapping "Done", "Enable aytomatic security checks" and "No, Thanks". You should see the main wallet screen.
11. Now we will add the BPX network to the wallet. Expand "Ethereum Main Network" on the top of the screen and select "Add a network".
12. Switch to the "Custom networks" tab.
13. Complete the form as follows and click "Add":
Network Name: BPX V3
RPC Url: https://rpc.bpxchain.cc
Chain ID: 279
Symbol: BPX
Block explorer URL: https://explorer.bpxchain.cc
14. In the popup window tap "Got it". Your wallet is now ready to use.
15. To copy your full wallet receiving address, tap "Receive".
Installing and running BPX full node on Windows
- Download the Execution Client and Beacon Client latest releases EXE installers.
2. Go to your Downloads folder. There should be two installers there. Run the execution client installer first.
3. Different warnings may appear depending on the Windows version. In such cases, select "More info", "Run anyway" and "Yes".
4. Accept the license. Go through all installer steps by clicking "Next" and "Install". When the installation process is finished, close the installer.
5. A shortcut to BPX Execution Client will appear in the Start Menu. Launch it.
6. Allow the Windows firewall to open the execution client port. Execution client will be started. You should see its console output window.
7. Now start the Beacon Client installer. Confirm pop-up warnings as before.
8. Accept the license, go through the next installation steps.
9. When the installation is finished, click the "Get Started" button.
10. Agree to open the beacon client port as before.
11. Beacon Client GUI will be launched. Select Node mode.
12. At this point, both clients will start synchronizing with the network. This may take many hours or days.
13. When synchronization is finished, your full node is ready to work. You'll know it by the green "Synced" status.
14. When you need to stop your full node, it's highly recommended to close the beacon client first, then the execution client. To start it again, run the execution client first, then the beacon client.
Never stop the Execution Client by closing the console window. Use the Control + C shortcut and wait for the client to close itself.
Installing and running BPX full node on Debian / Ubuntu
- Check latest versions of BPX Execution Client and Beacon Client. Log in as root. Download both DEB packages by following commands. Replace X.X.X to latest versions tags.
wget https://github.com/bpx-chain/bpx-execution-client/releases/download/X.X.X/bpx-execution-client_X.X.X-stable+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 execution client and beacon client. Replace X.X.X to latest versions tags.
dpkg -i bpx-execution-client_X.X.X-stable+stable_amd64.deb bpx-beacon-client-cli_X.X.X-1_amd64.deb
3. Create new user for BPX services
adduser bpxv3
Create any password. You can skip entering additional information about the user by pressing Enter each time. Answer "Y" when asked if the information is correct.
4. Switch to the newly created account
su - bpxv3
5. Initialize Beacon Client configuration
bpx init
6. Press Control + D to log out and return to the root console.
7. Create the execution client service descriptor file using for example nano editor
nano /etc/systemd/system/bpx-execution.service
Insert the following file content:
[Unit]
Description=BPX Execution Client
[Service]
Type=simple
User=bpxv3
ExecStart=bpx-geth --syncmode snap --http
Restart=always
[Install]
WantedBy=multi-user.target
Save the file by pressing Control + O and close the editor with Control + X.
8. Create the beacon client service descriptor file:
nano /etc/systemd/system/bpx-beacon.service
Insert the following file content:
[Unit]
Description=BPX Beacon Client
[Service]
Type=forking
User=bpxv3
ExecStart=bpx start node
ExecStop=bpx stop -d all
Restart=always
[Install]
WantedBy=multi-user.target
Save the file and close the editor.
9. Refresh startup services configuration
systemctl daemon-reload
10. Activate automatic startup of BPX services
systemctl enable bpx-execution
systemctl enable bpx-beacon
11. Launch both services
systemctl start bpx-execution
systemctl start bpx-beacon
12. Your full node is already working and configured to automatically start on system boot. Use the commands below to watch the initial sync status (it will refresh every 10 seconds).
su - bpxv3
watch -n 10 bpx show -s
13. After a few hours or days, the initial sync should complete.
Farming
Farming BPX on Windows
- To start farming you need a working and synchronized full node. If you don't already have it, follow all the steps of this tutorial first, but in the step from screenshot below, choose Farming Mode instead. Then go to the Step 4.
2. If you already have running full node go to Settings and switch the working mode to Farming.
3. Wait for the additional processes needed for farming to start. You need to confirm opening the port on the Windows firewall, just like during the installation.
4. Go to the Farming tab. Expand the menu in upper right corner and select Manage farming rewards.
5. Delete the default null address and paste there your BPX wallet address, e.g. Metamask. You will be receiving all farming rewards to this address. Click Save.
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 where you have plots. When all directories are added, click Close.
10. Farming will start immediately after adding the first plots directory. You can check whether plots pass through the filter in the Farming tab. Sometimes it may be necessary to restart the BPX Beacon Client GUI for farming to start.
Farming BPX on Debian / Ubuntu
1. To start farming you need a working and synchronized full node. If you don't already have it, follow all the steps of this tutorial first.
2. Login as root. Switch to BPX services user
su - bpxv3
3. Use this command to set farming rewards target address. Replace 0xAAAA... with your correct wallet address.
bpx rpc beacon set_coinbase '{"coinbase": "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}'
4. Import key that was used to create your plots. Execute the following command and type 12 or 24 secret words. Press Enter. Add optional label for this key or just press Enter second time.
bpx keys add
5. Use the following command to add each folder where you have plots. Replace /mnt/hdd1
with your path.
bpx plots add -d /mnt/hdd1
6. Press Control + D to log out and return to the root console.
7. Modify the beacon client service descriptor file using for example nano editor
nano /etc/systemd/system/bpx-beacon.service
Replace the line:
ExecStart=bpx start node
To:
ExecStart=bpx start node farmer
Save the file by pressing Control + O and close the editor with Control + X.
8. Refresh startup services configuration
systemctl daemon-reload
9. Restart beacon client to run with the farmer enabled.
systemctl restart bpx-beacon
10. Your farmer is active and configured to automatically start on system boot. Use the commands below to check farming status.
su - bpxv3
bpx farm summary
Development
Deploying smart contract on BPX mainnet using Remix IDE
- Open the Remix IDE.
2. In our example, we will use one of the test smart contracts that is already uploaded into the IDE. Open contracts/1_Storage.sol
file.
On the right you can see the contract source code. This contract provides two functions. The first (store
) allows you to save any number in the contract, and the second (retrieve
) allows you to read it.
3. Compile the contract by right-clicking on the file name, then select Compile.
4. When the source code does not contain any errors and 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 ask you for permission to connect to the Remix IDE. Agree to connect.
8. After successfully connecting, you should see your account address and its balance in the marked field.
9. Click Deploy to start 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. Then confirm the transaction.
11. Your contract is now deploying. If you open the Metamask window, you should see the new pending transaction.
12. Once the transaction is confirmed by blockchain, you will see its confirmation and a new item in the Deployed Contracts section. Your contract is deployed.
13. You can use the marked button to copy the address of your new contract to interact with it in the future.
14. Now you can test the contract by calling its functions. Expand the list of contract methods.
15. Let's call the first function (store
) to save any number in the contract. Enter random number in the text field next to the store button. Then press the store button.
16. Confirm the transaction in your wallet in the same way as 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 function (retrieve
) to read the number stored in the smart contract. Click the retrieve function button. The blockchain will return the value stored in the contract.
Deploying ERC-20 token on BPX mainnet using Remix IDE
- Open the Remix IDE. Expand the workspaces menu and select Create.
2. Select the OpenZeppelin / ERC20 template.
3. Configure your token features.
- Check Mintable to be able to mint further units of the token to any address at any time.
- Check Burnable to be able to burn token units.
- Check Pausable to be able to pause token transfers for all token holders.
In the Upgradeability section, you can configure the possibility of updating your token contract in the future. This is an advanced option that we won't cover in the beginner tutorial.
In the Workspace name field, enter the name of your project.
Confirm with the OK button.
4. The IDE will generate the token contract source code. Change the contract name, token name and token symbol.
5. Rename the contract file to match the contract name, in our case TutorialToken.sol
.
6. Compile and deploy the token contract. We explained how to do it in another tutorial.
7. The token contract is already on the blockchain. Now we will mint 100 TTK to our wallet. Expand the contract method named mint
. Enter your wallet address in to:
field. In the amount:
field enter the amount of token you want to mint. Keep in mind that the token has 18 decimal places by default, and the amount is entered in the smallest units. So enter 100 followed by 18 zeros to mint 100 TTK.
8. Click transact and confirm the transaction in your wallet. Wait for its confirmation by the blockchain.
9. Copy your token's contract address. You will always need it to add a token to the wallet.
10. Now open Metamask, go to Assets and select Import tokens.
11. Paste the token contract address. The other fields will be automatically read from the blockchain. Click Add custom token and Import tokens.
12. Done. The token is visible in your wallet. You can send and receive it to other addresses just like a native BPX token. Keep in mind that your wallet is the smart contract owner and only this wallet can call mint
function in the future to mint new token units or burn
function to burn them.
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
- 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:
systemctl start bpx-timelord
How to set up 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 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
, meanwhile it blocks access to dangerous RPC methods, e.g.admin
orpersonal
--http.corsdomain "*"
allows your RPC endpoint to be used in dApps in all domains
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.