Transactions
What is a Transaction?
A transaction is a request to change the blockchain's state. On Cardano, every transaction:
- Consumes one or more existing UTXOs (inputs)
- Creates new UTXOs (outputs)
- Optionally mints or burns native tokens
- Pays a fee to the network
Unlike account-based blockchains where you update balances, Cardano transactions explicitly list what goes in and what comes out. The total input value must equal total output value plus the fee. Nothing is left unaccounted for.
This explicit structure makes transactions deterministic: you know exactly what will happen before you submit. For the full model of how inputs and outputs work, see the EUTXO Model.
Client SDKs handle transaction building, CBOR encoding, and fee calculation for you.
Transaction Validation
Transaction validation on Cardano uses scripts (pieces of code) that implement pure functions returning True or False. Script validation occurs for several actions:
- Spending UTXOs: Scripts validate whether UTXOs can be consumed
- Minting tokens: Policy scripts control token creation
- Reward withdrawal: Scripts govern stake reward claims
- Certificate applications: Scripts validate delegation and registration certificates
Each transaction specifies all arguments passed to scripts during validation, including user-provided redeemers that serve different purposes depending on the script logic.
When spending from script addresses or minting tokens with smart contract policies, additional computational costs apply. These are measured in execution units (memory and CPU steps) and added to the base transaction fee. See Transaction Fees for the complete fee structure including collateral requirements.
Deterministic Outcomes
The predictable nature of Cardano transactions is ensured by several key factors:
- Scripts always terminate and return consistent results for the same inputs
- Transactions fix all arguments passed to the script interpreter
- All required script validations are specified in the transaction
- Cryptographic signatures prevent transaction tampering
- EUTXO model ensures deterministic ledger state updates
Whether scripts succeed or fail, the outcome and associated ledger changes are predictable for any given transaction.
Transaction Anatomy and CBOR Format
At the lowest level, Cardano transactions are binary data encoded using CBOR (Concise Binary Object Representation), a format similar to "binary JSON" that provides compact serialization while maintaining structure.
CBOR and Cardano Specifications
CBOR allows Cardano to define precise transaction formats in the ledger specifications using CDDL (Concise Data Definition Language). Each Cardano era has its own specification document that defines the exact structure transactions must follow - any deviation causes rejection.
Understanding CBOR becomes crucial when debugging transaction failures, as blockchain explorers typically show processed data rather than the raw transaction structure that nodes actually validate.
Advanced: Transaction Structure Details
Validity Intervals and Time
Smart contract execution on Cardano is fully deterministic, which raises an interesting challenge: how to handle time-dependent logic? Since asking for "current time" would break determinism, Cardano uses validity intervals to introduce time constraints.
How Validity Intervals Work
Transactions can specify a time window during which they're considered valid:
- Lower bound: Transaction valid only after this time
- Upper bound: Transaction expires after this time
These intervals are checked during Phase 1 validation, before script execution. This means validators can assume the transaction is within the specified time bounds, enabling deterministic time-based logic.
Practical Applications
Time-locked contracts: Record a deadline in the datum and check that the transaction's lower bound exceeds that deadline.
Auction deadlines: Set an upper bound so bids can only be placed before the auction ends.
Transaction Latency vs Finality
Understanding the difference between when a transaction appears on-chain versus when it becomes permanent is crucial for dApp development.
Latency: Time for a transaction to appear in a block (~20 seconds average block time).
Finality: Time for a transaction to become immutable and irreversible. This depends on:
- Network conditions and adversarial stake proportion
- Number of confirmations required (Risk tolerance of your application)
For most applications, waiting 6-20 confirmations provides really strong finality guarantees. High-value transactions may require more confirmations, while small transactions might accept fewer.
Next Steps
- Learn about Transaction Fees and how costs are calculated
- Understand how transactions interact with Native Assets
- Ready to build? See Smart Contracts Overview or Minting Native Assets