Blockplain, home page
← Back to home

Smart contracts

A smart contract is a program stored on a blockchain. Every computer on the network runs it the same way, and once it is there it is hard to change. That cuts both ways.

Information, not advice.

A program on the record

A smart contract is code, and the data it keeps, placed on a blockchain with a signed transaction. Anyone can send it a transaction. Every computer that runs it must get the same result, and the result is added to the record.

ethereum.org compares it to a vending machine: put in the right inputs and a set output follows.

Not every blockchain can run smart contracts. Ethereum can.

Technical detail

The term dates from 1994, when Nick Szabo described a computerised transaction protocol that carries out the terms of a contract.

On Ethereum a contract has its own address, a contract account, worked out when it is put on the chain.

It runs the same way for everyone

No one can make a contract act differently for one person. That is why it can stand in for a middleman: it can hold money and pay it out when its conditions are met.

Each run costs a fee. On Ethereum the fee is measured in gas and paid in ETH. If a transaction runs out of gas part-way, its changes are undone, but the fee is still spent.

Technical detail

A contract must be deterministic: the same input always gives the same output, so that every node agrees. The fee limit also stops a contract that would never finish from tying up the network.

Why that cuts both ways

Contracts are written by people, and code can have mistakes. On Ethereum, a contract cannot be deleted by default, and what is done through it cannot be reversed.

So a contract with a flaw may be impossible to fix, and money taken through a flaw generally cannot be pulled back. Using a contract means trusting that its code has no loophole.

Contracts that can be changed

To allow fixes, some contracts are built to be changed later. Users send transactions to a fixed address, which passes each one on to code that can be swapped for new code.

That means trusting whoever holds the power to swap it. ethereum.org warns that whoever can use the upgrade functions can change the entire contract.

Technical detail

The fixed contract is a proxy contract; it delegates every call to a logic contract, and the logic contract's address can be changed.

Worked example: what a token's code can let its owner do

On Ethereum, a token is kept track of by a smart contract: the contract records who holds how many. Tokens can stand for almost anything, from points in a game to a share in a company.

The same code can give the contract's owner powers over everyone's tokens. The token check on this site looks in a token's published code for six of them:

  • Create more tokens. New tokens can be made after launch, which adds to how many exist.
  • Freeze or wipe a balance. One holder's tokens can be locked so they cannot move them, or taken away.
  • Pause transfers. All transfers of the token can be stopped at once, for as long as it stays paused.
  • Change the code. The rules in the token's code can be swapped for different rules later.
  • Block an address. An address can be put on a list, and its transfers are then refused.
  • A fee on a transfer or a sale. Part of each transfer, purchase or sale can be kept back as a fee.

The six patterns were chosen by reading verified token code on 20 Oct 2026. A token whose code has none of them can still lose its value: the check reads what the code allows, not what anyone will do.

Technical detail

Each power is a pattern of function names the check looks for in verified source on Sourcify. A match means the code is there. It does not say who can still use it, or whether they will.

Contracts and the real world

A smart contract can only use data already on its blockchain, or data sent to it in a transaction. It cannot look at a website, or see whether a parcel arrived. That gap is called the oracle problem: see the limits.