Basics
What is a smart contract?
A smart contract is a program stored on a blockchain that enforces an agreement without a middleman. The classic picture is a vending machine: you put in coins, you pick a product, and the machine hands it over. Nobody behind a counter decides whether you deserve the snack, the rules are built into the machine, and they work the same for everyone.
Take a buyer and a seller who do not know each other. Without a contract they either trust each other or pay an escrow agent. With a contract the payment sits in a script that releases it only once the agreed condition is recorded. Whether either side can cancel, whether a fee is taken and who can change the terms is fixed by the script's rules rather than decided by someone in the middle.
A contract only sees what is inside the transaction that calls it and what is already on the chain. Facts from the outside world, such as a race result or an exchange rate, have to be brought on chain by a service called an oracle, and the contract can only be as reliable as that feed.
On Cardano
How does Cardano run smart contracts?
On Cardano a contract is a validator: a script that a transaction has to satisfy. Most validators are attached to funds on the ledger, and a script can also authorize minting, reward withdrawals, certificates and governance votes. Three things follow from that.
The script guards the funds
When someone sends ada or tokens to a contract, the funds sit in an output, a chunk of value on the ledger, locked by the script instead of by a key. The output can carry a piece of data, the datum, that records the state of the agreement, for example who owes what. To spend that output, a transaction presents an argument, the redeemer, and the script checks whether the transaction is allowed.
The transaction is built before it runs
Your wallet or the app builds the complete transaction first, including every input, output and the data the script needs, and can evaluate the script before asking you to sign. The network then runs the same check on the same inputs and gets the same result. The transaction can still be rejected if one of its inputs was spent in the meantime, in which case nothing happens.
The cost is known before you sign
Script execution is paid for with a budget of memory and processing steps that is priced by protocol parameters, so the fee is fixed when the transaction is built, not discovered afterwards. If a script still fails on chain, which evaluating it before signing makes rare, a collateral covers the network's work. Its minimum is a share of the fee set by a protocol parameter, currently one and a half times the fee, and wallets that connect to DApps set aside some ada for it.
The full mechanics, from slots to ledger, are on the how Cardano works page.
Languages
Which languages do developers use?
Contracts are written in a high-level language and compiled to Plutus Core, the small language the Cardano node executes. Plinth, formerly called Plutus Tx, is embedded in Haskell, was the first and is still used by teams that want the full power of Haskell's type system. Aiken is a newer language built only for Cardano, with a simpler syntax and tooling that most new projects now pick. Plutarch, a Haskell library that stays close to the compiled code, is chosen when execution cost matters most. All of them produce the same kind of on-chain script.
Not everything needs a full contract. Native scripts handle common cases such as multi-signature wallets and time locks without any Plutus code, and native tokens can be minted under such a script as well.
DApps
What is a DApp?
A decentralized application, or DApp, is a website or app whose important actions run through smart contracts instead of a company's database. A decentralized exchange, for example, is a front end that builds swap transactions for you, plus the scripts on chain that hold the liquidity and enforce the prices.
You use a DApp with your own wallet. Connecting lets the app see your addresses and balance and ask you to sign transactions. It never holds your keys and it cannot move funds without a signature you give in your wallet. That connection follows a standard, CIP-30, which is why one wallet works with many apps.
Safety
How do I use a DApp safely?
Read what you are about to sign. Most Cardano wallets show the outputs of a transaction, that is, where ada and tokens will go, so a swap that suddenly sends your whole balance to an unknown address is visible before you confirm. Your signature commits to the exact transaction, so check the inputs, outputs and any warnings your wallet shows. There are no open-ended token approvals on Cardano: a DApp can only spend what the transaction you sign spends, and there is nothing to revoke later. What you do send to a contract stays under that contract's rules until those rules release it.
Beyond that, the usual rules apply. Reach the app through a bookmark or the link on its official channels, not through a search ad or a message. Prefer apps whose contracts have been audited and whose code is public. Try a small amount first. And treat any request to enter your recovery phrase as an attack, no DApp needs it.
Built on Cardano
What runs on Cardano smart contracts today?
Trading, lending, stablecoins, marketplaces and games all run on contracts, and identity projects use them too. These are a few examples from the app showcase, ranked by on-chain activity where that data exists.
Stablecoins and DeFi have their own pages, and the showcase lists more than a hundred apps across every category.
Explore all appsBuild
How do I build one?
The developer portal walks you from a first transaction to a deployed contract, with tutorials for Aiken and Plutus, the test networks to try things safely, and the tooling most teams use. A contract reaches the chain as part of a transaction, either attached to the transaction that uses it or published once in an output that later transactions reference. There is no global contract registry.
FAQ
They solve the same problem but work differently. On Ethereum a contract is an account with its own state that executes when called. On Cardano a contract is a validator that approves or rejects a transaction, most often one that spends outputs the script guards. The Cardano model tells you the script result and the cost before you sign, though the transaction can still be rejected if an input it needs was spent first. The price is designing around outputs rather than shared state.
No. A script can only control funds that were sent to it in a transaction someone signed, and it can only spend them in transactions that satisfy its rules. Your wallet's own funds move only with your signature.
The app or wallet normally evaluates the script before you sign, so a failing transaction is rarely sent. If a transaction is submitted and its script fails on chain anyway, the collateral your wallet set aside covers the network's work, and the rest of the transaction does not happen.
No. Cardano has no allowance system. Your signature commits to the exact transaction you sign and nothing more, so review the inputs, outputs and warnings your wallet shows. A DApp cannot spend anything else from your wallet afterwards.
A script is identified by the hash of its code, so the code itself cannot change. Projects upgrade by deploying a new version and moving funds under rules the old script allows, sometimes controlled by a governance token or a multi-signature key. Check how a project handles upgrades before trusting it with large amounts.
Aiken is the fastest way in for most developers, with a familiar syntax and good tooling. Plinth, formerly Plutus Tx, is the choice if you already know Haskell, and Plutarch if you want fine control over execution cost. All of them compile to the same on-chain language.