Skip to content

Smart contract

A program on a blockchain that runs by itself when its conditions are met.

A smart contract is a computer program stored on a blockchain that runs by itself when certain conditions are met. The idea goes back to the 1990s, when computer scientist Nick Szabo compared it to a vending machine: put in the right money, pick an item, and the machine hands it over. Nobody has to approve each sale, because the rules are built into the machine.

Smart contracts are what make tokens and tokenization work. A smart contract can create a token, keep track of who owns it and enforce its rules, like who’s allowed to hold it or when interest gets paid. Because the code runs the same way for everyone and every result is recorded on the blockchain, the people involved can rely on the code to carry out each step instead of a middleman. That can make deals faster, cheaper and easier to check.

The catch is that a smart contract does exactly what its code says, not what its authors meant. On blockchains like Ethereum, a contract’s code can’t be edited once it’s live, so a mistake can be hard or impossible to fix. In 2016, a bug in a project called The DAO let an attacker drain about 3.6 million ether, worth tens of millions of dollars at the time. Some contracts are built so they can be upgraded, but then someone holds the power to change them. Code reviews, independent audits and a plan for when things go wrong all help. What this means for you depends on your role, whether you write the contract, rely on it to hold clients’ assets, or simply hold a token it created.