waves_logo Docs
  • About Waves blockchain
    About Waves blockchain
  • Account
    • Account balance
      Account balance
    • Account data storage
      Account data storage
    • Address
      Address
    • Alias
      Alias
    • dApp
      dApp
    • Smart account
      Smart account
    Account
  • Token (Asset)
    • Non-fungible token
      Non-fungible token
    • Smart asset
      Smart asset
    • Token ID
      Token ID
    • WAVES
      WAVES
    • WAVELET
      WAVELET
    • WCT
      WCT
    Token (Asset)
  • Transaction
    • Transaction ID
      Transaction ID
    • Transaction body bytes
      Transaction body bytes
    • Transaction fee
      • Sponsored fee
        Sponsored fee
      Transaction fee
    • Transaction proof
      Transaction proof
    • Transaction signature
      Transaction signature
    • Transaction timestamp
      Transaction timestamp
    • Transaction validation
      Transaction validation
    • Transaction version
      Transaction version
    Transaction
  • Transaction type
    • Burn transaction
      Burn transaction
    • Create alias transaction
      Create alias transaction
    • Data transaction
      Data transaction
    • Exchange transaction
      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
    • Transfer transaction
      Transfer transaction
    • Update asset info transaction
      Update asset info transaction
    Transaction type
  • Mainnet, Testnet, Stagenet
    Mainnet, Testnet, Stagenet
  • Node
    • Mining node
      Mining node
    • Validating node
      Validating node
    • Leased Proof of Stake
      Leased Proof of Stake
    Node
  • Mining
    • Miner
      Miner
    • Mining account
      Mining account
    • Mining reward
      Mining reward
    Mining
  • Block
    • Block generation
      • Base target
        Base target
      • Generation signature
        Generation signature
      Block generation
    • Block height
      Block height
    • Block signature
      Block signature
    • Block timestamp
      Block timestamp
    • Transations Root Hash
      Transations Root Hash
    • Genesis block
      Genesis block
    Block
  • Oracle
    Oracle
  • Order
    Order
  • Protocols & Data formats
    • Cryptographic practical details
      Cryptographic practical details
    • Waves-NG solution
      Waves-NG solution
    • Waves-NG protocol
      Waves-NG protocol
    • Fair Proof of Stake
      Fair Proof of Stake
    • 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 binary format
          Transaction 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
        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
        • JSON Representation of Order 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 proto see Protocol Buffers Developer Guide .

          Version 4 is added in node version 1.2.0 and becomes available after activation of feature #15 “Ride V4, VRF, Protobuf, Failed transactions”. Versions 1.2.x are currently available on Stagenet only.

          message AssetPair {
              bytes amount_asset_id = 1;
              bytes price_asset_id = 2;
          };
          message Order {
              enum Side {
                  BUY = 0;
                  SELL = 1;
              };
              int32 chain_id = 1;
              bytes sender_public_key = 2;
              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;
          };
          message Amount {
              bytes asset_id = 1;
              int64 amount = 2;
          };
          
          Field Size Description
          chain_id 1 byte Chain ID
          sender_public_key 32 bytes Public key of the order sender
          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 108.
          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

          # Version 3

          # Field name JSON field name Field type Length in bytes Description
          1 Order binary format version number version Byte 1 Value must be 3
          2 Order sender public key senderPublicKey Array[Byte] 32
          3 Matcher public key matcherPublicKey Array[Byte] 32
          4.1 Token B flag Short 1 If token is WAVES, then value is 0, else 1
          4.2 Token B ID amountAsset Array[Byte] S If token is not WAVES, then S = 32, else the field should be absent
          5.1 Token A flag Short 1 If token is WAVES, then value is 0, else 1
          5.2 Token A 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 token B, which order sender offers for one token A price Long 8
          8 Amount of token A, which order sender wants to buy or send depending on order type amount Long 8
          9 Amount of milliseconds from the beginning of Unix epoch till the moment of validation of order by matcher timestamp Long 8
          10 Amount of milliseconds from the beginning of Unix epoch till the unfulfilled order cancellation expiration Long 8
          11 Matcher fee matcherFee Long 8
          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) 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) 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 binary format
          Transaction binary format
          Transaction message binary format
          Transaction binary format