A smart contract is a program stored on a blockchain that carries out terms written in its code automatically once a transaction or another contract calls it. A program is a set of computer instructions. A blockchain is a shared record to which new entries are added one after another. A transaction is a request sent to a blockchain.
Where Does a Smart Contract Live?
A smart contract is stored at an address on a blockchain. An address is an identifier on a blockchain for a user or for a smart contract. The contract’s code, and the data that the code keeps, are stored at that address. State is the data that a smart contract keeps, so that the data is still there the next time the contract runs.
Deploying a smart contract means placing its code on the blockchain with a transaction that carries the code. After deployment, the contract has an address that transactions can be sent to.
How Do Smart Contracts Work?
A smart contract runs when a transaction or another contract calls one of its functions. To call a function is to ask a contract to run it. A function is a named piece of the contract’s code. A transaction sent to the contract’s address names a function and supplies its inputs, which are the data that the function needs.
The nodes of the blockchain network run the code of a smart contract. A node is a computer that runs the software of a blockchain network and connects to other computers on the network. When the code changes the contract’s state, the change is recorded on the blockchain.
An account is a record on a blockchain that has an address and a balance. A balance is the amount of the blockchain’s native coin that an account holds. A native coin is the native unit of a blockchain, such as BTC on Bitcoin.
On Ethereum, as its documentation describes it, there are two kinds of account. A user account is controlled by a person with a private key. A private key is a secret number that signs transactions. A contract account holds code, and a smart contract is stored at the address of a contract account.
A call to a smart contract comes from a user account or from another contract. In this entry, the phrase “self-executing” describes a contract whose code carries out its instructions once the contract is called. It does not describe a contract that starts a run by itself, because a contract account can only send messages in response to receiving a transaction.
A made-up example shows one call. Real contracts differ in what they keep and how their functions are written. In the example, a contract keeps a number of units for each of two addresses. A unit is a count that the contract keeps. Address A has 100 units, and address B has 20 units.
- A user account sends a transaction that calls the contract’s
transferfunction, asking to move 30 units from address A to address B. - The nodes run the contract’s code.
- The code checks that address A has at least 30 units.
- The code lowers address A to 70 units and raises address B to 50 units.
- The change is recorded on the blockchain. The two addresses hold 120 units in total, both before and after the call.
What Can a Smart Contract Hold and Do?
A smart contract can hold a balance of the blockchain’s native coin, as a user account can. A smart contract can also keep records in its state, such as one count for each address, and a call to one of its functions can change those records.
A smart contract can call other contracts, which lets the code of one contract use the functions of another. A function can record an event, which is a notice on the blockchain that software outside the blockchain can watch for.
A token contract is a smart contract that creates and tracks tokens. Unlike a native coin, a token is a unit issued on an existing blockchain through a smart contract. A token standard is a published specification of the functions and events that a token contract provides.
What Determines a Smart Contract’s Behavior, and Can It Still Change?
The code stored at a smart contract’s address determines what the contract does. A smart contract carries out what its code says, which can differ from what its author meant. The code at a smart contract’s address does not change after the contract is deployed, but a contract can be designed so that the behavior it runs is replaced.
A smart contract can still be designed so that its behavior can be replaced. One contract can store the address of a second contract and pass calls to it. If the first contract was designed to let the stored address change, the behavior that runs can change while the first contract’s address stays the same. A contract designed this way can also set which accounts may change the address it passes calls to.
What Is the Bitcoin Counterpart to a Smart Contract?
Bitcoin, a cryptocurrency network whose coin is BTC, has a counterpart in scripts. A script is a rule, written in Bitcoin’s script language, that must be met before an amount of BTC can move. As of October 2026, Bitcoin’s documentation describes its script language as deliberately limited. BTCFi, short for Bitcoin-native finance, is a label that various parties use for financial activity built around BTC, including smart contracts and other designs.
What Is a Code Review of a Smart Contract?
A code review of a smart contract is a check of the contract’s code by people other than its author, who read the code looking for errors. An audit is one way of doing a code review. A review can miss errors, so a review does not show that a contract’s code is free of errors.
What Are the Limits of a Smart Contract?
Without an oracle, a smart contract works only with data on the blockchain it runs on. An oracle is a service that sends outside data to a contract. Outside data is data that is not stored on the contract’s blockchain, such as an outside date or an outside result.
A mistake in the code of a deployed smart contract can stay there unless the contract was designed so that its behavior can be replaced.
November 27, 2025











