• User Guide
    • Security Notes
      Security Notes
    • Online/Desktop Apps
      • Account Management
        • Create Account
          Create Account
        • Log in to Account
          Log in to Account
        • Backup Seed Phrase
          Backup Seed Phrase
        • Recover Account
          Recover Account
        • Find Out Your Address
          Find Out Your Address
        • Create Personal Alias
          Create Personal Alias
        • Import From Keeper Wallet
          Import From Keeper Wallet
        • Use Ledger Nano Devices With WX Network
          Use Ledger Nano Devices With WX Network
        Account Management
      • Token Management
        • Deposit & Withdraw Tokens
          • Transactions Tab
            Transactions Tab
          Deposit & Withdraw Tokens
        • Create Token
          Create Token
        • Mass Transfer
          Mass Transfer
        • Reissue Token
          Reissue Token
        • Change Reissuable to Not Reissuable
          Change Reissuable to Not Reissuable
        • Burn Token
          Burn Token
        • Sponsored Transaction
          Sponsored Transaction
        • Sponsored Fee
          Sponsored Fee
        • Swap Tokens
          Swap Tokens
        Token Management
      • Investment Tools
        • Stake Tokens
          • How to Get XTN (Quick Guide)
            How to Get XTN (Quick Guide)
          • How to Get USDT/USDC/BTC/ETH (Quick Guide)
            How to Get USDT/USDC/BTC/ETH (Quick Guide)
          Stake Tokens
        • Lambo Investments
          Lambo Investments
        • Algorithmic Trading
          Algorithmic Trading
        Investment Tools
      • Liquidity Pools
        • How to Maximize Passive Income from Liquidity Pools?
          How to Maximize Passive Income from Liquidity Pools?
        • How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
          How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
        • How to Stake/Unstake LP Tokens?
          How to Stake/Unstake LP Tokens?
        • How to Claim LP Staking Reward in WX?
          How to Claim LP Staking Reward in WX?
        • How to Stake WX Token to Boost LP Staking Reward?
          How to Stake WX Token to Boost LP Staking Reward?
        • How to Claim WX Staking Reward?
          How to Claim WX Staking Reward?
        • WX Token Protocol
          WX Token Protocol
        Liquidity Pools
      • Voting
        Voting
      • Advanced Features
        • Script Transaction
          Script Transaction
        • JSON Confirmation
          JSON Confirmation
        Advanced Features
      • Start Trading on WX Network
        Start Trading on WX Network
      Online/Desktop Apps
    • Mobile Apps
      • WX Network App
        WX Network App
      • Waves.Exchange App
        • Account Management
          • Create Account
            Create Account
          • Log in to Account
            Log in to Account
          • Recover Account
            Recover Account
          • Find Out Your Address
            Find Out Your Address
          • Create Personal Alias
            Create Personal Alias
          Account Management
        • Token Management
          • Deposit & Withdraw Tokens
            Deposit & Withdraw Tokens
          • Burn Token
            Burn Token
          Token Management
        • Start Trading on WX Network
          Start Trading on WX Network
        Waves.Exchange App
      • WX Invest App
        WX Invest App
      Mobile Apps
    • Working With MetaMask in Waves Network
      Working With MetaMask in Waves Network
    • WX Referral Program
      WX Referral Program
    User Guide
  • API and Library
    • CCXT
      CCXT
    • Fees
      Fees
    • Payment API
      Payment API
    • Web Auth API
      Web Auth API
    • Gateway API
      • 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
    • 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
    • Get Trades
      Get Trades
    • Staking Annual Percentage Yield API
      Staking Annual Percentage Yield API
    • 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
    API and Library
  • Glossary
    Glossary
      • English
      • Русский
      On this page
        • Matcher Settings Validation
        • Blockchain Validation
        • Balance Validation

          # Order Validation Rules

          When a new Order is submitted to the Matcher the following conditions are validated.

          # Matcher Settings Validation

          • The order is submitted to the matcher with the correct public key - matcherPublicKey parameter.

          • The order sender address is not blacklisted by the matcher - blacklistedAddresses parameter.

          • The token is not blacklisted by the matcher.

          • The fee token can be accepted by the matcher.

          • The order fee is not less than the matcher fee. Currently the fee must be not less than 0.003 WAVES or other token based on current token rates.

          Amount and price checks:

          • 0 < amount < MaxAmount = 10^18

          • 0 < price

          • 0 < corrected spent amount < Long.MaxValue

            where corrected spent amount:

            If it is a buy order: = truncate(amount * price / PriceConstant)

            otherwise: = amount

          • 0 < corrected received amount < Long.MaxValue

            where corrected received amount:

            if it is a buy order: = amount

            otherwise: truncate (amount * price / PriceConstant)

          • 0 < fee < Long.MaxValue

          PriceConstant = 10^8

          Time checks:

          • 0 < timestamp

          • The order can be expired in (1 minute; 30 days] based on the matcher time. The matcher time in synchronized via NTP.

            matcher time + 60 * 1000 (60000 ms or 1 minute) < expiration

            30 * 24 * 60 * 60 * 1000 (2592000000 ms or 30 days) <= (expiration - matcher time)

          Tick size checks:

          • The order is SELL type or its price must be not less than tick size after correction. If there is a tick size the BUY order is placed in the same level with the price that equals the closest smallest multiple of the tick size.

          Market checks (disabled by default):

          • The price of BUY order must be not more than the best buy price, the SELL order price must be not less than the best sell price.

          • Order fee must match the market, only for percentage matcher operation mode.

          • The fee must be in deviation bounds, i.e. orders's fee is higher than the specified percentage of fee, that the client would pay for the matching with the best counter order. Only applicable to the percent order fee mode.

            For BUY orders: fee >= fs * (1 - fd) * best ask * amount

            For SELL orders: fee >= fs * (1 - fd) * best bid * amount

            where:

            fs = fee in percent from order-fee settings (order-fee.percent.min-fee)/100

            fd = max fee deviation / 100

            best bid = highest price of buy

            best ask = lowest price of sell

          # Blockchain Validation

          • The order version is supported by the blockchain (version 2 requires feature 10 (SmartAccountTrading) enabled, version 3 requires feature 12 (OrderV3) enabled). WX Network Matcher in Mainnet and Testnet supports orders of version 1, 2 and 3.

          • Note: WX Network Matcher in Mainnet and Testnet operates in dynamic fee mode.

            In dynamic fee mode, the fee specified in the order must be not less than minimal. The fee can be different for makers and takers. If the fee is paid in the token (other than WAVES) supported by the matcher, the fee must be not less than minimal in that token. The fee is calculated dynamically based on the asset rate (GET /matcher​/settings​/rates API method) by the following formula:

            baseFee + 0.004 * (number of involved scripts, excepting the account scripts) * asset rate rounded up to the minimal decimal of the token. For example, if the fee token has decimals = 2 and the fee is 0.01399, then Matcher will charge 0.02 in the token.

          • For every order the matcher calculates the number of insignificantDecimals = (price asset decimals - amount asset decimals).max(0). The price of the order must be the multiple of 10^insignificantDecimals. The final insignificantDecimals of the numbers must be zeros.

          • Amount and price of the order must match the matcher's requirements for the max/min value and must be the multiple of stepAmount/stepPrice accordingly (if there are such restrictions for the pair). The restrictions can be received with the endpoint GET /matcher/orderbook/{amountAsset}/{priceAsset}/info, restrictions field.

          • The account script (if there is one) of the order owner must allow placing orders.

          • Scripts of the amount, price and matcher fee token (if there are any) must allow its usage in the order.

          # Balance Validation

          • The order amount (including the order fee) must be not more that Tradable Balance, where Tradable Balance = (your balance of the sold token and the fee token in the blockchain) - (all the spendings+the reserved amount)

            where:

            all the spendings means all the outgoing leases and all the spendings in UTX including fees. For example, if you transfer 10 WAVES from your address to another and pay 1 XTN fee, then your spendings are 10 WAVES + 1 XTN fee.

            the reserved amount means the amount reserved in active orders including fees. For example, if you are selling 5 WAVES for 4 XTN in WAVES/XTN token pair with 0.001 BTC fee, then you have reserved 20 WAVES + 0.001 BTC fee.

            So, in this case the total of all the spendings+the reserved amount is 30 WAVES, 1 XTN and 0.001 BTC.

          Matcher API
          Exchange Transation Validation
          Matcher API
          Exchange Transation Validation