What Are Smart Contracts and What Are They Good For?
Smart contracts are programs on a blockchain that execute automatically. They power DEXs, lending, and stablecoins, but bugs and oracles limit what they can do.
9 min read. Updated 2026-08-12.
A smart contract is a program stored on a blockchain that executes automatically when its conditions are met, with no company operating it and no way for either side to quietly change the rules mid deal. Smart contracts are genuinely good at a narrow set of jobs: swapping tokens, lending against collateral, issuing stablecoins, and holding funds under transparent shared rules. They are bad wherever the real world intrudes, because they cannot see off chain events without help, their bugs are as binding as their features, and code that guards billions of dollars attracts the best funded attackers on the planet. This article explains how they work, what they run at scale, where they fail, and why bitcoin deliberately supports so little of this.
Code as agreement
The idea predates the blockchains that made it practical. The computer scientist Nick Szabo coined the term in the 1990s and used a vending machine as the canonical example: you insert coins, the machine releases a snack, and no clerk, court, or contract lawyer is involved. The agreement is enforced by the machinery itself.
A smart contract generalizes that vending machine. A traditional agreement is words on paper, enforced after the fact by institutions if someone breaks it. A smart contract is executable rules, enforced during the fact by a network of computers that all run the same code and check each other's results. Once deployed, the contract lives at an address on the blockchain, its code is public for anyone to inspect, and it does exactly what it says, whether or not that is what its authors meant.
The name oversells it in two directions at once. A smart contract is not smart, it has no judgment and does only what it was programmed to do. And it is usually not a contract in the legal sense, though courts in various places are still working out where code and law overlap. It is best understood as software that moves money by rule.
How a smart contract actually executes
On Ethereum, the largest smart contract platform, the lifecycle looks like this. A developer writes the contract in a language like Solidity and deploys it in a transaction. From then on the contract has its own address, can hold its own balances, and exposes functions that anyone can call. When you interact with one, you send a transaction naming the function and your inputs, and you pay a gas fee for the computation. Every validating node executes the same code against the same state and must arrive at the same result, which is what makes the outcome trustworthy without trusting any single machine.
Two properties fall out of this design. First, execution is deterministic and unstoppable: nobody approves your transaction, and no support desk can reverse it. Second, contracts can call other contracts, so they snap together like parts. A lending protocol can plug into a price feed and a token exchange in one atomic transaction. This composability is the engine of everything covered in what DeFi is, and most of this activity now happens on layer 2 networks that settle back to Ethereum to keep fees low.
What smart contracts are genuinely good for
Trading without an intermediary
Decentralized exchanges replace the matching engine of a traditional exchange with a formula. Uniswap, the largest, holds paired tokens in pooled contracts and prices trades automatically against the pool. There is no account, no signup, and no custodian; you trade from your own wallet, and liquidity providers earn the fees. The model has processed staggering volume: Uniswap crossed 3 trillion dollars in cumulative trading volume, the first decentralized exchange to do so. The trade-offs are real too, including slippage on large trades and bots that exploit the ordering of transactions.
Lending against collateral
Protocols such as Aave and Compound run money markets as contracts. Depositors supply assets and earn interest; borrowers post collateral worth more than they borrow and pay it. Because a contract cannot evaluate your character or salary, loans are overcollateralized, and if collateral value falls too far the contract liquidates it automatically. It is credit reduced to the one thing code can verify: assets it already holds.
Stablecoins
The most widely used smart contracts on earth are arguably the token contracts behind stablecoins like USDC and USDT, which track balances and transfers of dollar pegged tokens. Note the hybrid trust model: the token moves by code, but the dollars backing it sit with the issuer off chain, which is exactly why regulators stepped in. The US GENIUS Act, signed in July 2025, created the first federal framework for payment stablecoins, requiring one to one reserves in cash and short term Treasuries. Stablecoins are the clearest case of smart contracts doing boring, useful financial plumbing at global scale.
Escrow and shared custody
Contracts can hold funds that release only under agreed conditions: multisignature wallets that require several keyholders to approve a payment, timelocks that delay withdrawals, vesting schedules that drip tokens to founders over years, and treasuries governed by token holder votes. For organizations that want no single point of trust over shared money, this is the strongest practical use case.
The limits nobody should gloss over
The oracle problem
A contract only knows what is on its blockchain. It cannot see the dollar price of ether, the weather, or whether goods arrived. Oracles are services that feed outside data on chain, and they reintroduce exactly the trust the contract was meant to remove: corrupt the data source and you corrupt every contract that relies on it. Manipulated price feeds have powered many DeFi exploits, and any contract that depends on real world facts is only as strong as whoever reports them.
Bugs are law
Immutability is the feature and the bug. Because deployed code cannot be quietly patched, users can trust it will not change under them, and attackers can trust it too. An exploit is not a break in; it is a valid execution of the code as written. If the rules allow draining the vault, the network will faithfully help drain it.
Audits help, guarantees do not exist
Serious protocols pay security firms for audits, run bug bounties, and use formal verification on critical pieces. All of it reduces risk; none of it eliminates it, and audited protocols have been drained anyway. An audit is a sample of expert attention, not a proof of correctness, and a contract can also behave correctly in isolation yet fail when composed with other contracts in ways nobody modeled.
Upgradeable contracts reintroduce trust
Because immutable bugs are terrifying, many teams deploy upgradeable contracts controlled by admin keys or governance votes. That fixes one problem by unfixing another: if someone can change the code, you are back to trusting people, and stolen admin keys become a master exploit. Every serious protocol lives somewhere on this spectrum between unfixable and mutable, and knowing where is part of knowing your risk.
Cautionary tales worth remembering
The DAO, June 2016. The first great smart contract experiment, a venture fund governed entirely by code, raised around 150 million dollars in ether and was drained of 3.6 million ETH through a reentrancy bug within weeks. Ethereum's community chose to hard fork the chain to undo the theft, and the dissenters who refused kept the original chain alive as Ethereum Classic. The episode set the terms of the debate that still runs today: code is law, until the loss is large enough to fork.
Ronin, March 2022. The bridge serving the game Axie Infinity lost about 625 million dollars, not to a contract bug but to compromised keys: attackers gained control of five of the nine validators whose signatures moved funds. The lesson is that a perfect contract guarded by too few keys is just a small multisig with extra steps.
Bybit, February 2025. The largest crypto theft on record, roughly 1.5 billion dollars, hit the exchange Bybit when North Korea's Lazarus Group compromised a developer machine at Safe, the multisig wallet provider, and served Bybit's signers a spoofed interface. The signers approved what looked like a routine transfer; the multisig contract then executed the malicious transaction exactly as signed. The code worked perfectly. The humans and the screens in front of them were the exploit.
The pattern across a decade is consistent, and Chainalysis put stolen funds at around 3.4 billion dollars in 2025 alone: attackers go wherever the weakest layer is, whether that is the contract, the keys, the oracle, or the person holding the signing device.
Bitcoin's minimalism versus Ethereum's expressiveness
Bitcoin can do some of this, and its refusal to do more is a design position, not a shortfall. Bitcoin Script, its built in language, is deliberately limited: no loops, no arbitrary programs, just enough to support multisignature spending, timelocks, and the payment channels behind the Lightning Network. The reasoning is that money securing hundreds of billions of dollars should present the smallest possible attack surface, and complexity should live in layers above the base money rather than inside it. Upgrades like Taproot widened what Script can express, but the philosophy has not moved: bitcoin optimizes for being hard to break, not easy to program.
Ethereum made the opposite bet: a general purpose virtual machine where developers can build anything, accepting that anything includes every failure mode in this article. Neither side is simply right. Everything in the section on real uses exists because Ethereum took that risk, and every cautionary tale exists for the same reason. The two designs are answers to different questions, which is why the honest comparison is purpose against purpose rather than better against worse.
What this means for you
You do not need to write a line of Solidity to be exposed to smart contract risk; holding a stablecoin or using a DeFi app is enough. The practical rules follow from everything above. Prefer old, heavily used, audited protocols, because surviving years in this environment is itself evidence. Understand token approvals before you grant them, since a signature that lets a contract spend your tokens is exactly what approval phishing scams harvest. Treat unusually high yields as unpriced risk until proven otherwise. And keep the habits from keeping your digital assets secure, because in a system where code executes exactly what you sign, the last line of defense is the person doing the signing.
