waves_logo Docs
  • Why Waves
    Why Waves
  • Waves Basics
    Waves Basics
  • Account
    • Creating Account
      Creating Account
    • Address
      Address
    • Account Balance
      Account Balance
    • Account Data Storage
      Account Data Storage
    • Alias
      Alias
    • dApp and Smart Account
      dApp and Smart Account
    Account
  • Token (Asset)
    • Non-Fungible Token
      Non-Fungible Token
    • Smart Asset
      Smart Asset
    • Token ID
      Token ID
    • WAVES
      WAVES
    Token (Asset)
  • Transaction
    • Transaction Fee
      • Sponsored Fee
        Sponsored Fee
      Transaction Fee
    • Signature and Proofs
      Signature and Proofs
    • Transaction Types
      • Burn Transaction
        Burn Transaction
      • Create Alias Transaction
        Create Alias Transaction
      • Data Transaction
        Data Transaction
      • Exchange Transaction
        • Order
          Order
        Exchange Transaction
      • Genesis Transaction
        Genesis Transaction
      • Invoke Script Transaction
        Invoke Script Transaction
      • Issue Transaction
        Issue Transaction
      • Lease Cancel Transaction
        Lease Cancel Transaction
      • Lease Transaction
        Lease Transaction
      • Mass Transfer Transaction
        Mass Transfer Transaction
      • Reissue Transaction
        Reissue Transaction
      • Set Asset Script Transaction
        Set Asset Script Transaction
      • Set Script Transaction
        Set Script Transaction
      • Sponsor Fee Transaction
        Sponsor Fee Transaction
      • Transfer Transaction
        Transfer Transaction
      • Update Asset Info Transaction
        Update Asset Info Transaction
      • Ethereum-like Transaction
        Ethereum-like Transaction
      Transaction Types
    • Transaction Validation
      Transaction Validation
    Transaction
  • Block
    • Transactions Root Hash
      Transactions Root Hash
    • Genesis Block
      Genesis Block
    Block
  • Node
    • Leasing
      Leasing
    • Generator’s Income
      Generator’s Income
    • Monetary Policy
      Monetary Policy
    Node
  • Mainnet, Testnet, Stagenet
    Mainnet, Testnet, Stagenet
  • Unit Zero
    Unit Zero
  • Oracle
    Oracle
  • Protocols & Data formats
    • Cryptographic Practical Details
      Cryptographic Practical Details
    • Leased Proof of Stake
      Leased Proof of Stake
    • Waves-NG Solution
      Waves-NG Solution
    • Waves-NG Protocol
      Waves-NG Protocol
    • Waves 1.5
      Waves 1.5
    • Blockchain Data Types
      Blockchain Data Types
    • Binary Format
      • Address Binary Format
        Address Binary Format
      • Alias Binary Format
        Alias Binary Format
      • Block Binary Format
        Block Binary Format
      • Network Message Binary Format
        • Block Message Binary Format
          Block Message Binary Format
        • Checkpoint Message Binary Format
          Checkpoint Message Binary Format
        • Get Block Message Binary Format
          Get Block Message Binary Format
        • Get Peers Message Binary Format
          Get Peers Message Binary Format
        • Get Signatures Message Binary Format
          Get Signatures Message Binary Format
        • Handshake Message Binary Format
          Handshake Message Binary Format
        • Peers Message Binary Format
          Peers Message Binary Format
        • Score Message Binary Format
          Score Message Binary Format
        • Signatures Message Binary Format
          Signatures Message Binary Format
        • Transaction Message Message Binary Format
          Transaction Message Message Binary Format
        Network Message Binary Format
      • Order Binary Format
        Order Binary Format
      • Transaction Binary Format
        • Burn Transaction Binary Format
          Burn Transaction Binary Format
        • Create Alias Transaction Binary Format
          Create Alias Transaction Binary Format
        • Data Transaction Binary Format
          Data Transaction Binary Format
        • Exchange Transaction Binary Format
          Exchange Transaction Binary Format
        • Genesis Transaction Binary Format
          Genesis Transaction Binary Format
        • Invoke Script Transaction Binary Format
          Invoke Script Transaction Binary Format
        • Issue Transaction Binary Format
          Issue Transaction Binary Format
        • Lease Cancel Transaction Binary Format
          Lease Cancel Transaction Binary Format
        • Lease Transaction Binary Format
          Lease Transaction Binary Format
        • Mass Transfer Transaction Binary Format
          Mass Transfer Transaction Binary Format
        • Reissue Transaction Binary Format
          Reissue Transaction Binary Format
        • Set Asset Script Transaction Binary Format
          Set Asset Script Transaction Binary Format
        • Set Script Transaction Binary Format
          Set Script Transaction Binary Format
        • Sponsor Fee Transaction Binary Format
          Sponsor Fee Transaction Binary Format
        • Transfer Transaction Binary Format
          Transfer Transaction Binary Format
        • Update Asset Info Transaction Binary Format
          Update Asset Info Transaction Binary Format
        • Ethereum-like Transaction Binary Format
          Ethereum-like Transaction Binary Format
        Transaction Binary Format
      • Transaction Proof Binary Format
        Transaction Proof Binary Format
      Binary Format
    • Validation Rules
      Validation Rules
    Protocols & Data formats
  • Glossary
    Glossary
      • English
      • Русский
      On this page
        • Version 4
        • Version 3
        • Version 2
        • Version 1
      waves_logo Docs

          # Order Binary Format

          Learn more about order.

          An exchange transaction of version 3 can accept orders of versions 1–4.

          An exchange transaction of version 2 can accept orders of versions 1–3.

          An exchange transaction of version 1 can accept orders of version 1 only.

          # Version 4

          Binary format of order version 4 is defined in order.proto protobuf scheme. For information about protobuf see Protocol Buffers Developer Guide .

          Version 4 is enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”.

          message AssetPair {
              bytes amount_asset_id = 1;
              bytes price_asset_id = 2;
          };
          
          message Order {
              enum Side {
                  BUY = 0;
                  SELL = 1;
              };
          
              enum PriceMode {
                  DEFAULT = 0;
                  FIXED_DECIMALS = 1;
                  ASSET_DECIMALS = 2;
              };
          
              int32 chain_id = 1;
              bytes matcher_public_key = 3;
              AssetPair asset_pair = 4;
              Side order_side = 5;
              int64 amount = 6;
              int64 price = 7;
              int64 timestamp = 8;
              int64 expiration = 9;
              Amount matcher_fee = 10;
              int32 version = 11;
              repeated bytes proofs = 12;
              PriceMode price_mode = 14;
              bytes attachment = 15;
          
              oneof sender {
                  bytes sender_public_key = 2;
                  bytes eip712_signature = 13;
              }
          };
          
          message Amount {
              bytes asset_id = 1;
              int64 amount = 2;
          };
          
          Field Size Description
          chain_id 1 byte Chain ID
          matcher_public_key 32 bytes Public key of matcher
          asset_pair.amount_asset_id • 32 bytes for asset
          • 0 for WAVES
          ID of the amount asset
          asset_pair.price_asset_id • 32 bytes for asset
          • 0 for WAVES
          ID of the price asset
          order_side 1 byte Order type: buy or sell
          amount 8 bytes Amount of the amount asset, specified in the minimum fraction (“cent”) of asset
          price 8 bytes Price for the amount asset nominated in the price asset, multiplied by the factor:
          • 108 for order version 4 with priceMode = DEFAULT or priceMode = FIXED_DECIMALS;
          • 108 + priceAssetDecimals – amountAssetDecimals for order version 4 with priceMode = ASSET_DECIMALS, where amountAssetDecimals and priceAssetDecimals are the number of decimal places of amount asset and price asset respectively (token parameter)
          timestamp 8 bytes Order timestamp: Unix time in milliseconds
          expiration 8 bytes Unix time in milliseconds when the order will be expired
          matcher_fee.asset_id • 32 bytes for asset
          • 0 for WAVES
          Matcher fee token ID
          matcher_fee.amount 8 bytes Matcher fee
          version 1 byte Order version: 4
          proofs Each proof up to 64 bytes,
          up to 8 proofs
          Order proofs that are used to check the validity of the order
          price_mode 1 byte Mode of specifying the price field. The field is enabled by feature #17
          sender • 32 bytes for the order with Waves signature
          • 65 bytes for the order signed in MetaMask
          • For the order with Waves signature: the public key of the order sender
          • For the order signed in MetaMask: the ECDSA signature. MetaMask support is enabled by feature #17 “Ride V6, MetaMask support”. See details in the Sign transactions and orders in MetaMask article.
          attachment 1024 bytes Arbitrary data.
          The field is enabled by feature #22 “Light Node”

          # Version 3 

          # Field name JSON field name Field type Length in bytes Value
          1 Order binary format version number version Byte 1 must be 3
          2 Order sender public key senderPublicKey Array[Byte] 32
          3 Matcher public key matcherPublicKey Array[Byte] 32
          4.1 Asset B (amount asset) flag Byte 1 If token is WAVES, then value is 0, else 1
          4.2 Asset B (amount Asset) ID amountAsset Array[Byte] S If token is not WAVES, then S = 32, else the field should be absent
          5.1 Asset A (price asset) flag Byte 1 If token is WAVES, then value is 0, else 1
          5.2 Asset A (price asset) ID priceAsset Array[Byte] S If token is not WAVES, then S = 32, else the field should be absent
          6 Order type orderType Byte 1 If order is for buying, then value is 0, if order is for selling, then value is  1
          7 Amount of asset B (amount asset), which the order sender offers for one price asset(asset A) price Long 8 bytes in big-endian notation
          8 Amount of asset B (price asset), which the order sender wants to buy or send depending on order type amount Long 8 bytes in big-endian notation
          9 Amount of milliseconds from the beginning of Unix epoch till the moment of validation of order by matcher timestamp Long 8 bytes in big-endian notation
          10 Amount of milliseconds from the beginning of Unix epoch till the unfulfilled order cancellation expiration Long 8 bytes in big-endian notation
          11 Matcher fee matcherFee Long 8 bytes in big-endian notation
          12 Matcher fee token flag Byte 1 If token is WAVES, then value is 0, else 1
          13 Matcher fee token matcherFeeAssetId Array[Byte] F If token is not WAVES, then F = 32, else the field should be absent
          14 Proofs proofs Array[Proof] S If the array is empty, then S = 3.
          If the array is not empty, then S = 3 + 2 × N + (P1 + P2 + ... + Pn),
          where
          N is amount of proofs in the array,
          Pn — size N-th proof in bytes.
          Maximum amount of proofs in the array is 8. Maximum length of each proof is 64 bytes

          # JSON Representation of Order Version 3

          {
            "version": 3,
            "senderPublicKey": "FMc1iASTGwTC1tDwiKtrVHtdMkrVJ1S3rEBQifEdHnT2",
            "matcherPublicKey": "7kPFrHDiGw1rCm7LPszuECwWYL3dMf6iMifLRDJQZMzy",
            "assetPair": {
              "amountAsset": "BrjUWjndUanm5VsJkbUip8VRYy6LWJePtxya3FNv4TQa",
              "priceAsset": null
            },
            "orderType": "buy",
            "amount": 150000000,
            "timestamp": 1548660872383,
            "expiration": 1551252872383,
            "matcherFee": 300000,
            "proofs": [
              "YNPdPqEUGRW42bFyGqJ8VLHHBYnpukna3NSin26ERZargGEboAhjygenY67gKNgvP5nm5ZV8VGZW3bNtejSKGEa"
            ],
            "id": "Ho6Y16AKDrySs5VTa983kjg3yCx32iDzDHpDJ5iabXka",
            "sender": "3PEFvFmyyZC1n4sfNWq6iwAVhzUT87RTFcA",
            "price": 1799925005,
            
          }
          

          # Version 2

          # Field name Type Length in Bytes
          1 Version Byte (constant, value = 2) 1
          2 Sender's public key PublicKey (Array[Byte]) 32
          3 Matcher's public key PublicKey (Array[Byte]) 32
          4.1 Amount asset flag (1 - asset, 0 - Waves) Byte 1
          4.2 Amount asset AssetId (ByteStr = Array[Byte]) 32 or 0 (depends on the byte in 4.1)
          5.1 Price asset flag (1 - asset, 0 - Waves) Byte 1
          5.2 Price asset AssetId (ByteStr = Array[Byte]) 32 or 0 (depends on the byte in 5.1)
          6 Order type (0 - Buy, 1 - Sell) Byte 1
          7 Price Long 8
          8 Amount Long 8
          9 Timestamp Long 8
          10 Expiration Long 8
          11 Matcher's fee Long 8
          12 Proofs Proofs See Proofs structure

          # Version 1

          # Field name Type Length in Bytes
          1 Sender's public key PublicKey (Array[Byte]) 32
          2 Matcher's public key PublicKey (Array[Byte]) 32
          3.1 Amount asset flag (1 - asset, 0 - Waves) 1
          3.2 Amount asset AssetId (ByteStr = Array[Byte]) 32 or 0 (depends on the byte in 3.1)
          4.1 Price asset flag (1 - asset, 0 - Waves) 1
          4.2 Price asset AssetId (ByteStr = Array[Byte]) 32 or 0 (depends on the byte in 4.1)
          5 Order type (0 - Buy, 1 - Sell) Byte 1
          6 Price Long 8
          7 Amount Long 8
          8 Timestamp Long 8
          9 Expiration Long 8
          10 Matcher fee Long 8
          11 Signature Bytes 64

          The price listed for amount asset in price asset * 10^8.

          Expiration is order time to live, timestamp in future, max = 30 days in future.

          The signature is calculated from the following bytes:

          # Field name Type Length in Bytes
          1 Sender's public key PublicKey (Array[Byte]) 32
          2 Matcher's public key PublicKey (Array[Byte]) 32
          3.1 Amount asset flag (1 - asset, 0 - Waves) 1
          3.2 Amount asset AssetId (ByteStr = Array[Byte]) 32 or 0 (depends on the byte in 3.1)
          4.1 Price asset flag (1 - asset, 0 - Waves) 1
          4.2 Price asset AssetId (ByteStr = Array[Byte]) 32 or 0 (depends on the byte in 4.1)
          5 Order type (0 - Buy, 1 - Sell) Bytes 1
          6 Price Long 8
          7 Amount Long 8
          8 Timestamp Long 8
          9 Expiration Long 8
          10 Matcher fee Long 8
          Transaction Message Message Binary Format
          Transaction Binary Format
          Transaction Message Message Binary Format
          Transaction Binary Format