Skip to content

Tx3 Language Guide

The Tx3 language is the source format you write to publish a protocol’s interface. This guide tours that language: the keywords you write at the top level, the building blocks of a transaction template, and the expression forms you use to describe values.

Protocol

A Tx3 file describes a UTxO protocol — the set of conventions that lets a user construct the transactions they need to interact with a chain to achieve some goal. Another common word for this is dApp, but Tx3 deliberately stops short of that: it does not build frontends. It does, however, take care of most of the boilerplate that a frontend would otherwise have to write to talk to the chain.

What you declare

A Tx3 file is mostly a list of top-level declarations. Each declaration introduces a name that the rest of the file can use:

What you compute

The right-hand side of every Tx3 clause is a data expression — a literal, a constructor, a property access, or a small bit of arithmetic.

Transaction templates

The core declaration in a Tx3 file is a tx: a parameterised template that the toolchain turns into a concrete, balanced transaction. A tx body is a collection of blocks — inputs, outputs, mints, witnesses, validity bounds, signers, metadata, locals, collateral — combined freely.

Chain-specific features

A few constructs only make sense on one chain. Cardano-specific blocks live under the cardano:: namespace — cardano::withdrawal, cardano::plutus_witness, cardano::publish, certificate blocks, and so on.