π Lanningham

Transaction Diagram Components

2 min read

This post demonstrates the transaction diagram components at various levels of complexity.

Simple Transfer

The simplest case: one transaction consuming a UTXO and producing two new ones.

Simple Transfer
Inputs
100 ADA
addr1qy8...qy...j2d
Outputs
75 ADA
addr1qx9...kk...m4a
24.8 ADA
addr1qy8...qy...j2d

Two-Transaction Chain

An output from the first transaction feeds into the second. The wire connects them.

Fund Escrow
Inputs
500 ADA
addr1_alice...
Outputs
200 ADA
addr1_es...dator...
datum: deadline: 1700000
escrow
299.8 ADA
addr1_alice...
Claim Escrow
Inputs
escrow
Outputs
199.6 ADA
addr1_bob...

DEX Swap with Reference Input

A swap transaction that references the pool state without consuming it. The pool UTXO is read-only.

Create Pool
Outputs
10,000 ADA + 50,000 SUNDAE
addr1_am...dator...
datum: fee: 0.3%, sqrtK: 22360
pool_utxo
22,360 LP
addr1_pr...vider...
lp_mint
Swap ADA → SUNDAE
Reference Inputs
pool_utxo
Inputs
100 ADA
addr1_trader...
redeemer: Swap: minReceive 480
Outputs
497 SUNDAE
addr1_trader...
0.2 ADA
addr1_trader...

Multi-Step DeFi Flow

A longer chain: provide liquidity, swap against the pool, then withdraw.

Provide Liquidity
Inputs
1,000 ADA + 5,000 TOKEN
addr1_alice...
Outputs
1,000 ADA + 5,000 TOKEN
addr1_pool...
datum: totalLP: 2236
pool
2,236 LP
addr1_alice...
alice_lp
Swap
Inputs
pool
100 ADA
addr1_bob...
redeemer: Swap
Outputs
1,100 ADA + 4,545 TOKEN
addr1_pool...
datum: totalLP: 2236
pool2
455 TOKEN
addr1_bob...
Withdraw Liquidity
Inputs
pool2
alice_lp
Outputs
1,100 ADA + 4,545 TOKEN
addr1_alice...

Minting with a Validator

A transaction that mints tokens using a minting policy, with a reference input for the policy script.

Deploy Policy
Outputs
1.5 ADA
addr1_al...cceed...
datum: PolicyScriptV2
policy_ref
Mint NFT mint: +1 MyNFT#001
Reference Inputs
policy_ref
Inputs
5 ADA
addr1_minter...
redeemer: MintNFT: name 001
Outputs
1.5 ADA + 1 MyNFT#001
addr1_minter...
3.3 ADA
addr1_minter...

Detail Levels

The same transaction at different detail levels. Use detail prop on <Flow> to control.

Full Detail

Example Tx
Inputs
250 ADA + 1,000 HOSKY
addr1qy8...9a7z3l8j
datum: owner: abc12...reshold: 100
redeemer: Collect: pro...f 0xdeadbeef
Outputs
249.5 ADA + 1,000 HOSKY
addr1qx3...c2kplz3h
datum: owner: abc12...lected: true

Compact

Example Tx
Inputs
250 ADA + 1,000 HOSKY
addr1qy8...9a7z3l8j
Outputs
249.5 ADA + 1,000 HOSKY
addr1qx3...c2kplz3h

Minimal

Example Tx
Inputs
250 ADA + 1,000 HOSKY
Outputs
249.5 ADA + 1,000 HOSKY

Governance Vote

A transaction that registers a vote using a DRep certificate.

Register DRep
Inputs
502 ADA
addr1_drep...
Outputs
2 ADA
addr1_drep...
datum: DRepCredential
drep_reg
499.8 ADA
addr1_drep...
Cast Vote
Reference Inputs
drep_reg
Inputs
5 ADA
addr1_drep...
redeemer: Vote: propos..., choice Yes
Outputs
4.8 ADA
addr1_drep...

π Lanningham

I’m π, a mathematician by passion, and a software engineer by trade. I'm most well known for my role as CTO at SundaeSwap Labs, and for my passion for educating people. I run a Cardano Stake pool, known as 314pool. I've also written a few blog posts on topics that I feel I can explain well, which you'll find below.