Crypto

What a smart contract is and what it isn’t

A smart contract is code stored on a blockchain that runs automatically when called. It is not a legal contract and not intelligent. Here is what it is and isn't.

What a smart contract is and what it isn't

Quick answer

A smart contract is a program on a blockchain that runs exactly as written when someone calls it, enforcing set rules without a middleman. It isn't a legal agreement, isn't intelligent, and can't reach off-chain on its own. That literal execution is both its strength and its biggest risk.

Key points

  • It is code on a blockchain that runs when someone calls it
  • It enforces its own rules, not a legal agreement
  • It cannot see off-chain data without an oracle
  • Running it costs a fee measured in gas
  • Deployed code is often fixed, so bugs run exactly as written

A smart contract is a program stored on a blockchain that runs automatically when its conditions are met. The name is misleading on both counts. It isn’t a legal contract, and it isn’t especially “smart.” It’s code that executes exactly as written, on a network that guarantees it runs the same way for everyone — no clerk, no discretion, no takebacks.

What a smart contract actually is

On blockchains that support them — Ethereum was the original and is still the best known — you can deploy code to an address, much the way you’d send funds to an address. Once deployed, that code lives on the chain. It can hold funds, store data, and expose functions that anyone can call by sending it a transaction. When called, the code runs on the network’s computers; every node executes it identically and checks the result, and the outcome gets written to the shared ledger.

Because the code and its results sit on the blockchain, they inherit the blockchain’s traits. The logic is public and auditable. Its execution is verified by the whole network rather than one company’s server. And once deployed, it usually can’t be quietly changed. A handy plain-language definition: “if this, then that, enforced by the network.” A vending machine, not a person. You put in the required input and the machine dispenses the defined output — no attendant deciding whether to honour it, no bad mood, no lunch break.

A simple mental model

Take an escrow-style example, offered purely to show the mechanics. You could write a contract that holds funds and releases them to a seller once a specified condition is recorded — or returns them to the buyer if that condition isn’t met by a deadline. Nobody has to trust a middleman to hold the money honestly, because the release rules are frozen in code that everyone can read and that the network enforces the same way for all parties.

Generalise that pattern and you’ve got most of what smart contracts do: token systems, lending arrangements, exchanges, and other applications where predefined rules shuffle value between parties with no trusted operator in the middle. The applications built on top of them usually get called “decentralised applications,” or dapps.

What a smart contract is not

This term breeds more confusion than almost any other in crypto, so let’s be blunt about what it is not:

  • Not a legal contract. On its own it creates no legally binding obligations, and courts don’t enforce it. It enforces its own code — a different thing entirely from enforcing an agreement in law.
  • Not intelligent. No AI, no judgement. It follows fixed instructions to the letter, including any mistakes baked into those instructions.
  • Not able to reach off-chain by itself. A contract can’t natively know a stock price, the weather, or whether a parcel arrived. It sees only data that’s already on-chain. Pulling in outside information needs a separate service called an oracle — which drags its own trust questions along with it.
  • Not automatically self-running. A contract does nothing until someone sends a transaction that calls it. It sits inert until triggered. There’s no built-in timer quietly waiting to fire.
  • Not necessarily unchangeable in practice. The deployed code is fixed, sure — but developers can build in upgrade mechanisms or admin controls. So “immutable” really depends on how a specific contract was written.

Keep these limits in view and you dodge a lot of misunderstanding. A smart contract is powerful precisely because it’s narrow and literal. That literalness is also its biggest risk.

Running code costs money

Executing a smart contract eats the network’s computing resources, and whoever triggers it pays for that computation through a fee. On Ethereum this is measured in gas. Heavier operations cost more, and a transaction that runs out of the fee it set aside will fail rather than finish halfway. That’s a deliberate safeguard — it kills infinite loops and stops anyone from clogging the network for free. What these fees pay for is covered in what gas fees actually pay for.

The practical takeaway: on-chain computation is genuinely pricey next to running the same logic on an ordinary server. So smart contracts get used where the guarantees — public rules, no trusted operator, verified execution — are worth that premium. Not because they’re a cheaper way to run programs. They aren’t, and nobody serious pretends otherwise.

Composability: contracts that use other contracts

One trait makes smart contracts genuinely powerful: composability. Because contracts live at public addresses and expose callable functions, one contract can call another mid-execution. A contract that needs to swap one token for another can just call an existing exchange contract to do it, instead of reimplementing that logic from scratch. Developers nicknamed this “money legos” — building new applications by snapping together on-chain pieces that already exist.

Composability is why ecosystems of contracts grow so fast, since each new contract can stand on the ones already deployed. But it compounds risk in the same breath. Lean your contract on another and you inherit its flaws and surprises, and one weak component can drag down everything built above it. This is the whole model’s double edge in miniature — the same openness that lets useful systems assemble themselves also means a bug in one popular contract can ripple outward for months. It’s why touching a complex application rarely means trusting a single piece of code. You’re trusting a whole stack of them.

The risks that come with “code is law”

Because a smart contract executes exactly as written, and often can’t be corrected after deployment, bugs are unusually costly. A flaw in the code may run faithfully in a way its author never meant, with no administrator standing by to pause it or reverse the result. Several of the largest losses in crypto came not from broken cryptography but from mistakes in contract logic that behaved precisely as coded. The code did its job. The job was wrong.

A few sober takeaways fall out of this:

  • Auditing matters. Serious contracts get reviewed by specialists before they handle real value — though an audit shrinks risk, it never erases it.
  • Interacting with a contract means trusting its code. Approve a contract to touch your funds and you’re trusting what it will actually do, which can differ from what a website claims it does.
  • Immutability cuts both ways. The property that stops a bad actor tampering also stops a good actor fixing a mistake — unless upgrade paths were designed in from day one.

You can check whether an address is a contract, and often view its verified code, using a block explorer — see how to read a block explorer.

What this means

The cleanest way to picture a smart contract is an automated, network-enforced vending machine for value. You define the rules once, deploy them, and the network runs them identically for everyone, no trusted operator in the middle. What it isn’t: a legal document, an intelligent agent, or something that can sense the outside world on its own. Its strength — literal, unstoppable execution — is welded to its main danger, because code that runs exactly as written will run any mistake it contains just as faithfully. Holding both the capability and the limits in view is what separates a realistic understanding from the hype. For the ledger these programs live on, see what a blockchain actually is.

Sources

  1. Ethereum smart contracts docs
  2. Ethereum developer docs

Frequently asked questions

Is a smart contract a legally binding contract?

No. It is a program on a blockchain that enforces its own code, not a legal agreement. It does not by itself create obligations that courts enforce.

Can a smart contract access real-world data like prices or weather?

Not on its own. It can only see data already on the blockchain. Bringing in external information requires a separate service called an oracle, which adds its own trust considerations.

Why can't a buggy smart contract just be fixed?

Once deployed, a contract's code is typically fixed and there is often no administrator who can change or pause it. Contracts can only be upgraded if the developers built that capability in from the start.

Last reviewed: 26 Aug 2026 Next review: 26 Feb 2027 Section: Crypto
Liam Chen
Protocol & security writer · Blockchain mechanics, wallet security, cryptography

Liam Chen writes about how crypto works at the protocol level — consensus, cryptography, wallets and security. He explains mechanisms plainly and cites primary sources.

More by Liam Chen

Related

Crypto

Token approvals and why they drain wallets

Token approvals explained: how the permissions you sign let contracts move your tokens, why unlimited approvals drain wallets, and how…

Liam Chen · Aug 26, 2026 · 6 min