Crypto glossary
What is a smart contract?
A smart contract is a program whose code and state are stored on a blockchain. It processes transactions or calls according to its defined rules. On Ethereum, it has an address, and users or other contracts can call its functions. Despite the name, not every smart contract is a legal agreement.
How does a smart contract work?
In a simplified swap example, a user specifies the minimum output they will accept. The swap executes if the contract's conditions are met; otherwise, the transaction may fail. Failed execution can still incur network fees.
The program's existence does not mean it wakes up when a clock reaches a certain time. An appropriate transaction or call triggers execution. Onchain transaction results appear in blockchain records; there is no customer service agent deciding the outcome at their discretion.
What does the code not guarantee?
A contract cannot independently fetch an internet price or sports result. It needs a mechanism such as an oracle to receive external data. Faulty code, incorrect external inputs or broad administrator powers can harm users. Code executing successfully does not establish that an action is safe.
Some systems use designs such as proxies to change the logic being executed. Alongside the visible contract address, check who can authorize changes. Ethereum's upgrading documentation explains the main approaches.
Our Etherscan review examines what record and code screens reveal. The cryptocurrency use cases guide covers swaps and other applications.
Example
In a hypothetical swap, Alice spends 10 USDC and requires at least 9.5 sample tokens in return. If the other conditions are met, the swap contract accepts an output of 9.8 tokens but reverts the swap if it would return only 9.4. No employee approves the minimum at that moment: the programmed condition enforces it. Execution that reverts onchain can still incur a gas fee.



















