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
      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 bytes of the body of the transaction: all fields, except for the ID and the proofs (or the ID and the 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.

          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 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 SignedTransaction {
              Transaction transaction = 1;
              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
          Order binary format
          Burn transaction binary format
          Order binary format
          Burn transaction binary format