Skip to content

Batch file specification

Ana edited this page Feb 14, 2024 · 5 revisions

Introduction

Batch is a collection of transactions grouped together by a sender, which are validated, signed and sent as a single unit.

Compared to individual transactions, batches offer some advantages: all transactions within a batch a processed in one block, making them more cost-effective in terms of fee and resources.

Ways to create a batch using Umami wallet:

  • Add transactions to the batch directly from a wallet interface, then send them collectively from the "Batch" page later.
  • Use a CSV file to define and import batch transactions. Simply upload CSV file on the "Batch" page to create a new batch.

Using CSV file is especially helpful when dealing with large batches, as entering transactions one by one on a wallet interface can be time-consuming.

Additionally, batch files provide the benefits of reusability and compatibility across wallets that support the same batch file specification.

Batch sender

All transactions in the batch are originated from the same account.

  • When you add transaction to the batch from the wallet interface, it will be added to a batch for the operation sender.
  • When you upload the CSV file to the app you'll select the sender for all transactions listed in the file in the Umami app interface.

Batch file format

The file format defined herein describes a batch of Tezos operations in the CSV format.

Batch file description

  • Batch consists of transaction operations (although sometimes transactions may imply other operations, such as reveals).
  • Each non-empty line in the batch file that meets a transaction specification (described below) represents a transaction.
  • All transactions listed in the lines of the CSV file form a single batch.
  • If any line does not match a transaction specification, the file and the batch are considered invalid.

Formal file specification

file = transaction *(CRLF transaction) [CRLF]
transaction = teztx | tokentx
teztx = destination COMMA amount CRLF
tokentx = destination COMMA amount COMMA tokenaddr *(COMMA tokenid)
destination = tz[123][A-Za-z0-9]+{33} | KT1[A-Za-z0-9]+{33}
amount = [0-9]+(.[0-9]*)
tokenaddr = KT1[A-Za-z0-9]+{33}
tokenid = [0-9]+
COMMA = %x2C

Examples of transaction descriptions

Simple tez transaction

According to the specification's teztx definition, the base-token tez transaction requires:

  1. Destination - tz(1|2|3) or KT1 address.
  2. Amount of tez to send.
tz1Z3JYEXYs88wAdaB6WW8H9tSRVxwuzEQz2,1.23456

Token transaction

According to the specification's tokentx definition, a token transaction requires:

  1. Destination - tz(1|2|3) or KT1 address.
  2. Amount of token to send.
  3. Address of the contract that manages the token.
  4. Token id of the token within the contract (must be empty for fa1.2 token).
fa2 token transaction
tz1cbGwhSRwNt9XVdSnrqb4kzRyRJNAJrQni,1000,KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton,2
fa1.2 token transaction
tz1cbGwhSRwNt9XVdSnrqb4kzRyRJNAJrQni,2000,KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton