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 2
        • Version 1
      waves_logo Docs

          # Invoke Script Transaction Binary Format

          Learn more about Invoke Script transaction.

          # Version 2

          Binary format of version 2 is defined in transaction.proto protobuf scheme. The fields that are common to all types of transactions are described in the Transaction Binary Format article.

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

          message InvokeScriptTransactionData {
              Recipient d_app = 1;
              bytes function_call = 2;
              repeated Amount payments = 3;
          };
          
          message Recipient {
              oneof recipient {
                  bytes public_key_hash = 1;
                  string alias = 2;
              };
          };
          
          message Amount {
              bytes asset_id = 1;
              int64 amount = 2;
          };
          
          Field Size Description
          d_app.public_key_hash 20 bytes dApp account public key hash (a component of an address, see the Address binary format article)
          d_app.alias From 4 to 30 bytes dApp alias
          function_call Function name and arguments. Binary format of function call is the same as in version 1 (see item 7 in table)
          payments.asset_id • 32 bytes for asset
          • 0 for WAVES
          ID of token in payment
          payments.amount 8 bytes Amount of token in payment, specified in the atomic units

          The maximum number of payments is 10. (Before activation of feature #16 “Ride V5, dApp-to-dApp invocations”, the maximum number of payments was 2.)

          The maximum size of InvokeScriptTransactionData is 5120 bytes.

          # Version 1

          # Field JSON field name Field type Field size in bytes Comment
          1 Version flag Byte 1 Indicates the transaction version is 2 or higher.
          Value must be 0
          2 Transaction type ID type Byte 1 Value must be 16
          3 Transaction version version Byte 1 Value must be 1
          4 Chain ID Byte 1 87 — for Mainnet
          84 — for Testnet
          83 — for Stagenet
          5 Public key of the transaction sender senderPublicKey Array[Byte] 32
          6 Address or alias dApp See Address Binary Format, Alias Binary Format S If the first byte of the field is 1, then it is followed by address. S in this case equals 26
          If the first byte of the field is 2, then it is followed by alias. In this case 8 <= S <= 34
          7.1 Function presence flag Byte 1 0 — the default function of the dApp is invoked.
          1 — function from the current transaction should be invoked in the dApp
          7.2 Function call ID Byte 1 Constant. The value must be 9
          7.3 Function type ID Byte 1 Constant. The value must be 1
          7.4 Function name length Int 4
          7.5 Function name function String Up to 255
          7.6.1 Amount of arguments of the function Int 4
          7.6.2 ID of argument 1 type type Byte 1 0 — argument type is long.
          1 — argument type is an array of bytes.
          2 — argument type is a string.
          6 — argument type is logical True.
          7 — argument type is logical False.
          11 – argument type is list.
          Ability to pass the list as argument is enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”
          7.6.3 Argument 1 value - Long
          - Array[Byte]
          - String
          - Logical True
          - Logical False
          - List
          S S = 8, if argument type is long.
          If the argument type is an array of bytes, string, or list, the field size is limited only by the total transaction size.
          If the type is list, then
          - its length must not exceed 1000 elements,
          - amount of its elements represents first 4 bytes of the current field,
          - each list element is serialized similarly to the function argument: the element type ID takes first place followed by the element's value.
          S = 0, if argument type is logical True or False
          7.6.4 ID of argument 2 type type Byte 1 0 — argument type is long.
          1 — argument type is an array of bytes.
          2 — argument type is a string.
          6 — argument type is logical True.
          7 — argument type is logical False.
          11 – argument type is list.
          Ability to pass the list as argument is enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”
          7.6.5 Argument 2 value - Long
          - Array[Byte]
          - String
          - Logical True
          - Logical False
          - List
          S S = 8, if argument type is long.
          If the argument type is an array of bytes, string, or list, the field size is limited only by the total transaction size.
          If the type is list, then
          - its length must not exceed 1000 elements,
          - amount of its elements represents first 4 bytes of the current field,
          - each list element is serialized similarly to the function argument: the element type ID takes first place followed by the element's value.
          S = 0, if argument type is logical True or False
          ... ... ... ... ... ...
          7.6.[2 × N] ID of argument N type type Byte 1 0 — argument type is long.
          1 — argument type is an array of bytes.
          2 — argument type is a string.
          6 — argument type is logical True.
          7 — argument type is logical False.
          11 – argument type is list.
          Ability to pass the list as argument is enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”
          7.6.[2 × N + 1] Argument N value - Long
          - Array[Byte]
          - String
          - Logical True
          - Logical False
          - List
          S S = 8, if argument type is long.
          If the argument type is an array of bytes, string, or list, the field size is limited only by the total transaction size.
          If the type is list, then
          - its length must not exceed 1000 elements,
          - amount of its elements represents first 4 bytes of the current field,
          - each list element is serialized similarly to the function argument: the element type ID takes first place followed by the element's value.
          S = 0, if argument type is logical True or False
          8.1 Amount of payments Short 2
          8.2 Payment 1 length Short 2
          8.3 Amount of token in payment 1 amount Long 8
          8.4 Flag of payment 1 token Byte 1 0 — WAVES.
          1 — other token
          8.5 ID of payment 1 token Array[Byte] 32 Field is applicable if the token is not WAVES
          ... ... ... ... ... ...
          8.[4 × N – 2] Payment N length Short 2
          8.[4 × N – 1] Amount of token in payment N amount Long 8
          8.[4 × N] Flag of payment N token Byte 1 0 — WAVES.
          1 — other token
          8.[4 × N + 1] ID of payment N token Array[Byte] 32 Field is applicable if the token is not WAVES
          9 Transaction fee fee Long 8
          10.1 Flag of fee token Byte 1 0 — WAVES.
          1 — other token
          10.2 Fee token ID feeAssetId Array[Byte] S S = 0, if token is WAVES.
          S = 32, if it is other token
          11 Transaction timestamp timestamp Long 8
          12 Transaction proofs proofs See Transaction Proofs Binary Format S If the array is empty, then S = 3.
          If the array is not empty, then S = 3 + 2 × N + 64 × N, where N is the number of proofs in the array.
          The maximum number of proofs in the array is 8. The size of each proof is 64 bytes

          The fields numbered in bold are the transaction body bytes.

          The maximum number of payments is 10. (Before activation of feature #16 “Ride V5, dApp-to-dApp invocations”, the maximum number of payments was 2. Before activation of feature #15 “Ride V4, VRF, Protobuf, Failed transactions”, the maximum number of payments was 1.)

          The maximum size of transaction including proofs is 5120 bytes.

          Genesis Transaction Binary Format
          Issue Transaction Binary Format
          Genesis Transaction Binary Format
          Issue Transaction Binary Format