Skip to content
CRYPTAURUS
Ethereum › What is a smart contract in a blockchain?
Ethereum

What is a smart contract in a blockchain?

smart contract · also: self-executing contract, smart contracts, blockchain program, Solana program, dapp
A smart contract is a program stored on a blockchain that carries out set rules by itself, with no middleman, for example moving tokens once a condition is met. The network does not roll back an operation that has been carried out, so a bug in a smart contract's code can cost money.

A smart contract in plain words

A blockchain is a shared ledger of transfers, copies of which are kept by many computers on the network. A smart contract lives in this ledger at its own address, a number on the network much like an ordinary "account", and that address holds the program's code and data1. The network's computers run this code the same way for everyone, and the result is written into the ledger.

A smart contract is like a vending machine1. You drop in a coin and press a button, the machine hands you a drink, and no salesperson is needed. The machine's rule is the same for every customer, and there is no talking it into giving you a drink without paying. A smart contract works the same way, only with crypto and blockchain records.

The term was coined by Nick Szabo, who described the idea in 1994, long before blockchains appeared2. The word "contract" here means a rule written into a program, with no paper and no signatures from the parties. Whether a smart contract has the force of a legal agreement depends on each country's law ⚖️.

Every call to a smart contract is an operation on the blockchain, and it costs a network fee, which on Ethereum is called gas. Whoever sends the operation pays, although some apps can take that payment on themselves. How the fee works is explained in what is gas.

Smart contracts exist on many networks, such as Ethereum, Tron and Solana. Programs written for Ethereum also run unchanged on compatible networks such as BNB Chain and Polygon; what is EVM explains this in more detail.

Deeper

How tokens and permissions relate to smart contracts

Tokens, that is, crypto issued on top of someone else's network, are entries in the books of smart contracts. Each token, such as USDT on Ethereum or on Tron, is run by its own smart contract, which records how many tokens sit at each address3. The article what is a token explains how tokens work, and token standards shows how their formats differ across networks.

Stablecoins, swaps of one cryptocurrency for another without a company in the middle, and the issuing of NFTs all run on smart contracts2. The website through which you use such a service is only a window onto the smart contract; the actual work is done by the code on the blockchain4. Stablecoins are covered in what is a stablecoin, and NFTs in what is an NFT.

A smart contract does not touch your tokens on its own. Someone else's smart contract can take them from your address only if you gave it permission, for example by pressing "Allow" or "Sign" in your wallet on its website5. Separately, tokens can be frozen or burned by their issuer, the company that released them, if the token's smart contract includes that ability. What such permissions look like in a wallet and how to revoke them is covered in wallet connection safety.

A smart contract cannot see data from the outside world, such as an exchange rate, by itself. That data is passed to it by oracles, separate services that bring data onto the blockchain, and if an oracle passes on a wrong price, the smart contract applies its rule at that wrong price6. One oracle network is described in the Chainlink profile.

What cannot be undone in a smart contract

An operation carried out by a smart contract cannot be undone by ordinary means1. The consequences can be fixed only with a new operation or by changing the rules of the whole network, as after The DAO hack described below. By default, the code of a deployed smart contract does not change either7.

Some projects still make their smart contracts upgradeable. Then you are trusting whoever controls the upgrades, and a new version can change the rules for everyone. To lower that risk, upgrades are approved by several signatures or by a vote of holders, or they take effect after a delay that gives anyone who disagrees time to leave7.

On the blockchain, a smart contract is stored as machine code that a person cannot read. You can check that the published text of the program matches the deployed code in a block explorer, a website that shows all addresses and operations. A smart contract that has passed this check is marked there as verified (Verified)8.

Can you get your money back if a smart contract misfired?

Usually not. Crypto that has left a smart contract because of a bug or a hack can't be recovered in most cases9. There is a chance if the smart contract was built with a refund function or has an administrator with the right to step in. You can find this out in the project's documentation and in the verified code on a block explorer. If the project offers refunds, use only its official website.

Risks of smart contracts

A bug in the code is a risk the network does not protect you from. More than a billion dollars has been stolen or lost because of bugs in smart contracts9.

