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
      waves_logo Docs

          # Transaction Binary Format

          Learn more about transaction.

          Transactions are stored on the blockchain in a binary format (byte representation). Node extensions such as gRPC server can work directly with data in binary format.

          The transaction signature and ID are also formed on the basis of the binary format, namely the transaction body bytes. The contents of transaction body bytes is given in the description of the binary format of each type and version of the transaction. Normally the transaction body bytes include all transaction fields, with the exception of the following fields:

          • transaction ID (it is not stored on the blockchain),
          • version flag,
          • proofs or signature, depending on the version of the transaction.

          The guideline for generating a signature and ID is given in the Cryptographic practical details article.

          All strings are UTF-8 encoded.

          # Protobuf

          Binary format of the latest versions of transactions is defined in transaction.proto protobuf scheme. Protobuf facilitates the development of client libraries for the Waves blockchain, as it avoids serialization errors and streamlines the creation of a correctly signed transaction.

          How to generate a transacton signature using Protobuf:

          1. Download the Protocol Buffers package for your programming language. Generate the Transaction class on the basis of transaction.proto.

          2. Fill in the transaction fields.

            ⚠️ Please note:

            • Asset IDs should be specified in the binary format.

            • Adresses should be specified in the shortened binary format (without the first two and the last four bytes). See the Address binary format article.

          3. Serialize the transaction object to get transaction body bytes.

            Detailed instructions for various programming languages are provided in Protocol Buffers Tutorials .

          4. Generate the signature for the transaction body bytes with the Curve25519 function using sender private key bytes.

          ⚠️ The byte representation of a transaction based on the protobuf schema must not contain default values. Make sure that your Protocol Buffers compiler does not write the field value when serializing if it is equal to the default value for this data type, otherwise the transaction signature will be invalid. For default values, see the Default Values section in the Protocol Buffers documentation.

          Send the signed transaction to a node:

          • If you use your own node and gRPC server, send the SignedTransaction object.
          • If you use Node REST API, compose the JSON representation of transaction and add the base58-encoded signature to the proofs array. Send the transactrion to a node using POST /transactions/broadcast method.

          The protobuf-based binary format is enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”.

          message SignedTransaction {
              oneof transaction {
                  Transaction waves_transaction = 1;
                  bytes ethereum_transaction = 3;
              }
              repeated bytes proofs = 2;
          }
          
          message Transaction {
              int32 chain_id = 1;
              bytes sender_public_key = 2;
              Amount fee = 3;
              int64 timestamp = 4;
              int32 version = 5;
          
              oneof data {
                  GenesisTransactionData genesis = 101;
                  PaymentTransactionData payment = 102;
                  IssueTransactionData issue = 103;
                  TransferTransactionData transfer = 104;
                  ReissueTransactionData reissue = 105;
                  BurnTransactionData burn = 106;
                  ExchangeTransactionData exchange = 107;
                  LeaseTransactionData lease = 108;
                  LeaseCancelTransactionData lease_cancel = 109;
                  CreateAliasTransactionData create_alias = 110;
                  MassTransferTransactionData mass_transfer = 111;
                  DataTransactionData data_transaction = 112;
                  SetScriptTransactionData set_script = 113;
                  SponsorFeeTransactionData sponsor_fee = 114;
                  SetAssetScriptTransactionData set_asset_script = 115;
                  InvokeScriptTransactionData invoke_script = 116;
                  UpdateAssetInfoTransactionData update_asset_info = 117;
              };
          };
          
          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 transaction sender
          fee.amount 8 bytes Transaction fee in the minimum fraction (“cent”) of the fee asset
          fee.asset_id • 32 bytes for the fee in a sponsored asset
          • 0 for the fee in WAVES
          ID of the token of the fee.
          The fee in a sponsored asset is only available for Invoke Script transactions and Transfer transactions. See the Sponsored Fee article
          timestamp 8 bytes Transaction timestamp: Unix time in milliseconds. The transaction won't be added to the blockchain if the timestamp value is more than 2 hours back or 1.5 hours forward of the current block timestamp
          version 1 byte Transaction version
          proofs Each proof up to 64 bytes,
          up to 8 proofs
          Transaction proofs that are used to check the validity of the transaction. The array can contain several transaction signatures (but not limited to signatures only)

          The fields that depend on the type of transaction are described in the following articles:

          • Burn transaction binary format
          • Create Alias transaction binary format
          • Data transaction binary format
          • Exchange transaction binary format
          • Genesis transaction binary format
          • Invoke Script transaction binary format
          • Issue transaction binary format
          • Lease Cancel transaction binary format
          • Lease transaction binary format
          • Mass Transfer transaction binary format
          • Reissue transaction binary format
          • Set Asset Script transaction binary format
          • Set Script transaction binary format
          • Sponsor Fee transaction binary format
          • Transfer transaction binary format
          • Update Asset Info transaction binary format

          The ethereum_transaction field contains bytes of the entire Ethereum-like transaction. See details in the Ethereum-like Transaction Binary Format article.

          Order Binary Format
          Burn Transaction Binary Format
          Order Binary Format
          Burn Transaction Binary Format