Smart Contracts Explained: What They Are and What Can Fail
On this page
A smart contract is a program stored on a blockchain that runs the rules written into it on its own. In the words of Ethereum's developer documentation, "A "smart contract" is simply a program that runs on the Ethereum blockchain." It has its own address, holds code and data, and anyone can call it with a transaction; the outcome depends on no one's goodwill, only on the code. That is why it underpins tokens, decentralized exchanges, lending, bridges and NFTs. It is also why a bug, a leaked key or a signature given without reading is so costly: interactions, the same documentation says, are irreversible. This post explains, from ethereum.org, the Solidity documentation, Nick Szabo's own texts and documents from the SEC and the CFTC, the US regulators, and the UN read on 26/11/2026, what a smart contract is, how it works and what has gone wrong, with dates and sources.
In short
- According to ethereum.org, a smart contract is a program that runs on the blockchain, with code and data at its own address, and "interactions with them are irreversible."
- The name comes from Nick Szabo, who wrote about the concept in 1994 and, in 1997, compared smart contracts to a vending machine.
- Deployed code does not change, but many contracts are built to be swapped out through a "proxy". In that case, whoever holds the admin key can change the rules.
- The best-known cases cover five kinds of failure: a code bug (The DAO, 2016), a manipulated oracle price (Mango Markets, 2022), malicious approvals, stolen validator keys (Ronin, 2022) and a hijacked admin key (Drift, 2026).
- "Verified" on Etherscan, a site that displays Ethereum blockchain data, means the published code is the code running, not that it was audited or is safe.
| Kind of failure | Case | Date | What happened | Source |
|---|---|---|---|---|
| Code bug (reentrancy) | The DAO | 17/06/2016 | About 3.6 million ETH diverted | SEC |
| Manipulated oracle price | Mango Markets | 11/10/2022 | Inflated oracle price; over US$ 110 million withdrawn | CFTC |
| Malicious approval | "Drainer" scams on Ethereum-compatible networks | Year 2025 | US$ 83.85 million lost by 106,106 victims | Scam Sniffer |
| Stolen validator keys | Ronin bridge | 23/03/2022 | 5 of 9 keys; 173,600 ETH and 25.5 million USDC | UN |
| Hijacked admin key | Drift Protocol | 01/04/2026 | 2-of-5 multisig with no timelock; about US$ 285 million | Chainalysis |
Sources: SEC, CFTC and UN documents, Scam Sniffer's report of 03/01/2026 and Chainalysis's analysis of 09/04/2026, read on 26/11/2026. Dollar values are as of each case.
What a smart contract is
The Solidity documentation, for the most widely used language for writing Ethereum contracts, describes a contract as "a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain." Put simply: a set of functions and data living at a blockchain address.
Three features follow from that:
- It runs on its own. When someone sends a transaction calling one of the contract's functions, every computer on the network runs the same code and reaches the same result. No employee approves the operation.
- It follows the code, not the intention. ethereum.org's beginner page describes smart contracts as programs following "if this then that" logic, "which cannot be changed once created." If the code has a bug, the bug runs too.
- What is done stays done. Per ethereum.org's developer documentation, "Smart contracts cannot be deleted by default, and interactions with them are irreversible."
ethereum.org uses the image of a digital vending machine: you put in the right coin, choose the product and the machine delivers, with no seller. The analogy works, with one important difference: with a real machine, the owner can open the door and give your money back; with a smart contract, only what the code allows can happen.
Every execution costs a fee paid to the network, called gas. How it is calculated and why it varies is covered in Gas fees: what they are, why they change and tax.
Where the idea comes from: Szabo and the vending machine
ethereum.org states that "Nick Szabo coined the term "smart contract"." His earliest text on the subject, "Smart Contracts", carries "Copyright (c) 1994 by Nick Szabo" and defines the concept this way: "A smart contract is a computerized transaction protocol that executes the terms of a contract." The aim, in the same text, was to "minimize exceptions both malicious and accidental, and minimize the need for trusted intermediaries." The essay now sits on a mirror hosted on a University of Amsterdam site, because the author's original site went offline; it is the same address ethereum.org links to.
On 01/09/1997, Szabo published "Formalizing and Securing Relationships on Public Networks" in the academic journal First Monday, which contains the comparison that stuck: "A canonical real-life example, which we might consider to be the primitive ancestor of smart contracts, is the humble vending machine." In a note, he says he had been refining the idea "since the early 1990's."
The idea predates bitcoin and Ethereum. What changed is that blockchains gave these programs a public, shared and hard-to-alter place to run. Why publishing the code is part of the deal is covered in Open Source Crypto: What It Means and Who Controls the Code.
Get the Seed backup checklist
The seed is the wallet. A bad backup only shows up on the day you need it. Check every item before moving meaningful value into self-custody. Along with it, Vault alerts on the Security and self-custody topic.
Immutable, but not always: proxies and admin keys
"A smart contract cannot be changed" is true of the code but misleading about the rules. ethereum.org's page on upgrading contracts explains both sides.
The code does not change. "These programs are immutable by design, which prevents any updates to the business logic once the contract is deployed," the page says. Nor can a contract simply be deleted: since Ethereum's Cancun upgrade in 2024, the selfdestruct function only sends the ether balance to a recipient and no longer destroys the contract, unless it is called in the same transaction that created it, according to the Solidity documentation.
But the rules can change. Many projects use what is called a proxy pattern. Users talk to a contract that does not change (the proxy), which forwards calls to a second contract holding the logic. To "upgrade", you just change the logic address stored in the proxy: "Performing the upgrade is then a matter of changing the address of the logic contract referenced in the proxy contract."
Who can make that change? Whoever controls the contract. ethereum.org's security page describes the most common pattern, in which "an address is set as the "owner" of the contract during the contract-creation process," and spells out the risk: "If the owner's account keys are compromised, attackers can attack the owned contract."
ethereum.org lists the downsides of upgradeable contracts itself: "Users must trust developers not to modify smart contracts arbitrarily," and weak access control makes unauthorized upgrades easier. It cites two safeguards:
- Multisig: a wallet that needs several signatures to approve a change, instead of a single key.
- Timelock: "A timelock refers to a delay enforced on changes to a system." A gap between announcing a change and executing it, which gives users time to leave.
Having both is not a technical footnote. It decides whether one person with the right key can, in an afternoon, change where every user's money goes.
What can go wrong
A code bug: The DAO, 2016
The DAO was a contract that pooled investors' ether to fund projects. According to the SEC's report of investigation of 25/07/2017, on 17/06/2016 an unknown attacker began rapidly diverting ether, reaching about 3.6 million ETH, roughly a third of what the contract had raised. The bug exploited has a technical name, reentrancy: the contract sent money before updating the balance, and the attacker could ask again before the update. ethereum.org uses the case as its example of the attack, "like what happened in the 2016 DAO hack."
The fix came from outside the contract: on 20/07/2016, per the SEC, a majority of the network adopted new software and a modified version of the Ethereum blockchain took effect. It was a network decision, not something the code allowed.
A manipulated oracle price: Mango Markets, 2022
A contract does not know on its own what an asset is worth; it relies on an oracle that brings the price in from outside. According to the CFTC's release of 09/01/2023, on 11/10/2022 the MNGO token price reported by the oracle "jumped over 13-fold during a 30-minute span," and the trader the CFTC charged withdrew more than US$ 110 million from the Mango Markets platform. The CFTC said it was its first case involving "oracle manipulation", and that about US$ 67 million was returned, with about US$ 47 million retained.
The code did exactly what it was told: it lent against collateral whose price had been inflated. How oracles work and where they fail is covered in Blockchain Oracles: Where Smart Contracts Get Their Prices.
Malicious approvals: when you authorize it yourself
The ERC-20 token standard has a function called approve, which, per the specification, "Allows _spender to withdraw from your account multiple times, up to the _value amount." It is what lets a decentralized exchange move your tokens in a swap. Scammers use the same function: a fake site asks for an approval, or a Permit-style signature, and the scam contract drains the wallet later.
According to the report Scam Sniffer, a security firm that tracks crypto scams, published on 03/01/2026, scams of this kind on Ethereum-compatible networks caused "Total losses: $83.85M across 106,106 victims" in 2025, 83% less than in 2024, and "Permit/Permit2 signatures accounted for 38% of large-case losses." The figure covers only this type of scam, not protocol hacks. How to check and cancel approvals is covered in Token Approvals: What They Are, How to Check and Revoke Them.
Stolen validator keys: Ronin, 2022
Ronin is the network built for the game Axie Infinity, and its bridge to Ethereum relied on validators. According to the UN Panel of Experts report of 07/09/2022, the bridge was "hacked for over 173,600 ETH and 25.5 million USD Coin," and the attackers accessed "five out of nine private key validator nodes". The US Treasury valued the theft of 23/03/2022 at "almost $620 million" and attributed it to the Lazarus Group, a hacking group linked to North Korea. There was no bug in the code: having the keys was enough. The story of the game and its players is in Play-to-Earn Games: What Happened to Axie and Its Players, and bridge risks in general in Can You Lose Funds on a Blockchain Bridge? Risks Explained.
A hijacked admin key: Drift, 2026
According to an analysis of 09/04/2026 by Chainalysis, a blockchain analytics firm, on 01/04/2026 "an attacker gained admin control of the Drift protocol and proceeded to drain an estimated $285 million from its vaults," on the Solana network. Days earlier, on 26/03, the protocol had migrated to a multisig requiring 2 of 5 signatures, "with zero timelock". Chainalysis says it relies on Drift's own post-mortem, not yet independently verified, and that formal attribution was still pending. The case illustrates the previous section: there was a multisig, but not the delay that would have given time to react. Chainalysis's conclusion is that the greatest risks are no longer just in contracts, but "in the systems, and people, that surround them."
How much is lost, and where
The figures below are the ones each source published, under its own criteria, and should not be added up or compared with each other.
Chainalysis. Its report of 19/12/2024 counted US$ 2.2 billion stolen from crypto platforms in 2024, with incidents rising "from 282 in 2023 to 303 in 2024," and "Private key compromises accounted for the largest share of stolen crypto in 2024, at 43.8%." Its report of 18/12/2025 counted "over $3.4 billion in theft from January through early December 2025," with the compromise of the Bybit exchange in February accounting for US$ 1.5 billion of it. The same report attributes the losses at centralized services to "sophisticated attacks on private key infrastructure and signing processes."
Binance, 2026. On 29/10/2026, the Binance exchange suffered unauthorized withdrawals that it estimated at about US$ 6.3 billion; TRM Labs, a blockchain analytics firm, counted about US$ 6.36 billion, according to an Al Jazeera report of 30/10/2026 that called it the biggest crypto heist in history. According to Binance's preliminary investigation, the breach may have started with an engineer's laptop; the exchange later said it had found additional points of breach and no evidence that any wallet's private key had leaked, and said it would cover all losses. It was not a contract bug: it was the infrastructure around it.
These figures point the same way: buggy contracts still exist, but the largest sums of recent years have left through keys, people and infrastructure, not lines of code.
"Verified" is not "audited"
On Etherscan, a contract can carry a verified badge. Etherscan's documentation explains that verifying a contract "publishes its source code on the block explorer, where anyone can read it and confirm it matches the bytecode deployed on chain." That is transparency, not a guarantee. An article from Etherscan's information center dated 23/01/2026 is blunt: ""Verified" does not mean the contract is safe to interact with or that it has been audited."
Audits do not settle everything either. ethereum.org's security page says "Smart contract audits won't catch every bug" and that you "should avoid treating audits as a silver bullet." How to read a contract in the explorer is covered in How to Read Etherscan: Transactions, Addresses and Tokens.
What to check
- Whether the contract is upgradeable. Look in the project's documentation for whether it uses a proxy. If it does, who can swap the logic?
- Who the owner or admin is. A single key, a multisig with how many signatures, and whether there is a timelock.
- What you are approving. Before signing, read the amount and the address being authorized. An unlimited approval to an unknown contract is the pattern of scams.
- Where prices come from. If the contract uses prices, which oracle supplies them.
- What "verified" and "audited" mean there. Verified is published code; an audit is a review with a date and scope that does not catch every bug.
- Before buying a token, check its contract, holders and liquidity, as in Checking a Token Before Buying: Contract, Holders, Liquidity.
The other terms in the series are in Crypto Technology Glossary: x402, NFTs, Lightning and More, and the group blamed for many of the largest thefts in Lazarus Group: Who They Are, What They Stole and Your Risk.
Crypto assets carry high risk, including significant volatility and the possibility of losing the capital invested, and no form of custody changes that. Vault Capital is a securities consultancy authorized by the CVM under CVM Resolution 19/2021 and works on the principle of advice, never custody: assets stay on the client's own exchanges and wallets. If you want to set up your own wallet with hands-on guidance, the Self-Custody Immersion is built for that, and the FAQ explains how Vault works without custody of client assets.
How a contract audit works, what it costs and what it leaves out is covered in Smart Contract Audits: What They Cost and What They Miss, and the programs that pay for bugs in Crypto Bug Bounties: How Immunefi Works and What It Pays.
The language most of these contracts are written in is covered in Solidity Explained: How It Compares With Rust and Move, and the library many of them reuse in OpenZeppelin Explained: The Library Behind Smart Contracts.
Frequently asked questions
What is a smart contract on a blockchain?
It is a program stored at a blockchain address, with code and data, that runs the rules written into it on its own when someone calls it with a transaction. According to ethereum.org, interactions with it are irreversible. Tokens, decentralized exchanges, lending and bridges all run on smart contracts.
How does a smart contract work?
Someone sends a transaction calling one of the contract's functions and pays the gas fee. Every computer on the network runs the same code, reaches the same result and records the change of state in the block. There is no manual approval: if the condition in the code is met, the operation happens.
Can a smart contract be changed?
Deployed code does not change, but many contracts use the proxy pattern, which lets the logic contract that calls are forwarded to be swapped. In that case, whoever holds the admin key can change the rules. ethereum.org cites multisig and timelocks as safeguards.
Who invented smart contracts?
ethereum.org credits the term to Nick Szabo, who wrote the essay "Smart Contracts" in 1994 and, on 01/09/1997, compared the concept to a vending machine in an article in the journal First Monday. Ethereum, launched later, made it possible to run such programs on a public blockchain.
Is a verified contract on Etherscan safe?
Not necessarily. Verified means the published source code matches what is running on the blockchain. Etherscan itself wrote, on 23/01/2026, that this does not mean the contract has been audited or is safe to interact with.
Can money lost in a smart contract be recovered?
Generally not through the contract itself: ethereum.org says assets stolen from smart contracts are "extremely difficult to track and mostly irrecoverable." There have been exceptions outside the code, such as the network change after The DAO in 2016, and negotiated returns, such as the roughly US$ 67 million returned in the Mango case, according to the CFTC.
Let's talk
Smart contracts do exactly what the code says, including when you approve the wrong thing. If you want to learn to set up and test your own wallet safely, Vault's Self-Custody Immersion teaches the process hands-on, in person, with the setup validated by a specialist.
Want to hold your crypto safely, on your own?
Vault's Self-Custody Immersion teaches wallets, seed backups and succession planning, hands on.
Learn about the ImmersionPath · Security and self-custody
Start the Security and self-custody path
Self-custody vs exchange: where to keep crypto in 2026
Self-custody vs exchange compared by counterparty risk, fees, Brazilian tax reporting and inheritance, with the FTX and Mt. Gox cases and a rule by amount.