Currently, smart contracts are an indispensable program that all projects use, from DEXs and Lending/Borrowing to NFTs, Marketplaces, etc. So, what is a smart contract? What are the notable features of smart contracts?
What is a Smart Contract?
A smart contract is a program that runs automatically on a blockchain. The purpose of a smart contract is to enforce the terms of an agreement without the need for third-party intervention.
For example, A sends 10 ETH to B on the Ethereum network, and B automatically sends 1,000 USDT to A.
The key feature of a smart contract, compared to a traditional contract, is that two parties in an agreement can make commitments through the blockchain without needing to know each other’s identities or having mutual trust.
So, who created smart contracts?
In 1997, the term “smart contract” first appeared in a research paper by Nick Szabo. Initially, he described smart contracts with the goals of reducing fraud and automatically enforcing the terms of agreements. Later, in his 1996 paper (here), he expanded on the potential of smart contracts by applying them to technology, finance, and more.
Nick Szabo is a renowned engineer and cryptographer from the early days of the crypto market. He is the creator of Bit Gold, a project that the community considers to be the predecessor of Bitcoin.
Characteristics of Smart Contracts
Some notable characteristics of smart contracts include:
- Self-execution: Smart contracts automatically execute without the need for third-party intervention. When conditions are met, they perform predetermined actions.
- Independence from third parties: Smart contracts operate independently and do not rely on any third parties such as banks, lawyers, or other intermediary organizations. This helps reduce transaction costs and time.
- Immutability: Once a smart contract is deployed, it cannot be deleted or altered without the consent of all participating parties. This ensures the integrity of transactions between the parties.
- Transparency: Smart contracts are stored on the blockchain, so everyone can check the information on the contract, including terms, execution time, etc.
How Smart Contracts Work
Smart contracts are essentially programs set up to follow the rules of an agreement.
Example: Trang is a landlord, and Vy is a tenant. They enter into an agreement through a smart contract. The terms and mechanism of the smart contract will proceed as follows:
- First, the smart contract creates a repository that allows Trang and Vy to deposit assets, information about pricing, housing, etc., into the repository, but they are not allowed to withdraw the assets and data at will.
- Then, Vy deposits the rent into the repository, and Trang deposits the address and price information of the rental property into this repository.
- Finally, the smart contract verifies that the repository contains sufficient funds and information from both parties. It will automatically execute the transfer of funds to Trang and the address information of the rental property to Vy.
- In addition, the smart contract has the ability to add conditions such as “in case the information provided by Trang is different from what the two had previously agreed upon,” Vy will be refunded by the smart contract. This will prevent cases of fraud from Trang or Vy.
Overall, a smart contract is a technology that automatically enforces the terms of an agreement, without the need for third-party verification outside of Trang and Vy. The information and terms of the smart contract between Trang and Vy will be stored on the blockchain, and everyone has the right to access and check them
Advantages and Disadvantages of Smart Contracts
Although the idea of smart contracts has been around since 1997, the widespread use of smart contracts in the crypto market is less than 10 years old. Therefore, smart contracts still have the following advantages and disadvantages:
Advantages
- Immutable data: Smart contracts cannot be altered or tampered with from the outside, ensuring that commitments between multiple parties are always upheld. However, if there is an error in the smart contract from the beginning, developers cannot fix the error but can only develop a new smart contract.
- Decentralized and self-executing: Smart contracts do not depend on third parties to validate the terms of the agreement, thus reducing network costs. In addition, smart contracts are capable of self-execution when conditions are met without the need for intervention from third parties such as lawyers, banks, etc.
Although smart contracts are mainly used in the crypto market, some companies have been researching and deploying them in real-world applications to take advantage of benefits such as cost reduction and increased work efficiency.
Disadvantages
Smart contracts still have some drawbacks that users should be aware of:
- Data immutability when errors occur: The advantage of smart contracts is also a disadvantage. Once a smart contract is deployed, it cannot be modified or tampered with. Therefore, if a smart contract has an error, developers or participants can only create a new contract. For example, in 2016, an organization called “The DAO” was attacked due to a flaw in its smart contract, resulting in a loss of millions of ETH.
At that time, The DAO’s smart contract could not be changed, so they could not modify the code in the smart contract. This ultimately led to a hard fork, creating Ethereum Classic and Ethereum.
Lack of legal protection: Smart contracts are a product that lacks clear regulations and legal frameworks. Therefore, if a smart contract has an error, users are not protected by the government. According to Certik, smart contract flaws can lead to attacks such as rug pulls, exploits, etc. These attacks caused damages of up to $3.7 billion in 2022 (according to CertiK’s report).
Applications of Smart Contracts in Crypto
Smart contracts are used in every “niche” of the crypto market, from token trading to use in financial services such as Lending/Borrowing, Staking, etc. Some notable applications of smart contracts include:
Flash Loans
Flash Loans are a form of lending that does not require collateral, but the loan period only lasts until a new block is completed (a very short period of time). Therefore, this form of lending requires users to have fast transaction speeds, and smart contracts can help users utilize Flash Loans, as they are capable of processing transactions as soon as they are triggered.
Example: Binance is selling ETH for $1,000, and OKX is selling ETH for $1,100. A developer would create a smart contract that works as follows:
- First, the developer borrows a Flash Loan of $1 million from a DeFi protocol.
- Then, they buy ETH on Binance and immediately sell it on OKX.
- After making a profit, the developer repays the $1 million loan to the protocol.
All three steps above take place within 1-2 minutes, or even seconds, and are all executed by the smart contract. There have been cases in the crypto market where users have used this method to make a profit.
Token Swaps
This is a common method of using smart contracts in the crypto market. Users provide two tokens to a liquidity pool and create a smart contract that allows others to exchange these two tokens with each other (the liquidity provider receives transaction fees). This method is used on DEXs, where people provide liquidity to pools and trade tokens.
With smart contracts in the crypto market, users can diversify their investment portfolios by exchanging tokens that are not yet listed on centralized exchanges (CEXs).
Besides the two methods above, most applications in the crypto market are designed and provided by smart contracts on the blockchain, such as Lending/Borrowing, airdrops, etc. Smart contracts allow developers to design many different use cases.
Some Businesses Applying Smart Contracts
In the crypto market, smart contracts are present everywhere and are used by dApps for various purposes (providing liquidity, lending/borrowing, etc.). Therefore, smart contracts are almost an indispensable technology in the crypto market.
With the popularity of smart contracts, businesses and governments have also begun to pay attention to this technology. Below are some businesses/governments that have been or are currently testing smart contracts in their processes:
- The Swedish Government: In 2016, the Swedish government used smart contracts for land ownership registration for its citizens.
- Ubisoft: One of the world’s leading game companies, they use smart contracts to allow players to buy, sell, and own in-game items in Ubisoft titles.
- ING Bank: One of the banks in the Netherlands that applies smart contracts for its international payment gateway service.
Read more: Applications of Blockchain Technology