What is a Smart Contract?
A smart contract is a tiny computer program stored inside a blockchain. Smart contracts are similar to traditional contracts but in digital form where they’re expressed as pieces of code designed to carry out a set of instructions. In another definition, smart contracts are pieces of code that codify business logic, and at the core, they facilitate three functions: they store rules, they verify rules, and they self execute rules.
Like regular contracts, smart contracts are designed to enforce the terms and rules of an agreement. To give some examples of how smart contracts are used today, they’re used to transact cryptocurrencies, they’re used for tokenized rights and proof of identity, and in other DeFi and regular decentralized applications.
A Short History of Smart Contracts
The idea behind smart contracts came from Nick Szabo, a famous computer scientist and cryptographer, who coined the term in 1995. A great excerpt on smart contracts from Szabo can be found below:
“The basic idea of smart contracts is that many kinds of contractual clauses (such as liens, bonding, delineation of property rights, etc.) can be embedded in the hardware and software we deal with, in such a way as to make breach of contract expensive (if desired, sometimes prohibitively so) for the breacher. A canonical real-life example, which we might consider to be the primitive ancestor of smart contracts, is the humble vending machine. Within a limited amount of potential loss (the amount in the till should be less than the cost of breaching the mechanism), the machine takes in coins, and via a simple mechanism, which makes a beginner’s level problem in design with finite automata, dispense change and product fairly. Smart contracts go beyond the vending machine in proposing to embed contracts in all sorts of property that is valuable and controlled by digital means. Smart contracts reference that property in a dynamic, proactively enforced form, and provide much better observation and verification where proactive measures must fall short. And where the vending machine, like electronic mail, implements an asynchronous protocol between the vending company and the customer, some smart contracts entail multiple synchronous steps between two or more parties.”
The best analogy here is that of the vending machine. The vending machine is a decent analogy for smart contracts because they function in a similar way — for example, a person inserts money into the vending machine and selects the A1 button for their desired item, then the vending machine reads these actions as “if proper money is inserted into machine and A1 is selected, release the certain item that A1 is connected to.” In very simple terms, similar to vending machines, smart contracts are just codes that execute basic if/when commands.
Bitcoin then took this idea into action, implemented it, and was the first decentralized creation to demonstrate successful execution of smart contracts on a blockchain. However, smart contracts on the Bitcoin blockchain are limited in scope, and are mainly used for security and currency transaction purposes.
This brings us to Ethereum, which demonstrated to the world that smart contracts could be applied to many more use cases, such as decentralized applications, in which the first iteration of Ethereum smart contracts were used for DeFi dApps. The Ethereum Virtual Machine (EVM) is the Turing-complete digital apparatus and software platform that developers can use to create dApps on Ethereum. All Ethereum smart contracts and accounts live and run on the Ethereum Virtual Machine (EVM).
Smart Contract Use Cases
Smart contracts can do anything computer programs can do, they can perform computation, create currency, store data, mint NFTs, send communications, generate graphics, issue stablecoins, create and distribute unique digital assets, run exchanges, do decentralized gaming, and create standards.
Smart Contracts on The Internet Computer (IC)
The Internet Computer (IC) is a blockchain that provides seamless, limitless capacity for hosting smart contracts and their data. In particular, the IC hosts special smart contracts called canisters. A canister smart contract is a bundle of WebAssembly bytecode logic and memory pages. DApps on the Internet Computer are created from one or more canisters.
First, what’s great about IC canister smart contracts is they can serve web content directly to the end-users and these users can interact with IC blockchain services without holding tokens. Second, another advantage of canisters is that on the Internet Computer, the blockchain can host any number of canister smart contracts and can run them concurrently and all on-chain. This means developers on the IC can create dApps that scale, unlike other blockchains that have other limitations to their smart contract scalability.
Difference Between Traditional Smart Contracts & IC Smart Contracts
Therefore, a canister has all the capabilities of a traditional smart contract, but in contrast to smart contracts, canisters have performance characteristics that makes it possible to use them to build software services that scale. For example, canisters can scale up based on the application load and can call other canisters and serve hundreds of user requests simultaneously. This feature gives them the unique ability to achieve a greater number of transactions per second, and a throughput that is more impressive than Ethereum. This facet gives the Internet Computer a positive boost for hosting a greater number of DeFi applications.