Like many innovations labelled “smart,” the concept of smart contracts may produce a feeling of anything but knowledgeability among many people. The truth is, however, that smart contracts are actually quite simple, and their use in commerce and other fields is expanding. Smart contract capability is what put the Ethereum blockchain on the map and made it so wildly popular. It’s also the coveted functionality behind Cardano’s recent Alonzo upgrade as well as other blockchains, such as Solana and Algorand, that are recently soaring in popularity.
This Forkast.News explainer is a quick way to get up to speed on this increasingly important part of the blockchain ecosystem. Here, we cover the following:
1. What is a smart contract?
2. Where did the idea of smart contracts come from?
3. How do smart contracts work?
4. What’s in a smart contract?
5. How are smart contracts used?
6. Why use smart contracts?
7. Potential pitfalls of smart contracts
8. How is risk managed in smart contracts?
9. What is the future of this technology?
What is a smart contract?
A smart contract is a piece of computer code that runs on a blockchain in accordance with predefined conditions that contracting parties have agreed to. It contains the terms of the agreement between the parties and a set of predetermined rules that self-executes when certain conditions are met, releasing funds, for example, to one of the parties under certain previously agreed circumstances. .
Under a smart contract, two or more unknown parties can engage in a transaction without the involvement of intermediaries such as lawyers, banks or central authorities.
Smart contracts enable those parties to exchange funds, property, shares or any other items of value on a decentralized basis, making transactions traceable, transparent and immutable.
They reduce the costs and time involved in reaching, formalizing and enforcing agreements in a so-called trustless environment.
Where did the idea of smart contracts come from?
The first proponent of smart contracts was U.S. computer scientist Nick Szabo, who in 1994 hit on the idea of recording contracts in a piece of code that activated once specific requirements were fulfilled.
Szabo, who went on to devise BitGold, a precursor to Bitcoin, had the goal of eliminating the need for intermediaries in transactions.
In a paper titled “Formalizing and Securing Relationships on Public Networks,” Szabo defined smart contracts as digital protocols for data transfers using algorithms to self-enforce transactions based on established conditions.
But Szabo’s notion of a smart contract was too complex to implement without blockchain technology, which had yet to be invented.
In 2008, Bitcoin appeared, ushering in a wave of distributed ledger technologies. The blockchain on which Bitcoin was based wasn’t designed for smart contracts but it set the stage for the later development of Ethereum, the first to put the idea to work.
In 2013, Ethereum’s co-founder, Vitalik Buterin, published a white paper titled “Ethereum: The Ultimate Smart Contract and Decentralized Application Platform.” Ethereum’s runaway success paved the way for the development of other smart contract platforms like Binance Smart Chain, Cardano, Solana, Hyperledger Fabric, NEO, Algorand and Cosmos.
How do smart contracts work?
The way smart contracts work is based on “if-this-then-that” logic, with its code dictating that certain actions be taken once specific conditions are met.
For example, if Frank wants to buy a car from Christine, and both Frank and Christine are unwilling to pay the fees charged by a car dealer and to commit to the dealer’s timetable for closing the transaction, they create a smart contract on a blockchain.
The contract states that Frank will receive the ownership papers for the car once he pays Chris two units of a mutually agreed cryptocurrency. Once the agreement has been created, it becomes irreversible. Frank can feel safe paying Christine the agreed sum for the car ownership documents, knowing that their contract can’t be altered or unravelled.
Once Christine receives the funds, the smart contract executes and automatically delivers the documents to Frank. By lodging the agreement on a blockchain, both parties can avoid involving third parties, becoming entangled in potentially restrictive policies and paying fees to any entity outside the transaction.
What’s in a smart contract?
Smart contracts have three integral parts: signatories, subjects and terms that define their rules.
Signatories are the parties that have come together to transact on the blockchain and who agree to the contract’s terms using digital signatures. In our analogy above, the signatories are Frank and Christine.
The subject of the agreement is the documentation conferring ownership or another right to the good or service to be transacted under the smart contract. The contract code will require unobstructed, easy access to this. In our analogy, the subject is the documentation proving the car’s ownership.
The terms of the contract are mutually agreed and determine the sequence of actions that take place once the contract executes.
How are smart contracts used?
Smart contracts have many uses, especially in decentralized finance but also in such disparate applications as insurance, healthcare and supply-chain management.
Smart contracts is the technology that enables DeFi to provide bank-like services — such as yield farming, borrowing and lending — in a manner that is automated by computer code and does not require any human intermediaries.
Insurance companies can use smart contracts for managing claims, for instance, and for preventing fraud and other abuses. Smart contracts can also boost transparency and trust in a sector in which consumers are often trapped within the so-called walled gardens of their own insurance providers’ offerings, giving them easy and trustworthy access to their own data.
In 2017, for instance, French insurance giant AXA rolled out Fizzy, a flight-delay product that stores and processes payouts via smart contracts. Built on the Ethereum blockchain, Fizzy automatically pays customers who purchase flight-delay insurance from AXA for all flight delays of more than two hours.
In the health care sector, managing patients’ data is a huge task for many businesses and other organizations. Health insurance is another area in which smart contracts can streamline administrative processes.
EncrypGen, for example, is a DNA data marketplace launched in 2018 that transfers patients’ DNA data via a smart contract, allowing individuals to control how they share their genomic information with researchers.
Smart contracts can also streamline supply chain processes, allowing customers to purchase from suppliers without going through traditional intermediaries.
In trade finance, smart contracts can automate labor-intensive processes such as approval workflows and clearing calculations, and they can be used in applications such as banking, tax records, property sales, and wholesale and retail supply chains.
Why use smart contracts?
Under a smart contract, parties to the contract don’t require go-betweens or facilitators to enable a transaction, reducing opportunities for external interference.
Smart contracts are safer than traditional contracts, thanks to cryptography. They also duplicate documents regularly, which protects transacting parties in the event of data loss.
Smart contracts eliminate the need for third parties and the payment of their fees.
Smart contracts save time that would otherwise be spent signing paper documents, dispatching those documents, dealing with third parties, and carrying out other administrative tasks.
Potential pitfalls of smart contracts
Smart contracts can be susceptible to attacks and vulnerabilities in their code. DeFi protocols such as Origin, Akropolis, Uniswap and Ethereum wallet Parity have all suffered losses due to smart contract vulnerabilities. Researchers estimate that about 45% of smart contracts written in Ethereum’s Solidity language are vulnerable. Some security threats of smart contracts are as follows:
Denial of service attacks
A DoS attack occurs when a perpetrator floods and shuts down a network, making it unavailable to its users by disrupting the host. Smart contracts are vulnerable to such attacks, for instance, if an attacker is successful in repeatedly engaging the bid function in smart contract-based auction, preventing genuine users from placing their bids.
Random access memory exploitation
EOS blockchain nodes require considerable RAM to process transactions. Malicious actors could allocate RAM from other users, essentially reducing their ability to confirm transactions. They could then create malicious smart contracts, eventually occupying and blocking the RAM of others and completely shutting them out of those operations. Victims would be unable to perform any operations involving their funds and RAM.
A digital procedure becomes re-entrant if it can be interrupted while in progress and re-entered, with both procedures able to run and complete without any execution errors.
Ethereum contracts are particularly prone to re-entrancy attacks. Such attacks make it possible for hackers to change the state of contracts while they are in their execution phase. The infamous DAO hack in 2016 was a re-entrancy attack, as was the more recent Uniswap theft last year.
How is risk managed in smart contracts?
Because smart contracts are self-enforcing and immutable, once they are deployed on a blockchain, any bugs present in their code are also unalterable.
potential coding vulnerabilities make security audits of smart contracts critically important. Most blockchain developers put their code through extensive reviews that can last for weeks after development. These reviews improve the chances of discovering bugs or flaws in the code and fixing them before it is activated.
What is the future of smart contracts?
Smart contracts introduce a new, transparent way of doing business, where peer-to-peer transactions can happen in a trustless environment. Moreover, advanced smart contract infrastructure has the potential to revolutionize shipping, logistics and trade on a global scale. Smart contracts can make transactions faster, cheaper, and more efficient from real estate to construction as well as supply chain management.
Currently, smart contracts are mainly used in the fintech space, where transaction efficiency and transparency are critical. Yet, as more blockchain networks launch their smart contract functionalities, other industries may also find more uses for the technology.
Fintech giant PayPal has already recognized the benefits of cryptocurrency, launching “Checkout with Crypto,” an upgrade that enables customers in the U.S. to use cryptocurrencies in their PayPal wallet — making crypto payments possible for millions of businesses, while also increasing the utility of digital assets. The platform is also rumored to be developing a crypto “Super App,” with other fintech platforms likely to follow suit.
The utility industry is also adopting smart contracts, leveraging them to boost the efficiency of energy distribution in microgrids. Smart contract algorithms monitor the real-time usage of each user, as they are linked to smart sensors enabled by IoT (internet of things). Smart contracts make sure that no surplus of energy is distributed in the network, while they can enable users to pay for their energy consumption in real-time, using cryptocurrencies.
With additional reporting by Zoltan Vardai.