A smart contract is a program deployed on a blockchain. On Ethereum, it has an address, executable code, and persistent state. Transactions can invoke its functions, and contracts can call other contracts. Network nodes execute these operations according to the same rules.1

ExecutionReport an error

Ethereum contracts are compiled into code that its virtual machine can execute. Deploying a contract is a transaction and consumes gas, as does executing operations through transactions. Contracts can enforce conditions before allowing an operation and combine calls to other programs into an application.1

ERC-20 illustrates how standard interfaces support this composition. A token contract exposes operations for reading balances, transferring tokens, and granting spending allowances. Applications can integrate that interface without requiring each issuer to invent different transaction methods. The standard specifies an interface, not a guarantee about the token's value or its issuer.2

Permissions and upgradesReport an error

An Ethereum contract account is controlled by its code. Its rules may authorise particular accounts to perform privileged operations; being deployed on a public chain does not itself make every operation open to everyone.31

A proxy delegates execution to an implementation contract while retaining its own storage. An upgrade changes which implementation it uses. ERC-1967 standardises storage locations for the implementation, beacon, and administrator, helping tools identify these relationships. An upgradeable application therefore needs scrutiny of both its current code and the authority able to replace that code.4

Limitations and failuresReport an error

Solidity's security documentation identifies reentrancy as a risk when a contract gives control to another contract before completing its own state changes. It also warns that information marked private in Solidity is not secret from observers of the blockchain. Compiler and platform bugs remain possible even when application code appears correct.5

External events require an oracle to supply data that the contract can read. Agreement about execution does not establish that the supplied information accurately represents the outside world.6

TimelineReport an error

Date Event
2015-07-30 Ethereum's Frontier network launches7
2015-11-19 ERC-20 proposed2
2019-04-24 ERC-1967 proxy storage proposal created4

See alsoReport an error

ReferencesReport an error


  1. ^ a b c d ethereum.org. Introduction to smart contracts. https://ethereum.org/en/developers/docs/smart-contracts/ 

  2. ^ a b c Vogelsteller, F. and Buterin, V. (2015). ERC-20: Token Standard. https://eips.ethereum.org/EIPS/eip-20 

  3. ^ ethereum.org. Ethereum accounts. https://ethereum.org/en/developers/docs/accounts/ 

  4. ^ a b c Palladino, S., Giordano, F. and Croubois, H. (2019). ERC-1967: Proxy Storage Slots. https://eips.ethereum.org/EIPS/eip-1967 

  5. ^ Solidity documentation. Security considerations. https://docs.soliditylang.org/en/latest/security-considerations.html 

  6. ^ ethereum.org. Oracles. https://ethereum.org/en/developers/docs/oracles/ 

  7. ^ Ethereum Foundation (30 July 2015). Ethereum launches. https://blog.ethereum.org/2015/07/30/ethereum-launches