The key in DeFi, what are smart contracts?

digiXnode
5 min readJan 31, 2022

--

This is the original 1532nd issue of the vernacular blockchain
Author | Yan Wenchun
Produced | Vernacular Blockchain (ID: helloBTC)

​​Nowadays our lives are almost inseparable from contracts. Generally speaking, work is a labor contract signed with a company, buying a house is signing a house purchase contract with a real estate company, and buying insurance is signing an insurance contract with an insurance company. , ordering takeaways, taking taxis, and buying lottery tickets all have signed corresponding contracts with relevant service providers. It can be said that contracts are used wherever there are people.

Even a bet with someone is a contract, but once one party denies it, it becomes difficult to fulfill the contract. If there is a contract, the rules are determined in advance, and once the relevant terms are triggered, the contract will be executed automatically, without human intervention, and there is no need to worry about being denied. Does such a contract exist? Yes, it’s a smart contract.

01 What is a smart contract

Smart Contract is a concept proposed by cryptographer Nick Szabo in the 1990s. Due to the lack of a credible execution environment at that time, smart contracts were not applied and developed until the emergence of Ethereum. “resurrection”.

So what exactly is a smart contract? Simply put, a smart contract is a contract that uses computer language to replace legal language to record terms and is automatically executed by a program. In other words, smart contracts are digital versions of traditional contracts that run on the blockchain network and are automatically executed by programs.

Vending machines and ATM teller machines can all be understood as machines that execute smart contracts to some extent, but these are not smart contracts in the true sense.

02 What are the characteristics of smart contracts?

Compared with traditional contracts, smart contracts have three major characteristics:

1a. The contract content is open and transparent
Smart contracts are deployed on the blockchain, and their contract content is naturally open and transparent.

2b. The content of the contract cannot be tampered with
Also, because of deployment on the blockchain, the content of smart contracts cannot be modified.

3c. Permanent operation
The smart contracts running on the blockchain are also jointly maintained by the network nodes on the blockchain. As long as the blockchain exists, smart contracts can run forever. There is a sense of brotherhood that “the chain is in the contract”.

Compared with traditional contracts, smart contracts supported by the three major characteristics of blockchain have the following advantages:

1a. To trust.

Since the smart contract is based on the blockchain, the content of the contract is open and transparent and cannot be tampered with. Code is the law. Based on the trust in the code, traders can conduct transactions safely and securely in an untrusted environment.

1b. Economical and efficient

Compared with traditional contracts, disputes are often caused due to differences in understanding of the contract terms; smart contracts can avoid disputes through calculation language, almost no disputes, and the cost of reaching a consensus is very low. On the smart contract, the arbitration result comes out, and the execution takes effect immediately. Therefore, compared with traditional contracts, smart contracts have economical and efficient advantages.

1c. No need for third-party arbitration

Suppose Xiong Da and Xiong Er make a bet on whether it will rain tomorrow, and whoever loses needs to give the other 100 yuan. If the loser denies it, the winner won’t get the reward. For this reason, it is inefficient and time-consuming to go to a third-party arbitration institution. But if the bet is written on the smart contract when the bet is reached, each puts 100 yuan into the smart contract address, and the smart contract is automatically executed according to the final result, and the winning party takes all the rewards. It can be seen that smart contracts do not need third-party arbitration.

03 Are smart contracts smart?

The above are the advantages of smart contracts. Are smart contracts really smart and without disadvantages? Smart contracts also have their shortcomings.

As mentioned above, the immutable properties of smart contracts make it easy to establish trust. But at the same time, there is also a bad side. If there are loopholes in the smart contract, hackers can exploit the loopholes in the smart contract for their profit.

To give a simple example, a vending machine originally sold for 5 yuan for a drink, but due to negligence, it was written as 5 cents. After the administrator found it, he could immediately correct it. But if the vending machine is calling a smart contract on the blockchain, the error cannot be corrected until the drinks inside are sold out.

On the other hand, the smart contract itself cannot obtain (perceive) external information, and it requires external information to adjudicate the contract, and it needs to write relevant information to it before it can make an adjudication. For example, in the example of Xiong Da and Xiong Er betting on whether it will rain tomorrow, the smart contract itself does not know whether it will rain the next day and needs to provide it with information through other information sources, such as data from the Central Meteorological Observatory. contract to make a ruling.

From the above two points, smart contracts are neither perfect nor intelligent.

04 summary

To sum up, about smart contracts, we know that smart contracts are contracts that use computer language to replace legal language to record terms and are automatically executed by programs. Deployed on the block, it also has the characteristics of open, transparent, non-tamperable, and permanent operation of the blockchain data.

Compared with traditional contracts, smart contracts have the advantages of trustlessness, security, efficiency, and no need for third-party arbitration. But smart contracts are not perfect, and they are not smart or very low.

The article mentions that the execution of smart contracts does not require a third-party ruling. At the same time, it is mentioned that when the execution conditions involve external information, the smart contract cannot perceive it. It is necessary to input relevant information into the smart contract to trigger the smart contract to execute the ruling. Do you think these two statements are contradictory? Welcome to comment to share your views.

--

--

No responses yet