TermCrypto basicsBeginner

Smart contract

A smart contract is a program on a blockchain that carries out the terms written in its code by itself. You trigger it with a transaction and pay a network fee (gas) to run it.

How it works

A contract is deployed to a blockchain such as Ethereum and gets its own address. You send a transaction to that address, every node in the network runs the same code and gets the same result. No middleman can decide not to execute it.

DeFi services, stablecoins, NFTs and token swaps all run on smart contracts. The code is usually public, so anyone can check it. But a contract does not know what happens outside the blockchain: prices and other outside data come from oracles.

You cannot talk the code into a fix, so a bug in it can cost real money. Many contracts cannot be changed after launch, while others have admin keys that let the owner change the rules. An audit lowers the risk but does not remove it.

Example with numbers 1

You swap one token for another on a decentralized exchange. You sign a transaction, and the contract hands you the other token on its own if the swap conditions are met.

Example with numbers 2

A site asks you to sign an "unlimited" approval for USDT. If the site is a phishing page, its contract can later take all the USDT from your address without asking again.

Common mistake

The most common mistake is signing approvals on unknown sites without reading them. That lets someone else's contract spend your tokens. Check the site address, read what you are signing, approve only the amount you need and revoke old approvals from time to time.

Questions and answers

What is a smart contract in simple terms?

It is a vending machine made of code on a blockchain: meet the condition and you get the result. For example, send one token and the contract automatically gives you another.

Can smart contracts be hacked?

The blockchain itself is very hard to attack, but contract code can have bugs, and attackers have drained hundreds of millions of dollars through them. That is why audits, project reputation and careful sizing matter.

Why do I pay gas to use a smart contract?

Running a contract makes the network's nodes execute code and store the result. The gas fee pays for that work and protects the network from spam.

Read next

Updated: 2026-10-19