Tutorials

Usage

Usage

Setting up Metamask wallet for BPX Chain (Chrome extension)

    1. Open MetaMask. Expand the list of available networks.

    metamask-chrome1.jpg

    2. Scroll to the bottom and select "Add a custom network".

    metamask-chrome2.jpg

    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

    metamask-chrome3.jpg

    4. You should see a success notification. Expand the list of available networks again.

    metamask-chrome4.jpg

    5. Select "BPX Chain", which should now be on the list.

    metamask-chrome5.jpg

    6. Your wallet is now ready to use.

    metamask-chrome6.jpg

    Usage

    Setting up Metamask wallet for BPX Chain (Mobile app)

      1. Open MetaMask. Expand the list of available networks.

      metamask-mobile1.PNG

      2. Select "Add Network".

      metamask-mobile2.PNG

      3. Go to the "Custom networks" tab.

      metamask-mobile3.PNG

      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

      metamask-mobile4.PNG

      5. Proceed through the next steps by tapping "Confirm", "Switch to network", and "Got it".

      metamask-mobile5.PNG metamask-mobile6.PNG metamask-mobile7.PNG

      6. Your wallet is now ready to use.

      metamask-mobile8.PNG

      Usage

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

      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

      3. Follow all the installer steps by clicking "I Agree", "Next" and "Install". Once the installation process is complete, close the installer.

      VirtualBox_Win10_07_06_2023_15_27_05.png

      VirtualBox_Win10_07_06_2023_15_28_06.png

      4. A shortcut to the BPX Execution Client will be created in the Start Menu. Launch it from there.

      VirtualBox_Win10_07_06_2023_15_30_15.png

      5. Allow the Windows Firewall to open the execution client port. The execution client will start, and you should see its console window.

      VirtualBox_Win10_07_06_2023_15_35_47.png

      VirtualBox_Win10_07_06_2023_15_35_59.png

      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.

      VirtualBox_Win10_07_06_2023_15_39_55.png

      VirtualBox_Win10_07_06_2023_15_41_00.png

      8. Once the installation is complete, click the "Get Started" button.

      VirtualBox_Win10_07_06_2023_15_41_44.png

      9. Allow to open the required port as before.

      VirtualBox_Win10_07_06_2023_15_42_57.png

      10. Beacon Client GUI will be launched. Select the Node mode.

      VirtualBox_Win10_07_06_2023_15_56_13.png

      11. At this point, both clients will begin synchronizing with the network. This process may take several hours or even days.

      VirtualBox_Win10_07_06_2023_15_57_39.png

      VirtualBox_Win10_07_06_2023_15_58_58.png

      12. Once synchronization is complete, your full node will be ready to operate.

      VirtualBox_Win10_08_06_2023_01_46_36.png


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

      Usage

      Installing and running BPX full node on Debian / Ubuntu

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

      node-debian1.png

      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

      node-debian2.png

      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.

      node-debian3.png

      4. Switch to the newly created account.

      su - bpxchain

      5. Initialize the Beacon Client configuration.

      bpx init

      node-debian4.png

      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

      node-debian5.png

      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

      node-debian6.png


      Farming

      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.

      VirtualBox_Win10_07_06_2023_15_56_13.png

      2. If you already have a running full node, go to Settings and change the operating 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 required for farming to start. Allow the Windows Firewall to open the required port, just like during the client installation.

      VirtualBox_Win10_08_06_2023_11_14_07.png

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

      VirtualBox_Win10_08_06_2023_11_18_19.png

      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.

      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 containing your plots. Once all directories are added, click "Close".

      VirtualBox_Win10_08_06_2023_11_35_10.png

      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

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

      farming-debian1.png

      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

      farming-debian2.png

      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

      farming-debian3.png

      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.

      farming-debian4.png

      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

      Development

      Deploying a smart contract on BPX mainnet using Remix IDE

      1. Open Remix IDE.

      remix1.png

      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.

      remix2.png

      3. Compile the contract by right-clicking on the file name and selecting Compile.

      remix3.png

      4. When the source code is error-free and the 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 prompt you for permission to connect to Remix IDE. Agree to the connection.

      remix7.pngremix8.png

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

      remix9.png

      9. Click "Deploy" to begin 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. After that, confirm the transaction.

      remix11.png remix12.png remix13.png

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

      remix14.png

      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.

      remix15.png

      13. You can use the highlighted button to copy the address of your new contract.

      remix16.png

      14. You can interact with your contract directly from the IDE. Expand the list of contract methods to access them.

      remix17.png

      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.

      remix18.png

      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.

      remix19.png

      Advanced usage

      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

      Save the file and exit. Then start the timelord service:

      systemctl start bpx-timelord
      Advanced usage

      Setting up a 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 bpx-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 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.