A smart contract is a self-executing program stored permanently on a blockchain that runs automatically when predefined conditions are met. Nick Szabo coined the term in 1994 using the vending machine analogy: insert the correct coins, receive the contracted output, with no human intermediary required. Ethereum made the concept practical at scale when it launched in 2015. Over 50 million contract accounts are now deployed on Ethereum mainnet (Etherscan, Q1 2026), underlying every DeFi protocol, ERC-20 token, and stablecoin transfer that runs onchain.
Understanding what a smart contract is, how it executes, and where it fails is foundational to working with any blockchain-based system. This article covers the smart contract definition, EVM execution mechanics, deployment and upgradeability, security risks, use cases, and how Circle's USDC uses burn-and-mint contract logic for cross-chain transfers. For the infrastructure these contracts run on, see how distributed ledgers work.
What Is a Smart Contract? The Definition
A smart contract is a program deployed to a blockchain whose code and state are replicated across every node on the network. Once deployed, it executes exactly as written: inputs produce deterministic outputs, balances move automatically, and no single party can intercept or reverse the result. The term "smart" refers to autonomy, not intelligence. The contract does only what the code specifies.
On Ethereum, there are two types of accounts. An externally owned account (EOA) is controlled by a private key and can initiate transactions. A contract account holds both code and state but has no private key. It cannot initiate a transaction on its own. It can only respond to calls initiated by an EOA or another contract. This distinction matters because all onchain activity ultimately originates from a human (or automated keeper bot) holding a private key, not from a contract acting independently.
Nick Szabo described the idea in his 1994 paper as embedding contract terms directly in software, making breach structurally expensive or impossible rather than merely illegal. Blockchain execution makes that literal: once a transaction is confirmed, the state change is irreversible. No court order, no admin intervention. See the trustless execution model for why distributed verification is what makes this meaningful.
How Does a Smart Contract Work on Ethereum?
A smart contract is written in Solidity (or Vyper), compiled into EVM bytecode, and deployed to the network via a creation transaction. The bytecode lives at a permanent address. Any caller interacts through the contract's ABI, which defines the function signatures and data types it accepts. Gas fees compensate the network for compute and storage consumed in execution.
The execution flow has four stages. First, a caller constructs a transaction encoding the target function name and its arguments using the ABI encoding rules from the Solidity ABI specification. Second, the transaction propagates to the mempool and validators include it in a block. Third, every full node executes the bytecode in its own EVM instance, reading the contract's current storage state, running the opcodes, and computing the new state. Fourth, if execution succeeds, the new state is committed; if it reverts (out-of-gas, failed require, reentrancy guard), the state rolls back but gas is still consumed.
Gas is the unit of computational cost. Simple token transfers cost roughly 21,000 gas units; complex DeFi interactions may cost 200,000 to 500,000 units. Gas price is denominated in gwei (1 gwei = 0.000000001 ETH) and fluctuates with network demand. The EIP-1559 upgrade in August 2021 split the gas fee into a burned base fee and a priority tip, making fee estimation more predictable. Layer 2 chains like Base, Optimism, and Arbitrum run the same EVM bytecode as Ethereum mainnet but settle in batches to L1, reducing per-transaction gas costs by roughly 10x to 100x depending on calldata compression.
Events are a key output mechanism. A smart contract emits events during execution: indexed log entries that external applications can subscribe to via RPC. The ERC-20 standard requires contracts to emit a Transfer event on every token movement, which wallets and indexers listen for to update balances. Off-chain indexers like The Graph make these event logs queryable without replaying the entire chain history.
Storage is the most expensive EVM resource. Each 32-byte storage slot costs 20,000 gas to write for the first time and 5,000 gas to update. Reading a slot costs 100 gas after the first access in a transaction (the EIP-2929 cold/warm access model). Contract developers pack multiple small values into single slots using bit-shifting to minimize storage costs in frequently updated contracts like liquidity pools and lending markets.
Can Smart Contracts Be Changed Once Deployed?
A smart contract's bytecode is immutable by default. Once deployed to Ethereum, the code at that address cannot be edited. This immutability is a security guarantee: users know exactly what they agreed to run. Most production protocols need the ability to patch bugs or upgrade logic, so the ecosystem developed proxy patterns that preserve code-level immutability while allowing logic changes through address redirection.
The two dominant upgrade patterns are Transparent Proxy and UUPS (Universal Upgradeable Proxy Standard, defined in EIP-1822). In both, the proxy contract holds the state and delegates all calls to a separate implementation contract via delegatecall. Upgrading means pointing the proxy at a new implementation address; the proxy's storage persists and the new logic takes effect for future calls.
Transparent Proxy separates admin calls (upgrade operations) from user calls using the caller's address to route to either admin logic or implementation logic. UUPS puts the upgrade logic inside the implementation contract itself, saving roughly 2,000 gas per call compared to Transparent Proxy. OpenZeppelin's proxy library implements both patterns and is audited by the community. The UUPS trade-off: if a new implementation accidentally omits the upgrade function, the ability to upgrade is permanently lost.
A third approach is the Diamond Standard (EIP-2535), which routes calls to multiple implementation contracts (facets) sharing a single storage layer. It is optimal when one contract needs to grow beyond the 24KB bytecode limit or when granular upgrade permissions per function are required. For accounts that skip proxies entirely, ERC-4337 account abstraction offers a different path: programmable wallet logic with upgradeable validation without requiring a proxy contract.
Smart Contract Security: Audits and Common Exploit Patterns
Smart contract security failures have resulted in over $5 billion in onchain losses since 2016, according to DeFiLlama's exploit tracker. The most damaging vulnerabilities are not theoretical edge cases. They are recurring patterns that auditors and developers check systematically. Three categories account for the majority of exploits: reentrancy, integer arithmetic errors, and access control failures.
Reentrancy is the attack class that drained $60 million from The DAO in June 2016. An attacker calls a contract function that sends ETH before updating its internal state; the attacker's contract then re-enters the same function recursively, draining the balance before the state records the withdrawal. The 2023 Curve Finance exploit involved a reentrancy bug in the Vyper compiler affecting multiple liquidity pools, extracting approximately $61 million across affected contracts. The fix is the checks-effects-interactions pattern: update all state variables before sending ETH or calling external contracts. OpenZeppelin's ReentrancyGuard modifier enforces this with a mutex lock.
Integer overflow and underflow were eliminated in Solidity 0.8.0, which added automatic bounds checking. Before that version, an unsigned integer at 0 minus 1 would wrap to 2^256 - 1, the maximum value for a 256-bit integer. Contracts written in older Solidity versions that used SafeMath libraries were protected; those that did not were exposed to arithmetic manipulation attacks that could mint arbitrary token balances.
Access control failures include unprotected initialization functions (where an attacker becomes owner before the legitimate deployer calls initialize) and public state-mutating functions that were intended to be restricted. The Parity multisig wallet freeze in 2017 permanently locked over $150 million in ETH due to an unprotected initialization function callable by any address. Auditing firms like Trail of Bits, Spearbit, and OpenZeppelin Security publish post-mortem audit reports. Reading those reports is the fastest way to understand the real failure surface. The ERC standards framework reduces surface area by providing audited base contracts for common patterns.
A fourth category gaining attention is oracle manipulation. Many DeFi protocols read asset prices from onchain sources such as AMM pool spot prices. An attacker with a large flash loan can temporarily move a pool price within a single transaction, trigger a favorable oracle reading, extract value, and repay the loan before the block closes. Time-weighted average prices (TWAPs) and decentralized oracle networks like Chainlink, which aggregate data from multiple off-chain sources, are the standard mitigations. The flash loan itself is not an exploit: it is a legitimate EVM primitive that requires no collateral because the borrow and repayment happen within one atomic transaction.
Smart Contract Use Cases: DeFi, Stablecoins, NFTs, and Cross-Chain Bridging
Smart contracts underpin every major category of onchain activity. DeFi lending, stablecoin issuance, NFT minting, and cross-chain asset transfers all execute through contract logic rather than through centralized intermediaries. Each use case illustrates a distinct property: programmable custody, atomic execution, and composability between contracts.
DeFi Lending and Liquidity
Aave V3 held $13.7 billion in TVL as of Q1 2026 (DeFiLlama). Its lending logic runs entirely through smart contracts: borrowers post collateral to a contract, the contract calculates health factors in real time, and liquidation bots call a public function to liquidate positions that breach the threshold. No loan officer exists. Morpho Blue ($7.0 billion TVL, DeFiLlama Q1 2026) and Compound use the same pattern. All three expose public liquidation functions callable by any address, creating a competitive market of liquidation bots that keep the protocol solvent without centralized intervention.
Stablecoin Issuance and Automation
USDC's minting contract on Ethereum accepts a call from Circle's verified minter address, checks authorization, and increases the recipient's balance, all recorded onchain. The $77.3 billion USDC supply (DeFiLlama, April 2026) is tracked entirely in ERC-20 contract state. Stablecoin automation platforms extend this further, using smart contracts to trigger yield allocation, rebalancing, and payment sweeps based on onchain conditions rather than manual instructions.
NFTs and Ownership Records
The ERC-721 standard defines a minimal smart contract interface for non-fungible tokens: a mapping from token IDs to owner addresses, transfer functions, and approval mechanics. When an NFT is traded on a marketplace, the smart contract verifies the seller's ownership and atomically swaps the token for payment in a single transaction. No escrow agent, no settlement delay.
Cross-Chain Bridging
Cross-chain bridges use smart contracts on each connected chain to lock or burn assets on the source and mint or release them on the destination. Circle's Cross-Chain Transfer Protocol (CCTP) is a burn-and-mint architecture: the source-chain contract burns USDC and emits an attestation, and the destination-chain contract mints native USDC after Circle verifies the attestation. This mechanism operates across Ethereum, Base, Arbitrum, and other EVM chains where CCTP is deployed. See cross-chain intent protocols for a broader comparison of bridging architectures.
Smart Contracts vs. Traditional Contracts vs. Multisig Wallets
Smart contracts, traditional legal contracts, and multisig wallets all encode rules around value or agreements. They differ fundamentally in how those rules are enforced, how reversible outcomes are, who holds custody, and what execution costs. The table below compares all three across five dimensions to clarify where each mechanism fits.
Dimension | Smart contract | Traditional contract | Multisig wallet |
Enforcement | Automatic. EVM executes deterministically on trigger; no court required | Manual. Courts, arbitrators, or parties must act; breach requires litigation | Threshold signers must co-sign each transaction; no automatic execution |
Reversibility | Irreversible once confirmed; upgradeable only via proxy pattern with governance | Reversible through negotiation, court order, or mutual rescission | Reversible before signing threshold is met; confirmed transactions are final |
Transparency | Code publicly verifiable onchain; Etherscan shows every call and state change | Private unless disclosed; terms visible only to parties and their counsel | Signers and threshold public onchain; transaction history fully visible |
Custody | Contract holds assets; no single party controls them; only code governs release | Assets held by parties, banks, or escrow agents; counterparty risk present | Assets held by the multisig contract; n-of-m signers required for any movement |
Cost | Gas fees per execution (~21,000 to 500,000 gas units on Ethereum mainnet) | Legal drafting, notarization, and potential litigation; hundreds to thousands per agreement | Gas per transaction multiplied by the number of required co-signers |
The practical implication: smart contracts outperform traditional contracts at high-frequency, rule-bound, low-trust interactions where ambiguity is absent. Traditional contracts handle ambiguity through judicial interpretation. Smart contracts handle ambiguity by doing exactly what the code says, including bugs. This is the fundamental trade-off between finality and flexibility.
Smart Contracts and USDC: How Circle Uses Burn-and-Mint Logic
Circle's Cross-Chain Transfer Protocol (CCTP) demonstrates smart contracts operating at the infrastructure layer of the $77.3 billion USDC stablecoin. On each supported chain, a TokenMessenger contract burns USDC and emits an attestation message, and a MessageTransmitter on the destination mints equivalent native USDC after Circle verifies the burn. No wrapped tokens exist in this architecture.
This burn-and-mint pattern eliminates liquidity fragmentation. Bridges that lock-and-mint create synthetic tokens (such as USDC.e on Arbitrum) that can de-peg if the bridge is exploited. CCTP contracts rely on Circle's attestation service for finality, which introduces a single point of trust. Circle must sign off on each burn before the destination mints. This is a deliberate design choice: Circle accepts issuer-level accountability in exchange for users receiving native, non-synthetic USDC on every supported chain.
CCTP supports Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, and additional EVM chains, each as a separately audited contract instance. As of Q1 2026, CCTP had processed over $30 billion in cumulative USDC transfers since its April 2023 mainnet launch (Circle developer documentation). The architecture is a concrete example of how smart contracts encode monetary policy at the protocol layer: the rules for minting, burning, and authorizing transfers are not held by any individual. They are enforced by code.
Eco's stablecoin execution network integrates with CCTP as part of its cross-chain routing layer. When a solver fulfills a cross-chain USDC transfer through Eco Routes, settlement can route through CCTP contracts to ensure recipients receive native USDC rather than a bridge-wrapped variant.
FAQ
What is the difference between a smart contract and a regular transaction?
A regular Ethereum transaction sends ETH from one wallet to another. A smart contract transaction calls a function on a deployed program, triggering code execution that can update state, transfer tokens, emit events, or call other contracts. Smart contracts can hold funds and enforce rules autonomously; simple ETH transfers cannot. The underlying infrastructure is covered in the blockchain and distributed ledgers explainer.
Do smart contracts work on blockchains other than Ethereum?
Yes. Any EVM-compatible chain (Arbitrum, Base, Optimism, Polygon, BNB Chain, Avalanche C-Chain) runs the same Solidity-compiled bytecode as Ethereum mainnet. Non-EVM chains like Solana use different virtual machines and different languages (Rust, Anchor), but the concept of onchain self-executing programs is chain-agnostic. Eco Routes supports smart contract interactions across 15 chains including both EVM and non-EVM networks.
Can a smart contract be hacked?
The blockchain itself is not hacked, but the code a contract runs can contain vulnerabilities. Reentrancy, access control failures, oracle manipulation, and logic bugs have resulted in billions in losses. Audits from firms like Trail of Bits or OpenZeppelin Security reduce risk but do not guarantee safety. Formal verification tools like Certora's Prover and the Echidna fuzzer add mathematical assurance layers beyond manual audit.
What is an ABI in a smart contract context?
An ABI (application binary interface) is the specification defining a smart contract's external interface: which functions exist, what arguments each accepts, and what types they return. Wallets and developer tools use the ABI to encode function calls into the binary format the EVM reads. The ERC standards define shared ABIs so any compliant wallet can call any compliant token without custom integration work.
How are ERC-20 tokens related to smart contracts?
Every ERC-20 token is a smart contract. The token's total supply, all wallet balances, and the transfer rules live in the contract's storage. When you send USDC, you are calling the transfer function on Circle's ERC-20 contract, which decrements your balance and increments the recipient's balance in one atomic state update. See the full ERC-20 token standard explainer for details on how the standard is structured.
Related reading
Sources and methodology. Stablecoin supplies and DeFi TVL pulled from DeFiLlama on April 29, 2026. Ethereum contract count from Etherscan Q1 2026 public data. EIP specifications verified against eips.ethereum.org. CCTP cumulative volume from Circle developer documentation. Figures refresh quarterly.
