Smart Contract
A smart contract is a self-executing program stored on a blockchain that automatically enforces the terms of an agreement when predefined conditions are met, eliminating the need for a trusted third-party intermediary.
The concept of smart contracts predates blockchain technology — computer scientist Nick Szabo first described them in 1994 as computerized transaction protocols that execute contract terms automatically. However, the idea became practically implementable when Ethereum launched in 2015, introducing a programmable blockchain capable of running arbitrary code in a distributed, tamper-resistant environment.
A smart contract is essentially a program that lives at a specific address on the blockchain. Once deployed, its code is immutable and publicly visible. When a user (or another contract) sends a transaction that meets the contract's conditions, the code executes deterministically across every node in the network. No single party can prevent execution, alter the outcome, or censor the transaction — the contract runs exactly as written.
Practical examples illustrate the power of this design. A DeFi lending protocol's smart contract automatically liquidates a borrower's collateral if their loan-to-value ratio exceeds a threshold, without requiring any employee to monitor positions or manually execute trades. An NFT marketplace contract automatically routes royalty payments to the original creator every time the work is resold. A decentralized autonomous organization (DAO) uses smart contracts to automatically execute governance votes passed by token holders.
The immutability of smart contracts is both their strength and a significant vulnerability. If a bug exists in the contract's code, it cannot be patched without deploying an entirely new contract and migrating users — and the original flawed contract remains exploitable. The 2016 DAO hack, in which an attacker exploited a reentrancy vulnerability to drain roughly $60 million in Ether, is the most famous example of a smart contract exploit. Since then, formal audits, static analysis tools, and formal verification methods have become standard practice for serious protocol developers.
Gas fees — the transaction costs paid to the Ethereum network to execute smart contract code — represent another practical consideration. Complex contracts that require many computational steps cost more gas to execute, and during periods of high network congestion, these costs can become prohibitively expensive for small transactions.