Tutorials

Usage

Usage

Setting up Metamask wallet for BPX network (Google Chrome extension)

  1. Find Metamask in Chrome Web Store. Click "Add to Chrome" to begin installation.

VirtualBox_Win10_07_06_2023_14_37_41.png

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".

VirtualBox_Win10_07_06_2023_14_45_08.png

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".

VirtualBox_Win10_07_06_2023_14_49_13.png

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".

VirtualBox_Win10_07_06_2023_14_50_24.png

6. On the next screen, click "Secure my wallet (recommended)".

VirtualBox_Win10_07_06_2023_14_52_25.png

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.

VirtualBox_Win10_07_06_2023_14_53_46.png

8. In the next step, the wallet will check if you have saved the secret words. You have to fill in the missing ones.

VirtualBox_Win10_07_06_2023_15_00_15.png

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".

VirtualBox_Win10_07_06_2023_15_03_20.png

10. Scroll to the bottom of the list and select "Add a network manually".

VirtualBox_Win10_07_06_2023_15_05_10.png

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

VirtualBox_Win10_07_06_2023_15_06_47.png

12. In the popup window select "Switch to BPX V3". Your wallet is now ready to use.

VirtualBox_Win10_07_06_2023_15_08_31.png

13. For convenience, you can pin the Metamask icon to be always visible

VirtualBox_Win10_07_06_2023_15_11_14.png

14. To copy your full wallet receiving address, click on the "Account 1" header.

VirtualBox_Win10_07_06_2023_15_13_21.png

Usage

Setting up Metamask wallet for BPX network (Mobile app)

  1. Install Metamask from App Store / Google Play.
  2. Open the app. Tap Get started on the welcome screen.

099AC79C-88D7-4AAD-B148-0B04AFD16F32.png

3. Select "Create a new wallet".

49BB4FBE-679A-48EB-9AA7-079B393A0718.png

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".

C205A67E-C89B-4449-8C91-753733B62C3A.png

5. Scroll down the terms of use, tick a checkbox and tap Accept.

75DD8433-9F79-4E11-9D7B-0A872D9B3664.png

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".

49D8C6B8-BDED-4B40-B541-969BF54E23E6.png

7. On the next two screens, select "Start" to backup your wallet keys.

3607ADB6-29AF-4D44-BB41-50D355DE5D4F.png32586A9A-F0C8-4B56-B5B0-DAB6E7032260.png

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.

285F2924-1A51-41A7-B59F-0A013D68D552.png

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.

F094C470-BECD-4D8D-A074-74CB37B67E7B.png

10. Go through the next informational steps by tapping "Done", "Enable aytomatic security checks" and "No, Thanks". You should see the main wallet screen.

0E518EBA-3410-4F53-8FBA-B0E15FF44524.png0DDFA3E8-1AB7-446B-98FF-FF6FF5227261.png865FF662-DC4B-4281-99DB-3D79A2A28C32.png

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".

7F64E26E-AF98-4FFE-AB7E-8CC8FE2EFDF1.png

12. Switch to the "Custom networks" tab.

06F201F7-7598-4E1B-8403-8430B9E0C2B8.png

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

05FB4B82-9525-488D-AFBF-C2DFFCAB336B.png

14. In the popup window tap "Got it". Your wallet is now ready to use.

4A337917-E9E8-4E44-A162-D3A60E69A796.png

15. To copy your full wallet receiving address, tap "Receive".

A7CFDD0C-88B8-4F08-B63F-3D27BA4D6730.png

Usage

Installing and running BPX full node on Windows

  1. Download the Execution Client and Beacon Client latest releases EXE installers.

VirtualBox_Win10_07_06_2023_15_18_56.png

VirtualBox_Win10_07_06_2023_15_18_19.png

2. Go to your Downloads folder. There should be two installers there. Run the execution client installer first.

VirtualBox_Win10_07_06_2023_15_21_06.png

3. Different warnings may appear depending on the Windows version. In such cases, select "More info", "Run anyway" and "Yes".

VirtualBox_Win10_07_06_2023_15_22_29.png

VirtualBox_Win10_07_06_2023_15_22_58.png

VirtualBox_Win10_07_06_2023_15_24_22.png

4. Accept the license. Go through all installer steps by clicking "Next" and "Install". When the installation process is finished, close the installer.

VirtualBox_Win10_07_06_2023_15_27_05.png

VirtualBox_Win10_07_06_2023_15_28_06.png

5. A shortcut to BPX Execution Client will appear in the Start Menu. Launch it.

VirtualBox_Win10_07_06_2023_15_30_15.png

6. Allow the Windows firewall to open the execution client port. Execution client will be started. You should see its console output window.

VirtualBox_Win10_07_06_2023_15_35_47.png

VirtualBox_Win10_07_06_2023_15_35_59.png

7. Now start the Beacon Client installer. Confirm pop-up warnings as before.

VirtualBox_Win10_07_06_2023_15_39_55.png

8. Accept the license, go through the next installation steps.

VirtualBox_Win10_07_06_2023_15_41_00.png

9. When the installation is finished, click the "Get Started" button.

VirtualBox_Win10_07_06_2023_15_41_44.png

