A smart contract in a blockchain is a program stored at an on-chain address that runs when a transaction or other supported trigger invokes it. It can apply programmed rules to data and assets available to it, and the blockchain records resulting state changes. The term describes software behavior; by itself, it does not establish legal status or guarantee a real-world outcome.
What is a smart contract in a blockchain?
In Ethereum, a smart contract contains executable functions and persistent data at a blockchain address. Applications can use those functions to request specific behavior, while the contract’s stored data represents its current on-chain state. Other blockchain platforms may use different execution and storage models, so this description is a concrete Ethereum example rather than a universal implementation specification. (source )
A blockchain is a database shared across networked computers. Blocks cryptographically reference earlier blocks, and nodes use consensus to agree on state. A contract’s code and data therefore operate within a network’s rules; they are not an independent service that can choose how the network treats a transaction. (source )
“Smart contract” can sound like a legal term, but here it means an on-chain program. The label alone does not show that a legal agreement exists, that code reflects the parties’ intentions, or that an outcome will be recognized outside the blockchain.
How a smart contract runs after a transaction
The basic sequence is:
- An invocation is submitted. A user or another program initiates a transaction that calls a contract function. The contract does not necessarily act on its own; execution requires a transaction or another trigger supported by the system. (source )
- The network processes the request. The transaction is handled under the blockchain’s protocol rules and execution environment. The details of validation and execution depend on the network.
- The code applies its programmed logic. The contract evaluates available inputs and performs the actions its code specifies. It may manage on-chain assets or update its own data, but only within the capabilities and conditions of that environment. (source )
- The result is reflected in blockchain state. When execution succeeds, the resulting state changes are recorded according to the network’s rules. A failed execution does not mean the intended action occurred; the exact failure and fee behavior depends on the network and transaction context.
This walkthrough is conceptual, not a universal transaction recipe. It does not specify how to construct or submit a transaction, or promise a particular execution result.
What smart contracts can and cannot control
A contract can enforce programmed conditions over information and assets available within its execution environment. For example, code can be written to transfer an on-chain asset when its specified conditions are met. That is conditional software behavior, not evidence that the conditions are fair, correctly written, or aligned with a user’s expectations. Programmed actions remain limited by the correctness of the code and its inputs. (source )
Contracts also have an information boundary. An Ethereum smart contract cannot directly retrieve facts that exist only off-chain. To act on such facts, a system needs an oracle or another mechanism that supplies information to the blockchain. (source )
An external input does not become reliable merely because a contract uses it. The data source, update process, availability, and trust model matter. If those inputs are wrong or unavailable, the contract may act on incomplete or inaccurate information. The code executes according to the information it receives; it does not independently confirm real-world events.
For that reason, automation should not be confused with a guarantee. A program can carry out its coded instructions, but the term itself does not guarantee correctness, fairness, legal enforceability, or a particular off-chain result.
Smart contracts, dApps, and legal contracts
A decentralized application, or dApp, may combine a smart contract with a user interface and other components. The contract is the on-chain program, not necessarily the entire application. A screen or service that helps a person interact with a contract is distinct from the code and state stored on the blockchain.
“Legal contract” is a separate question. Whether an agreement is legally recognized depends on applicable law and the facts; a blockchain program’s label does not settle that question. This definition does not assess enforceability in any jurisdiction.
Risks and questions to check before relying on one
Contract behavior depends on code, inputs, and any other components it calls. Contracts can reuse or call independent on-chain components through public interfaces, a property known as composability. Each dependency introduces additional behavior, availability, upgrade, permission, and economic assumptions that matter to the overall system. (source )
Before relying on a contract, identify what it is intended to do, what information or assets it can act on, and whether it depends on external data or other contracts. Consult documentation for the specific contract and network to understand any administrative controls, upgrade arrangements, and recovery options; these are not implied by the phrase “smart contract.”
Do not infer that a contract is secure, compliant, recoverable, available, or free to use from its name or definition. Those questions require evidence specific to the code, network, dependencies, and—in legal matters—the relevant jurisdiction. A smart contract is best understood as software that can automate specified on-chain behavior, with limits set by its implementation and its surrounding systems.
Sources and references
- Anatomy of smart contracts — ethereum.org; retrieved 2026-10-19.
- Smart contract composability — ethereum.org; retrieved 2026-10-19.
- Smart Contract Overview — Chainlink Documentation; retrieved 2026-10-19.
- Technical intro to Ethereum — ethereum.org; retrieved 2026-10-19.
- Smart Contract Overview — Chainlink Documentation; retrieved 2026-10-19.