In 2017 a single bug in a shared program locked people out of their crypto in Parity multisig wallets, wallets where a transfer must be approved by several owners10. A proposal to restore it by changing the network's rules was made and then withdrawn11. Another case, the hack of The DAO smart contract in 2016, ended with the Ethereum network splitting in two12; it is covered in hard fork.

Bugs are hunted by independent reviews of the code, called audits. An audit finds some of the problems the developers missed, but it does not catch every bug9. So an "audited" label lowers the risk without guaranteeing anything.

Anyone can deploy a smart contract1, and some of them are fraudulent, for example tokens carrying the name of a well-known cryptocurrency. Such schemes are described in phishing and scams.

Who is responsible if a smart contract gets hacked?

There is no single answer. Whether a project's creators and managers are liable depends on the country's legislation, the project's terms and the courts ⚖️. If you have lost money, save the smart contract's address and the hashes of your operations, that is, their numbers on the network, which let you find them in a block explorer. Follow the project's statements on its official website and report the theft to the police in your country. Do not pay anyone who contacts you first and promises to get your money back for a fee; this is a common scam.

Before using an unfamiliar smart contract, check four things:

  • the address of the smart contract matches the one in the project's official documentation
    where to check: the project's official documentation, the section with smart contract addresses
    ;
  • the code is marked as verified in a block explorer;
  • it is known who can upgrade the smart contract or pause it;
  • the amount is one you can afford to lose, especially on your first operation.

More detail on smart contracts across networks and the Parity case

On Tron, smart contracts are run by its own virtual machine, TVM, and programs for it are written in Solidity, the same language used for Ethereum13. On Solana, smart contracts are called programs14. A program can be updated by whoever holds the upgrade authority, usually the one who deployed it, and if that authority is revoked, nobody can change the program any more15. Bitcoin has a language of simple conditions for transfers. With it you can require signatures from several owners or forbid spending coins before a set time16.

The Parity bug struck on 6 November 2017. All multisig wallets created after 20 July 2017 worked through one shared library program. A user apparently became its owner by accident and deleted the library, after which the wallets that relied on it stopped working10. The proposal to bring the library back through a change to the network rules appeared in 201811.

Frequently asked questions

Is a smart contract a legally binding agreement?
Not by itself; it depends on national law ⚖️. In England and Wales, for example, it was concluded in 2021 that existing law already allows agreements whose terms are written in code17.
Are a smart contract and a dapp the same thing?
No. A dapp, or decentralized application, is a smart contract together with the website or app through which people use it4. The website can be shut down or faked, while the smart contract keeps working at its address.
Can a smart contract be deleted on Ethereum?
By default, no: a smart contract stays on the blockchain forever1.
Sources
They back the facts above. Changing figures aren't published — for those we link to "where to check".
1Introduction to smart contracts ethereum.org ↩Verified 30.10.2026 · primary source
2Smart contracts ethereum.org ↩Verified 30.10.2026 · primary source
3TRC-20 protocol interface developers.tron.network ↩Verified 30.10.2026 · primary source
4Introduction to dapps ethereum.org ↩Verified 30.10.2026 · primary source
5EIP-20: Token Standard eips.ethereum.org ↩Verified 30.10.2026 · primary source
6Oracles ethereum.org ↩Verified 30.10.2026 · primary source
7Upgrading smart contracts ethereum.org ↩Verified 30.10.2026 · primary source
8Verifying smart contracts ethereum.org ↩Verified 30.10.2026 · primary source
9Smart contract security ethereum.org ↩Verified 30.10.2026 · primary source
10A major vulnerability has frozen hundreds of millions of dollars of Ethereum techcrunch.comsecondary ↩Verified 30.10.2026
11EIP-999: Restore Contract Code at 0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4 eips.ethereum.org ↩Verified 30.10.2026 · primary source
12The history of Ethereum ethereum.org ↩Verified 30.10.2026 · primary source
13TRON Virtual Machine (TVM) developers.tron.network ↩Verified 30.10.2026 · primary source
14Solana program ack3.aisecondary ↩Verified 30.10.2026
15Deploying Programs solana.com ↩Verified 30.10.2026 · primary source
16Transactions developer.bitcoin.org ↩Verified 30.10.2026 · primary source
17Smart legal contracts lawcom.gov.uk ↩Verified 30.10.2026 · primary source