Sunday 6 December 2026

Smart Contracts Explained, and How They Fail

Smart contracts are programs that hold and move money on a blockchain with no one in charge. This guide explains how smart contracts work, what they are used for, and the ways they fail, from code bugs to stolen admin keys.

IntermediateLast reviewed
Paper cut-out collage of a document, a padlock and a warning sign on yellow

Key takeaways

  • A smart contract is a program stored on a blockchain. Once deployed, it runs exactly as written whenever someone calls it, without a company in the middle.
  • Contracts power stablecoins, decentralized exchanges, lending markets, NFTs and tokenized funds.
  • “Code is law” cuts both ways: a bug is executed just as faithfully as a feature, and it is visible to every attacker.
  • Most big losses come from a few patterns: logic bugs, stolen or misused admin keys, bad price data, and flawed bridges.

Smart contracts are what turned blockchains from payment networks into platforms. A smart contract is a piece of code stored at an address on a chain like Ethereum. It can hold funds, keep records and follow rules: if this happens, do that. Anyone can use it by sending a transaction, and nobody, not even the people who wrote it, can quietly change how it behaves unless that ability was built in.

That design makes new kinds of finance possible. It also creates new kinds of risk. This guide explains both. For the machinery underneath, read How Ethereum Works first.

A simple example

Imagine a vending machine. You put in the right coins, press a button and the machine releases a drink. No shop assistant is needed, and the machine treats everyone the same. A smart contract is a digital version. A basic escrow contract might say: hold the buyer’s payment; release it to the seller when the buyer confirms delivery, or refund the buyer if nothing happens within 30 days. Once deployed, neither side can change those terms.

1. Writeusually in Solidity 2. Test and auditfind bugs before launch 3. Deploycode gets an address 4. Runs as writtenanyone can call it Bugs are public and permanentunless an upgrade or pause function exists,which means trusting whoever holds those keys Outside data comes from oraclescontracts cannot read the internet; a wrongprice feed means wrong decisions
From code to live contract. After deployment, the contract’s behaviour is fixed unless its developers built in a way to change it.

What smart contracts are used for

UseWhat the contract doesExamples
TokensKeeps a record of who owns how many unitsUSDC, LINK, UNI
ExchangesHolds pools of tokens and swaps them at a formula priceUniswap, Curve
LendingTakes collateral, issues loans and sells collateral if it falls too farAave, Morpho
StablecoinsMints and burns tokens, sometimes against crypto collateralUSDS, USDe
Tokenized assetsTracks ownership of fund shares or bondsBlackRock BUIDL, Franklin Templeton funds
Multisig walletsRequires several signatures to move fundsSafe

Our guide to DeFi covers the financial uses in more depth.

What makes them different from normal software

  • Public: the code and every interaction are visible to anyone, including attackers.
  • Holds money directly: a bug does not just crash an app, it can release funds.
  • Hard to change: deployed code is usually permanent. Fixing a bug may mean deploying a new contract and asking everyone to move.
  • Composable: contracts call each other like building blocks. That makes innovation fast but means one failure can spread.
  • No undo: there is no bank or court that can reverse a confirmed transaction.

How smart contracts fail

1. Logic bugs

The code does something its authors did not intend. The classic case is The DAO in 2016, an early investment fund on Ethereum. A flaw called reentrancy let an attacker repeatedly withdraw funds before the contract updated its balance, draining about a third of its ether. The Ethereum community responded with a hard fork to return the funds, which is why Ethereum Classic exists as a separate chain today. Rounding errors, missing checks on who can call a function, and wrong order of operations still cause losses every year.

2. Admin key and access control failures

Many contracts can be upgraded or paused by an admin key, often held in a multisig wallet. If those keys are stolen, or a signer is tricked into approving a malicious change, the attacker gets full control. Some of the largest crypto thefts, including the $1.5 billion taken from the exchange Bybit in February 2025, came from attackers compromising the process around signing rather than finding a bug in the contract itself.

3. Oracle manipulation

Contracts cannot read the internet, so prices come from oracles. If a lending protocol reads a price from a single thin market, an attacker can push that price around with a large trade, often using a flash loan, which is a huge loan that must be repaid in the same transaction. The protocol then lends far too much against inflated collateral.

4. Bridge failures

Bridges lock assets on one chain and issue copies on another. They hold large pools of funds and depend on complex verification, which makes them prime targets. The Ronin bridge lost about $625 million in 2022 after attackers took control of validator keys; Wormhole lost about $325 million the same year through a flaw in how it verified signatures.

5. Economic and design flaws

Sometimes the code works exactly as designed, but the design breaks under stress: a stablecoin that loses its peg, liquidations that cannot keep up in a crash, or incentives that reward attacks. Smaller chains can face these problems too; the recent Initia exploit forced a chain halt.

How projects reduce the risk

  • Audits: independent security firms review the code before launch. Audits find many issues but are no guarantee; plenty of audited contracts have been exploited.
  • Bug bounties: paying ethical hackers to report flaws instead of exploiting them.
  • Formal verification: mathematically proving the code matches a specification, used for the most critical systems.
  • Time locks: delaying admin changes for days so users can leave if they disagree.
  • Battle testing: code that has held billions for years without incident has earned some trust that new code has not.

Questions to ask before using a contract

  1. How long has it been live, and how much value does it hold?
  2. Has it been audited, by whom, and were the findings fixed?
  3. Can it be upgraded or paused, and who holds those keys? Is there a time lock?
  4. Where does it get prices from?
  5. Does it depend on a bridge or another protocol that could fail?
  6. What exactly am I approving when my wallet asks me to sign?

That last question matters most for everyday users. Approving a malicious contract is how many wallet drainers work, as our guide to common crypto scams explains.

Sources: ethereum.org: Introduction to smart contracts, ethereum.org: Smart contract security, ethereum.org: Oracles, FBI: North Korea responsible for $1.5 billion Bybit hack

Not financial advice. This article is for information only. Crypto assets are volatile; do your own research before making any investment decision.

Guides Desk

Writes plain-English explainers, how-to guides and analysis for readers who want the bigger picture.

Researched and drafted with AI assistance and reviewed by our editors. How we work

All stories from the Guides Desk →

Follow us on Facebook

The day’s top crypto stories and a new plain-English guide every day, straight in your feed.

Follow Crypto Coin Week

The week in crypto, in your inbox

One email a week with the stories that moved the market. No spam, unsubscribe anytime.

We’ll email you a link to confirm your subscription. Unsubscribe anytime with one click. Privacy policy