10. Agree to open the beacon client port as before.

VirtualBox_Win10_07_06_2023_15_42_57.png

11. Beacon Client GUI will be launched. Select Node mode.

VirtualBox_Win10_07_06_2023_15_56_13.png

12. At this point, both clients will start synchronizing with the network. This may take many hours or days.

VirtualBox_Win10_07_06_2023_15_57_39.png

VirtualBox_Win10_07_06_2023_15_58_58.png

13. When synchronization is finished, your full node is ready to work. You'll know it by the green "Synced" status.

VirtualBox_Win10_08_06_2023_01_46_36.png

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.
VirtualBox_Win10_08_06_2023_10_34_18.png

Usage

Installing and running BPX full node on Debian / Ubuntu

  1. 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

VirtualBox_Debian_09_06_2023_11_16_04.png

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.

VirtualBox_Debian_09_06_2023_11_20_24.png

4. Switch to the newly created account

su - bpxv3

5. Initialize Beacon Client configuration

bpx init

VirtualBox_Debian_09_06_2023_11_24_02.png

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

VirtualBox_Debian_09_06_2023_11_42_06.png

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

VirtualBox_Debian_09_06_2023_11_51_29.png

13. After a few hours or days, the initial sync should complete.

VirtualBox_Debian_09_06_2023_23_22_40.png

Farming

Farming

Farming BPX on Windows

  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, but in the step from screenshot below, choose Farming Mode instead. Then go to the Step 4.

VirtualBox_Win10_07_06_2023_15_56_13.png

2. If you already have running full node go to Settings and switch the working mode to Farming.

VirtualBox_Win10_08_06_2023_11_11_06.png

VirtualBox_Win10_08_06_2023_11_13_54.png

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.

VirtualBox_Win10_08_06_2023_11_14_07.png

4. Go to the Farming tab. Expand the menu in upper right corner and select Manage farming rewards.

VirtualBox_Win10_08_06_2023_11_18_19.png

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.

VirtualBox_Win10_08_06_2023_11_20_38.png

6. Go to the Plots tab. Expand the ADD KEY menu and select Import Existing.

VirtualBox_Win10_08_06_2023_11_28_25.png

7. Enter the mnemonics that were used to create your plots and click Next.

VirtualBox_Win10_08_06_2023_11_30_09.png

8. Expand the menu in right top corner and select Add Plot Directory.

VirtualBox_Win10_08_06_2023_11_33_49.png

9. Use the Add Plot Directory button to add each folder where you have plots. When all directories are added, click Close.

VirtualBox_Win10_08_06_2023_11_35_10.png

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

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"}'

VirtualBox_Debian_11_06_2023_14_39_08.png

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

VirtualBox_Debian_11_06_2023_14_34_30.png

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

VirtualBox_Debian_11_06_2023_14_44_00.png

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.

VirtualBox_Debian_11_06_2023_14_50_19.png

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

Development

Deploying smart contract on BPX mainnet using Remix IDE

  1. Open the Remix IDE.

remix1.png

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.

remix2.png

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.

remix3.png

4. When the source code does not contain any errors and compilation is successful, you will see a green success icon.

remix4.png

5. Go to the Deploy tab.

remix5.png

6. Expand the Environment list and select Injected Provider - MetaMask.

remix6.png

7. Now Metamask will ask you for permission to connect to the Remix IDE. Agree to connect.

remix7.pngremix8.png

8. After successfully connecting, you should see your account address and its balance in the marked field.

remix9.png

9. Click Deploy to start deploying your contract. Confirm the suggested gas settings.

remix10.png

10. In the Metamask popup window, change the gas settings by clicking on Site suggested, then select the Market option. Then confirm the transaction.

remix11.pngremix12.pngremix13.png

11. Your contract is now deploying. If you open the Metamask window, you should see the new pending transaction.

remix14.png

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.

remix15.png

13. You can use the marked button to copy the address of your new contract to interact with it in the future.

remix16.png

14. Now you can test the contract by calling its functions. Expand the list of contract methods.

remix17.png

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.

remix18.png

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.

remix19.png

Development

Deploying ERC-20 token on BPX mainnet using Remix IDE

  1. Open the Remix IDE. Expand the workspaces menu and select Create.

token1.png

2. Select the OpenZeppelin / ERC20 template.

token2.png

3. Configure your token features.

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.

token3.png

4. The IDE will generate the token contract source code. Change the contract name, token name and token symbol.

token4.png

token5.png

5. Rename the contract file to match the contract name, in our case TutorialToken.sol.

token6.png

6. Compile and deploy the token contract. We explained how to do it in another tutorial.

token7.png

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.

token8.png

8. Click transact and confirm the transaction in your wallet. Wait for its confirmation by the blockchain.

token9.png

9. Copy your token's contract address. You will always need it to add a token to the wallet.

token10.png

10. Now open Metamask, go to Assets and select Import tokens.

token11.png

11. Paste the token contract address. The other fields will be automatically read from the blockchain. Click Add custom token and Import tokens.

token12.pngtoken13.png

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.

token14.png

Advanced usage

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
Advanced usage

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.