• APIs and Libraries
    APIs and Libraries
  • Connect WX Network wallet
    Connect WX Network wallet
  • CCXT
    CCXT
  • Fees
    Fees
  • Matcher
    • WX Network Protocol
      WX Network Protocol
    • Matcher Fee
      Matcher Fee
    • Install Matcher on Ubuntu From Deb-package
      Install Matcher on Ubuntu From Deb-package
    • Matcher Settings
      Matcher Settings
    • Matcher API
      • Order Validation
        Order Validation
      • Exchange Transation Validation
        Exchange Transation Validation
      Matcher API
    • Matcher WebSocket API
      • Errors and Debugging
        Errors and Debugging
      • Common Streams
        Common Streams
      Matcher WebSocket API
    Matcher
  • Gateway API
    • Access Token
      • Get Access Token in WX Network App
        Get Access Token in WX Network App
      • POST /v1/oauth2/token
        POST /v1/oauth2/token
      Access Token
    • Deposit
      • [Deprecated] GET /v1/deposit/addresses/{currency}
        [Deprecated] GET /v1/deposit/addresses/{currency}
      • GET /v1/deposit/addresses/{currency}/{platform}
        GET /v1/deposit/addresses/{currency}/{platform}
      • GET /v1/deposit/currencies
        GET /v1/deposit/currencies
      • [Deprecated] GET /v1/deposit/currencies/{currency}
        [Deprecated] GET /v1/deposit/currencies/{currency}
      • GET /v1/deposit/currencies/{currency}/{platform}
        GET /v1/deposit/currencies/{currency}/{platform}
      • Terms of Deposit
        Terms of Deposit
      Deposit
    • Withdraw
      • [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
        [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
      • GET /v1/withdraw/addresses/{currency}/{address}/{platform}
        GET /v1/withdraw/addresses/{currency}/{address}/{platform}
      • GET /v1/withdraw/currencies
        GET /v1/withdraw/currencies
      • [Deprecated] GET /v1/withdraw/currencies/{currency}
        [Deprecated] GET /v1/withdraw/currencies/{currency}
      • GET /v1/withdraw/currencies/{currency}/{platform}
        GET /v1/withdraw/currencies/{currency}/{platform}
      • Terms of Withdrawal
        Terms of Withdrawal
      Withdraw
    • Movements History
      Movements History
    • Platforms List
      Platforms List
    • Error Codes
      Error Codes
    Gateway API
  • Get Trades
    Get Trades
  • Staking Annual Percentage Yield API
    Staking Annual Percentage Yield API
  • Payment API
    Payment API
  • Web Auth API
    Web Auth API
  • WX Token Protocol
    WX Token Protocol
  • Glossary
    Glossary
      • English
      • Русский
      On this page
        • System Requirements
        • Checking the Version of the Installed OpenJDK
        • OpenJDK Version 8 Installation
        • Node installation
        • Node setup
        • Installing matcher

          # Install Matcher on Ubuntu From Deb-package

          WX Network Matcher executes orders on buying/selling a token. Everyone can deploy matcher and start getting a reward from executing orders.

          Let's review the order execution process.

          1. Matcher receives an order to buy/sell some token pair. The order contains information about token A amount and its price, expressed in token B amount.
          2. Matcher accumulates the orders in the order book. When a new order is received, the matcher matches it with the present orders and tries to find mutually satisfying orders.
          3. If mutually satisfying orders are found, then the matcher sends the exchange transaction to the blockchain. As a result, the mentioned orders are being executed. If the mutually satisfying orders are not found, then the new order is sent to the order book.
          4. Matcher gets a matcher fee from each sender of the executed orders.
          5. Matcher repays exchange transaction fee to the miner. Matcher reward is the difference between the matcher fee and the exchange transaction fee.

          The current article considers deploying matcher from deb-package. Because matcher is a node extension, the node must be deployed prior to the matcher activation.

          # System Requirements

          • 2 core CPU
          • 4 GB RAM
          • 50 GB HDD

          # Checking the Version of the Installed OpenJDK

          Make sure that you have OpenJDK version 8 installed. To do so, execute the following command in the console:

          java -version 2>&1 | grep "openjdk version \"1.8" | wc -l
          

          If 0 is being displayed, then proceed to OpenJDK version 8 installation step.

          If 1 is being displayed, then proceed to Node installation.

          # OpenJDK Version 8 Installation

          To install OpenJDK version 8, execute in the console:

          sudo apt-get update
          sudo apt-get install openjdk-8-jre
          

          # Node installation

          1. Download the latest version of waves_<version>_all.deb file from https://github.com/wavesplatform/Waves/releases.

          2. Execute in the console

            sudo dpkg -i /path/to/waves_<version>_all.deb
            
          3. Move to /var/lib/waves folder by executing

            cd /var/lib/waves
            

          # Node setup

          1. Open the /usr/share/waves/conf/waves.conf file using the following command:

            sudo nano /usr/share/waves/conf/waves.conf
            
          2. Decide whether the existing or new account should be used for the node. Use the existing account if you plan to use your node as a mining node.

            • To use a new account, uncomment in wallet section the password parameter and set a value for it. Example:

              wallet {
                # Password to protect wallet file
                password = iAmGoingToUseAnewAccount
                # Wallet seed as BASE58 string
                # seed =
              }
              
            • To use an existing account, input in wallet section the password and, in base58 encoding, the seed.

              wallet {
                # Password to protect wallet file
                password = iAmGoingToUseAnExistingAccount
                # Wallet seed as BASE58 string
                seed = 35S7EzKMHMN4JQyWnwpp84Zot1yqLoP2Q46RsbYRzgFq7n8AiV8L6skeGPq93P2NU4pGcZFeNTAT2TKJTa2XvqRwSdCmBR556MBmtZ3ggAkBtd3CCZFvZwZufz1ZqfzJQ
              }
              
          3. Add to /usr/share/waves/conf/waves.conf file the section:

            waves.extensions = ["com.wavesplatform.dex.Matcher"]
            
          4. Set in /usr/share/waves/conf/waves.conf file in rest_api section the following parameters:

            • enable = yes
            • api_key_hash = " "
            rest-api {
              # Disable node’s REST API
              enable = yes
              …
              api_key_hash = " "
            }
            
          5. Start node by executing the following command:

            sudo systemctl start waves
            
          6. Generate non-empty api_key_hash value. Execute command:

            curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '<YOUR_ARBITRARY_STRING>' '127.0.0.1:6869/utils/hash/secure'
            

            Please use your own value instead of <YOUR_ARBITRARY_STRING>. It is recommended to store it. As a result, you will see the following output:

            {"message": "YOUR_ARBITRARY_STRING", "hash": "3QbuM9nJP9GZQDekgfGboPGDQe4g1nsH4kmK2jbCLAFJ"}
            
          7. Set in the /usr/share/waves/conf/waves.conf file in the rest_api section the value of api_key_hash parameter:

            rest-api {
              …
              api_key_hash = “3QbuM9nJP9GZQDekgfGboPGDQe4g1nsH4kmK2jbCLAFJ”
            }
            
          8. Restart the node by executing the following command:

            sudo systemctl restart waves
            
          9. Make sure that blockchain is downloaded. Execute the following command:

            sudo journalctl -u waves -f
            

            As a result, the blockchain download log will be displayed. If "microblock appended" entries started to appear in the log, then blockchain is completely downloaded.

          10. Press Ctrl-C to close the log.

          11. Discover the node account address. To do so, execute the following command:

          curl 127.0.0.1:6869/addresses
          

          As a result, the node account address will be displayed, for example, 3PAbvhnSesJGUd1Ry6YM1qCALTSD4pYGxG.

          1. Execute the following steps in /usr/share/waves/conf/waves.conf file:

            1. Create a waves.dex section.
            2. Set the node account address for matcher. To do so, assign in waves.dex section the value obtained in the previous step to account parameter.
            waves.dex {
              account = "3PAbvhnSesJGUd1Ry6YM1qCALTSD4pYGxG"
              # bind-address = "0.0.0.0" # uncomment this line to accept connections from any host
            }
            

          Other node parameters are out of the scope of the current article. To get more information about node parameters, refer to Node Configuration (opens new window).

          # Installing matcher

          1. Download the latest version of dex_<version>_all.deb file from https://github.com/wavesplatform/dex/releases (opens new window).

          2. Execute the following command in the console:

            sudo dpkg -i /path/to/dex_<version>_all.deb
            
          3. Restart the node by executing:

            sudo systemctl restart waves
            
          4. Make sure that matcher is successfully started. To do so, execute:

            curl 127.0.0.1:6886/matcher
            

          As a result, the matcher account address will be displayed. Congratulations, you've successfully installed the matcher.

          Matcher Fee
          Matcher Settings
          Matcher Fee
          Matcher Settings