In the 1990s, Nick Szabo first proposed the concept of smart contracts. At that time, he defined smart contracts as tools that standardize and ensure the security of computer networks by combining protocols and user interfaces.
Szabo discussed the potential use of smart contracts in various areas related to contractual agreements, such as credit systems, payment processes and content rights management.
In the field of cryptocurrency, smart contracts can be defined as applications or programs running in the blockchain. Typically, they function as a digital protocol enforced by specific rules. These rules are predefined by computer code and are replicated and executed by all network nodes.
Blockchain smart contracts support the creation of trustless protocols. This means that parties to a contract make a commitment via the blockchain without knowing or trusting each other. The parties determined that if the conditions were not met, the contract would not be executed. Additionally, using smart contracts eliminates the need for intermediaries, significantly reducing operating costs.
While smart contracts have been supported by the Bitcoin protocol for many years, they became popularized through the hands of Ethereum creator and co-founder Vitalik Buterin. It’s worth noting that each blockchain implements smart contracts differently.
This article will focus on smart contracts running in the Ethereum Virtual Machine (EVM), which is an important part of the Ethereum blockchain.
Simply put, a smart contract is a deterministic program that performs specific tasks when certain conditions are met. Therefore, smart contract systems usually follow the conditional statement of "if... then...". Although the concept of "smart contract" is well known, it is neither a legal contract nor smart. They are just a piece of code running in a blockchain distributed system.
In the Ethereum network, smart contracts are responsible for executing and managing blockchain operations when users (addresses) interact with each other. Addresses outside of smart contracts are called "external accounts (EOA)". Therefore, smart contracts are controlled by computer code, while external accounts (EOA) are controlled by users.
Ethereum smart contract basically consists of contract code and two public keys. The first public key is provided by the contract creator, and the other public key is the contract itself and is used as a unique digital identifier for each smart contract.
All smart contract deployment occurs through blockchain transactions and is only activated when an external account (EOA) or other smart contract is called. However, smart contracts are generally triggered by an external account (EOA), that is, the user for the first time.
Ethereum smart contracts have the following common features:
Distributed. Smart contracts are replicated and distributed across all nodes in the Ethereum network. This is very different from other centralized server-based solutions.
Certainty. Smart contracts only perform pre-designed actions when requirements are met. And, no matter who does it, the results remain consistent.
Autonomy. Compared with "self-executing" programs, smart contracts will automatically complete various tasks. In most cases, untriggered smart contracts remain in a "sleep" state and do not perform any operations.
Immutability. Smart contracts cannot be changed after they are deployed. Smart contracts can be "deleted" only after specific functions are implemented. So, we might as well say that smart contracts provide tamper-proof code.
Customization. Before deployment, smart contracts are coded in a variety of ways. Therefore, it can be used to create a wide variety of decentralized applications (DApps). This goes hand in hand with the fact that Ethereum is a Turing-complete blockchain.
Detrust. Two or more parties can interact through smart contracts without needing to know or trust each other. Additionally, blockchain technology will ensure data accuracy.
Transparency. The basis of smart contracts is a public blockchain, so the source code is not only immutable, but also open and transparent to everyone.
Once deployed, Ethereum smart contracts cannot add new functions. However, as long as the contract creator reserves the "SELFDESTRUCT" function in the code, the function can then "delete" the smart contract and replace it with a new contract. If this function is not reserved in the code, the smart contract cannot be deleted.
It is worth noting that through so-called upgradable smart contracts, developers can operate more flexibly on the immutability of the contract. There are many ways to create upgradable smart contracts, each with varying levels of complexity.
As a simple example, assume that a smart contract is divided into multiple smaller contracts. Some parts are designed to be immutable, while other parts enable "delete" functions. That is, parts of the code (smart contracts) can be deleted and replaced, while other functionality remains unchanged.
As programmable code, smart contracts are highly customizable and can be designed in many ways. Provide a wide range of services and solutions.
As decentralized and self-executing programs, smart contracts can increase transparency and reduce operating costs. Depending on the implementation, smart contracts can also improve implementation efficiency and reduce cumbersome costs.
Smart contracts are particularly useful when it comes to fund transfers or transactions between two or more parties.
In other words, smart contracts can be tailored for a rich set of use cases, including the creation of tokenized assets, voting systems, cryptocurrency wallets, decentralized exchanges, gaming and mobile App. Smart contracts can also be deployed with other blockchain solutions covering areas such as healthcare, charity, supply chain, governance and decentralized finance (DeFi).
Tokens issued on the Ethereum blockchain follow ERC-20 standard. This standard specifies the core functionality of all Ethereum tokens. Therefore, these digital assets are often called "ERC-20 tokens" and account for a large proportion of existing cryptocurrencies.
Many blockchain companies and startups have deployed smart contracts to autonomously issue digital tokens on the Ethereum network. After a token is issued, most companies distribute their ERC-20 tokens through an initial coin offering (ICO). In most cases, the use of smart contracts can effectively realize fund transactions and token distribution in a trustless manner.
Smart contracts consist of human-written computer code. The code will have defects and loopholes, which will bring many risks. Ideally, smart contracts should be written and deployed by experienced programmers, especially when sensitive information and large amounts of money are involved.
In addition, some people believe that centralized systems can provide most solutions and functions of smart contracts. The main difference is that smart contracts run in a distributed P2P network rather than a centralized server. Moreover, smart contracts are based on blockchain systems and therefore often cannot be tampered with or difficult to change.
The immutability of smart contracts has obvious advantages, but in some cases it is counterproductive. For example, the decentralized autonomous organization "The DAO" was hacked in 2016, and millions of Ethereum coins (ETH) disappeared. The reason was that the smart contract code had flaws.
Because smart contracts are immutable, developers cannot fix the code. This eventually led to a hard fork, from which the second Ethereum chain was born. Simply put, a chain (which is currently part of the Ethereum blockchain) is "restored" to the way it was before the hack, returning funds to their original owners. The other chain (now called "Ethereum Classic") decided not to intervene in the hack, insisting that events occurring in the blockchain should never be tampered with.
It should be noted that this problem is not caused by the Ethereum blockchain, but caused by the incorrect execution of the smart contract.
Another limitation of smart contracts is related to their unclear legal effects. Smart contracts are in a gray area in most countries and do not yet apply to current legal frameworks.
For example, many contracts require that both parties to the transaction must pass appropriate real-name authentication and be over 18 years old. However, the anonymity of blockchain technology and the lack of intermediaries will conflict with contract requirements. A solution to this problem may appear in the future. However, smart contracts run in a borderless distributed network, making legal enforcement very difficult.
Some blockchain enthusiasts regard smart contracts as being about to replace Autonomous solutions exist for most business and bureaucratic systems. While the idea may come to fruition, there's still a long way to go before it becomes the norm.
Smart contracts are indeed an interesting technology. However, characteristics such as distribution, determinism, transparency and immutability sometimes reduce the attractiveness of smart contracts.
The essential disadvantage of smart contracts is that they cannot solve many practical problems well. In fact, some organizations are currently using traditional server solutions as a stopgap solution.
Centralized servers are easier and less expensive to maintain than smart contracts, and often have major advantages in speed and cross-network communication (interoperability) .
There is no doubt that smart contracts have had a profound impact on the cryptocurrency field The impact has indeed brought significant changes to the blockchain field. End users do not necessarily interact directly with smart contracts. But in the near future, smart contracts will be used more widely, covering various fields such as financial services and supply chain management.
Smart contracts and blockchain have together disrupted almost all areas of today’s society. But only time will tell whether these breakthrough technologies can break through the obstacles and eventually achieve mass adoption.