How do Cardano's eUTXO model and Plutus validators work?
eUTXO outputs carry ADA, native tokens and a datum, and can be locked by a script. A Plutus validator checks the datum, the redeemer and the full transaction, then passes or fails, so results and fees are known in advance.
Cardano keeps state the way Bitcoin does, as unspent transaction outputs, but each output can also carry a datum (arbitrary data) and be locked by a script. That is the extended UTXO (eUTXO) model. A Plutus validator is that script: a pure function that receives the datum, a redeemer supplied by the spender, and a view of the whole spending transaction, and either succeeds or fails. Validators don't change state; they only approve or reject a transaction that off-chain code has already built. Because of that, a transaction's outcome and fee are known before you submit it.
From Bitcoin's UTXOs to extended UTXOs
On Cardano, as on Bitcoin, a transaction consumes existing outputs and creates new ones, and nothing else in the ledger changes. If that model is new to you, start with how the UTXO and account models track balances. Cardano extends each output in three ways:
Output field
Bitcoin
Cardano eUTXO
Address
Locking script or key hash
Payment credential (key hash or script hash) plus optional stake credential
Value
BTC only
ADA plus any number of native tokens
Data
None
A datum: inline (since Vasil, CIP-32) or a hash of it
Code
Script in the spending input
Optional reference script stored in the output (CIP-33)
The script also sees much more. A Bitcoin script sees little beyond its own spend and the signature; even Taproot's script paths, covered in how Taproot and Schnorr signatures changed Bitcoin, can't inspect the transaction's outputs. A Plutus validator receives the full script context: all inputs, outputs, reference inputs, minted tokens, required signers, withdrawals, certificates and the validity interval. That is what lets a validator say "you may spend this output only if the transaction also pays 100 ADA to Alice and keeps the rest locked here".
Cardano founder Charles Hoskinson and Coti CEO Shahaf Bar Geffen announced Djed, a new stablecoin for Cardano blockchain. At the Cardano Summit in Laramie, Wyoming, on Sunday, the two said that the COTI platform would be the official issuer of Djed. According to the announcement, Djed is a new…
When a transaction spends an output locked by script hash H, it must include the script (or point to a reference script with hash H), a redeemer, and enough execution units (a CPU budget and a memory budget) to run it. The node then runs the script with three logical inputs:
Datum: the data attached to the output being spent. It plays the role of the contract's state for that output.
Redeemer: data chosen by the spender, typically an action such as Claim or Cancel.
Script context: the transaction being validated plus the purpose, meaning which input, mint, withdrawal or certificate triggered this run.
In Plutus V1 and V2, spending validators took these as three separate arguments. Plutus V3, enabled by the Chang hard fork in September 2024, passes a single ScriptContext that contains the redeemer and, for spending, an optional datum (CIP-69). V3 also added new purposes for Conway governance (voting and proposing) and builtins such as BLS12-381 operations and Keccak-256. A validator signals success by returning and failure by raising an error; there is no partial result and no state write.
Scripts are compiled to Untyped Plutus Core (UPLC). Few people write it by hand. Aiken is the most widely used language for validators today, with Plutarch, Helios, OpShin, plu-ts and Scalus as alternatives, and Plinth (formerly PlutusTx) for Haskell.
A validator in Aiken
This vesting contract, based on Aiken's own tutorial, lets the owner withdraw at any time, and the beneficiary withdraw only after lock_until:
use aiken/collection/list
use aiken/crypto.{VerificationKeyHash}
use aiken/interval.{Finite}
use cardano/transaction.{OutputReference, Transaction, ValidityRange}
pub type VestingDatum {
/// POSIX time in milliseconds
lock_until: Int,
owner: VerificationKeyHash,
beneficiary: VerificationKeyHash,
}
validator vesting {
spend(
datum_opt: Option<VestingDatum>,
_redeemer: Data,
_input: OutputReference,
tx: Transaction,
) {
expect Some(datum) = datum_opt
or {
list.has(tx.extra_signatories, datum.owner),
and {
list.has(tx.extra_signatories, datum.beneficiary),
valid_after(tx.validity_range, datum.lock_until),
},
}
}
else(_) {
fail
}
}
fn valid_after(range: ValidityRange, lock_until: Int) -> Bool {
when range.lower_bound.bound_type is {
Finite(earliest) -> lock_until <= earliest
_ -> False
}
}
Two things stand out if you come from Solidity.
There is no "now". A validator can't read the current time, because that would make the result depend on when a block is produced. Instead, the transaction declares a validity interval (invalid_before and invalid_hereafter slots), and the ledger refuses to include it outside that window. The script reasons about the interval: if the earliest possible time is after lock_until, the lock has expired.
Signatures are checked by the ledger.extra_signatories lists key hashes the transaction declares as required signers; the ledger verifies those signatures before scripts run, so the validator only checks membership.
Build and test it with the Aiken CLI:
aiken new myorg/vesting
aiken check # type-checks and runs `test` blocks, reporting CPU and memory per test
aiken build # writes plutus.json, a CIP-57 blueprint with the compiled script and its hash
Off-chain code (Mesh, Lucid Evolution, PyCardano or cardano-cli) reads the blueprint, derives the script address and builds the locking and unlocking transactions.
Why fees and results are deterministic
On an account-based chain, a transaction executes against whatever state exists when it lands, so a swap can fail because someone else moved first. On Cardano, a transaction names the exact outputs it spends. If any of them has already been spent, the transaction is simply invalid and pays nothing. If they are all still there, the validator sees exactly the inputs the builder saw, so the result is the same one computed locally.
Validation runs in two phases:
Phase 1 checks structure, signatures, fees, the validity interval and that inputs exist. Failure here means the transaction is dropped at no cost.
Phase 2 runs the scripts. If a script fails, the node still includes the transaction but takes the collateral (ADA-only inputs set aside for this) instead of applying it. Since Babbage, a collateral return output gives back any excess.
Wallets evaluate scripts before submitting, so honest users essentially never lose collateral. Fees are a linear function of transaction size plus a price per execution unit, with an extra charge for reference script bytes introduced in the Conway era. Every output must also hold a minimum ADA amount proportional to its serialised size, set by the coinsPerUTxOByte parameter. Query current values rather than hard-coding them:
cardano-cli conway query protocol-parameters --mainnet --out-file pparams.json
# look at txFeePerByte, txFeeFixed, executionUnitPrices, maxTxExecutionUnits,# maxTxSize and utxoCostPerByte
Contention: one output, one spender per block
Determinism has a cost. An output can only be spent once, so if your whole protocol lives in one UTXO (a single liquidity pool, a global counter), only one transaction per block can touch it. Everyone else's transaction, built against the old output, becomes invalid. This is the eUTXO version of hot state, similar to the trade-off described in how owned and shared objects affect transactions on Sui.
The common designs:
Order outputs and batchers. Users lock orders in their own UTXOs; a batcher collects many orders and applies them to the pool in one transaction. Most Cardano DEXs work this way.
Sharding state across many UTXOs, each holding part of the liquidity or a range of keys.
Reference inputs (CIP-31) for data that many transactions need to read but not change, such as an oracle price or protocol configuration. Reading a reference input doesn't consume it, so it causes no contention.
Security pitfalls specific to eUTXO
Double satisfaction. Each script input is validated separately, and each validator sees the same transaction outputs. If a marketplace validator checks only "some output pays the seller 50 ADA", an attacker can spend two listings from the same seller in one transaction with a single 50 ADA payment, and both validators pass. Fix it by tying each payment to the specific input, for example by requiring the payment output to carry a datum containing that input's OutputReference, or by allowing only one script input per transaction.
Not checking the continuing output. A validator that lets state move forward must check the new output: right address, right value and a well-formed datum. Forgetting the datum check lets an attacker relock funds under a datum that bricks or steals them.
Unbounded values and datums. If anyone can add arbitrary tokens or data to a script output, it can grow until spending it exceeds the transaction size or execution budget, locking the funds. Bound what you accept.
Missing purpose checks. The same script hash can serve as a spending validator, minting policy and staking validator. Aiken's else(_) { fail } rejects any purpose you didn't handle; keep it.
Minting policies are where tokens get their rules. Native tokens have no ERC-20-style contract; the ledger tracks them directly, and a minting policy script decides when a policy id may mint or burn. A policy that checks too little lets anyone mint. If you're used to Ethereum's resource-free tokens, the way Move treats assets as resources is a closer mental model.
One optimisation worth knowing: when a transaction spends many inputs from the same script, the validator runs once per input. A popular pattern moves the shared logic into a staking validator triggered by a zero-ADA reward withdrawal, so it runs once per transaction, and the spending validators only check that the withdrawal is present.
Settlement and testing
Cardano uses Ouroboros Praos proof of stake, with one-second slots and a block expected roughly every 20 seconds on average. Blocks are probabilistically final like any longest-chain protocol, so the advice in how many confirmations to wait for applies: wait longer for higher-value transfers. For the consensus background, see proof of work versus proof of stake.
In practice:
Write Aiken test blocks for every redeemer, including failure paths, plus property tests for datum and value edge cases.
Keep the CPU and memory reported by aiken check well below the per-transaction limits.
Build real transactions on the preview or preprod testnet before mainnet.
Store validators as reference scripts so users don't pay for the script bytes in every transaction.
Summary
Concept
What it means
eUTXO
UTXOs that carry multi-asset value, a datum and optionally a reference script
Datum
Per-output state, inline or hashed
Redeemer
The spender's argument, usually the action
Script context
The whole transaction plus the purpose being validated
Validator
A pure predicate: pass or fail, no state writes
Plutus V3
Single-argument scripts, optional datums, governance purposes, new crypto builtins
Determinism
Spent inputs make a transaction invalid, not a failed execution