A smart contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract. Smart contracts allow the performance of credible transactions without third parties.
These transactions are trackable and irreversible. Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of fraud or third party interference.
In the Ethereum blockchain, a smart contract is simply a piece of code that is deployed to the Ethereum blockchain. When it is deployed, it lives on the blockchain in an immutable state and can interact with other contracts, execute transactions, and store data on the blockchain.
The most common use case for smart contracts is to create a token sale. In a token sale, a smart contract is used to manage the distribution of tokens to buyers.
The smart contract keeps track of who has sent ETH to the contract, and how many tokens they are entitled to. When the token sale ends, the smart contract automatically distributes the tokens to buyers.
Another common use case for smart contracts is to create a decentralized exchange. A decentralized exchange is an exchange that does not rely on a third party to hold customers’ funds.
Instead, trades are executed directly between users through smart contracts. This type of exchange is often called an “atomic swap”.
Atomic swaps are possible because both parties can trust that the smart contract will execute as programmed and that their funds will not be stolen by a third party. This trustless environment opens up a whole new world of possibilities for decentralized applications.
Smart contracts were first proposed by Nick Szabo in 1996 as a way to digitally facilitate, verify, or enforce the negotiation or performance of a contract. Szabo realized that distributed ledgers could be used to create tamper-proof digital records of agreements.
He proposed using digital signatures and cryptographic hash functions to create “a practical Byzantine fault-tolerant digital timestamp server” which could be used to create unforgeable digital records of agreements.
While Szabo’s idea was ahead of its time, it laid the foundation for the development of smart contracts on blockchains. In 2009, Satoshi Nakamoto published his famous white paper “Bitcoin: A Peer-to-Peer Electronic Cash System” which proposed using a distributed ledger to record transactions in a tamper-proof way.
This was the first time that blockchains were proposed as a way to store data in a secure and immutable way.
In 2014, Vitalik Buterin published his white paper “Ethereum: A Next-Generation Smart Contract and Decentralized Application Platform” which proposed using blockchain technology to enable developers to create decentralized applications (dApps). Buterin realized that Nakamoto’s vision for Bitcoin could be extended beyond just payments and could be used to build any type of decentralized application imaginable.
Ethereum’s success has spurred the development of other blockchain platforms that also enable developers to build dApps. However, Ethereum remains the most popular platform for building dApps due to its large developer community and expansive ecosystem of tools and services.
Smart contracts have been called “the killer app” for blockchains because they enable so many different types of applications to be built on top of them. From token sales to decentralized exchanges, there are endless possibilities for what can be built with smart contracts.
As more people learn about blockchains and how they work, we will likely see even more innovative applications being built on top of them.