Smart Contract

Self-executing code on a blockchain that automatically enforces agreement terms.

A smart contract is a self-executing program stored on a blockchain that automatically enforces the terms of an agreement when predetermined conditions are met. They eliminate the need for intermediaries and enable trustless, automated transactions.

How They Work

Smart contracts follow simple "if/then" logic. For example: "If Party A sends 1 ETH, then transfer NFT #123 to Party A." Once deployed on the blockchain, smart contracts execute automatically and cannot be altered.

Key Properties

Immutable: Once deployed, the code cannot be changed (though upgradeable patterns exist).

Deterministic: Same inputs always produce the same outputs.

Transparent: The code is publicly readable on the blockchain.

Trustless: No need to trust a third party — the code enforces the agreement.

Applications

Smart contracts power virtually all of DeFi (lending, trading, yield farming), NFTs, DAOs, gaming, insurance, and supply chain management.

Risks

Bugs in smart contracts can lead to catastrophic losses. Code audits, formal verification, and bug bounties are essential security practices.

Frequently Asked Questions

What is a smart contract?

A smart contract is a self-executing program on a blockchain that automatically enforces agreement terms when conditions are met. They eliminate intermediaries and enable trustless transactions — the foundation of DeFi, NFTs, and DAOs.

Are smart contracts safe?

Smart contracts are as safe as their code. Bugs can lead to catastrophic losses — billions have been lost to exploits. Well-audited contracts from established protocols are generally safe, but new or unaudited contracts carry significant risk.

Can smart contracts be changed after deployment?

Standard smart contracts are immutable once deployed. However, "upgradeable" patterns exist using proxy contracts. While useful for fixing bugs, upgradeability also means the team could potentially introduce malicious changes.

Related Terms

Atomic Swap

A trustless exchange of one cryptocurrency for another without using a centralized intermediary.

Atomicity

The property ensuring a transaction either completes fully or doesn't execute at all.

DAO

Decentralized Autonomous Organization — a community-led entity governed by smart contracts.

DApp

Decentralized Application — an application running on a blockchain network.

DeFi

Decentralized Finance — financial services built on blockchain without intermediaries.

DEX

Decentralized Exchange — a peer-to-peer marketplace for trading crypto without intermediaries.

EIP

Ethereum Improvement Proposal — a design document for proposing changes to the Ethereum network.

ERC-20

A technical standard for creating fungible tokens on the Ethereum blockchain.

Ethereum

A blockchain platform enabling smart contracts and decentralized applications.

Immutable

A property of blockchain data meaning it cannot be changed or deleted once recorded.

Mainnet

The primary, live blockchain network where real transactions are processed.

NFT

Non-Fungible Token — a unique digital asset representing ownership of a specific item.

On-Chain

Transactions or data that are recorded directly on the blockchain.

Oracle

A service that provides real-world data to smart contracts on the blockchain.

Rug Pull

A scam where developers abandon a project and run away with investors' funds.

Token

A digital asset created on an existing blockchain rather than its own native chain.

Turing Complete

A system capable of performing any computation, given enough resources.

Zero Address

A special blockchain address with all zeros, commonly used as a burn destination.