Crypto glossary

Smart contract

Definition

A smart contract is a program stored on a blockchain that runs automatically when predefined conditions are met, with no intermediary involved.

A smart contract is code deployed to an address on a blockchain. Once deployed, anyone can call its functions by sending a transaction, and every node in the network executes the same code and agrees on the result. Ethereum popularized the idea in 2015, and most smart contracts today are written in Solidity and run on the Ethereum Virtual Machine (EVM) or compatible chains.

Smart contracts power tokens, decentralized exchanges, lending protocols, NFTs and DAOs. They hold funds and move them according to their own rules, so users do not need to trust a company to process a trade or a loan.

The trade-off is that the code is public and often cannot be changed. A bug or a poorly protected upgrade mechanism can be exploited, and many of the largest hacks in crypto have come from smart contract vulnerabilities. Audits reduce that risk but do not eliminate it.

Example

When you swap ETH for USDC on Uniswap, a smart contract checks the pool's balances, calculates the price, takes your ETH and sends you USDC in a single transaction.

Related terms

Latest articles on Smart contract