A smart contract is a piece of code deployed on a blockchain that executes automatically when specific conditions are satisfied. The concept was proposed by Nick Szabo in 1994, but it became practical only after Ethereum launched in 2015 with built-in support for on-chain programs.
How smart contracts work
Think of a smart contract as a digital vending machine. You send a defined input, the code checks the conditions, and if everything matches, it delivers the output. No human needs to approve the transaction, and no one can alter the outcome once the code is deployed.
For example, a DeFi lending smart contract might work as follows: 1. A user deposits stablecoin collateral. 2. The contract verifies the collateral exceeds the required ratio. 3. It automatically lends the requested amount. 4. If the collateral value drops below the threshold, the contract automatically liquidates the position.
All of this happens on-chain, transparently, without a bank or a loan officer.
Where smart contracts are used
- [DeFi](/glossary/defi): lending, borrowing, trading and insurance.
- [NFTs](/glossary/nft): minting, transferring and enforcing royalties on resale.
- [Stablecoins](/glossary/stablecoin): algorithmic stablecoins rely on smart contracts to maintain their peg.
- DAOs: governance and treasury management.
- Supply chain: tracking goods from manufacturer to consumer.
- Token launches: creating and distributing new crypto tokens.
Smart contract platforms
Ethereum is the largest, but Solana, Cardano, Polygon, Avalanche and BNB Chain also support smart contracts. Each platform uses its own programming language and execution environment. Ethereum uses Solidity; Solana uses Rust.
Risks and limitations
- Bugs are expensive: once deployed, a smart contract's code typically cannot be changed. A bug can lead to permanent loss of funds. The DAO hack of 2016 exploited a code vulnerability and drained millions of dollars.
- Oracle dependency: smart contracts cannot access external data directly. They rely on oracles, data feeds that bring off-chain information on-chain, which introduces a point of trust.
- [Gas fees](/glossary/gas-fees): every interaction with a smart contract costs gas, and complex contracts cost more.
- Audit necessity: reputable projects hire independent auditors to review their contracts before deployment.
Smart contracts and India
There is no specific Indian regulation for smart contracts. The Indian Contract Act, 1872, requires valid contracts to have free consent, lawful consideration and a lawful object. Whether smart contracts satisfy these requirements in a legal dispute remains untested in Indian courts.