Script.

A piece of on-chain code that gates UTxO spending or token minting.

Think of it as

Code that says yes or no. Lives on-chain; runs whenever someone tries to spend a UTxO it protects or mint a token it controls.

In depth

On Cardano a script is either a Plutus validator (general-purpose smart contract) or a simpler native script (multi-signature, time-locked). A script’s hash becomes part of either a script address (for spending) or a minting policy (for tokens).

Example

A multi-sig wallet uses a native script that requires two of three keys to sign before any of its UTxOs can be spent.

Next on this path

  1. Validator A pure script that gates a UTxO. Returns pass or fail given Datum, Redeemer and Script Context.
  2. Script address An address whose payment credential is a script hash. UTxOs here can only be spent if the script approves.
  3. Minting policy A script that decides whether new units of a native token may be minted or burned.