Home  >  Article  >  The key in Defi, what are smart contracts?

The key in Defi, what are smart contracts?

DDD
DDDforward
2024-03-06 14:30:39468browse

People often ask, what is a smart contract? Then you must first understand what a "contract" is.

Contracts (cooperation agreements) in daily life are also "contracts" signed between partners. Nowadays, our lives are almost inseparable from contracts. Generally speaking, work is a labor contract signed with the company. To buy a house, you sign a house purchase contract with a real estate company, and to buy insurance, you sign an insurance contract with an insurance company; to put it more broadly, online shopping, ordering takeout, and taking a taxi all involve signing corresponding contracts with relevant service providing companies. It can be said that contracts are used wherever there are people.

Even when we make a bet with someone, it is also a contract, but if one party denies it, it will become difficult to fulfill the contract. If there is a contract with rules determined in advance, once the relevant clauses are triggered, the contract will be automatically executed without human intervention or worry about repudiation. Is there such a contract? Really, this is a smart contract.

01
What is a smart contract

The key in Defi, what are smart contracts?

##Smart Contract is a concept proposed by cryptologist Nick Szabo in the 1990s. Due to the lack of a trusted execution environment at that time, smart contracts were not applied and developed until Ethereum The emergence of Fang has allowed smart contracts to be "resurrected".
So what exactly is a smart contract? Simply put, a smart contract is a contract that uses computer language instead of 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, ATM cash 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: The key in Defi, what are smart contracts?
1 , Contract contents are open and transparent


Smart contracts are deployed on the blockchain, and their contract contents are naturally open and transparent.
2. The content of the contract cannot be tampered

Similarly, because it is deployed on the blockchain, the content of the smart contract cannot be modified.
3. Permanent operation

Smart contracts running on the blockchain are also jointly maintained by the network nodes on the blockchain. As long as the blockchain is there, the smart contract can Run forever. There is a sense of brotherhood that "the chain is as long as the contract is there". Smart contracts supported by the three major characteristics of blockchain have the following main advantages compared with traditional contracts:

1. De-trust.

Since smart contracts are based on the blockchain, the contract content is open, transparent and cannot be tampered with. Code is law. Based on trust in the code, traders can trade safely and safely in a distrustful environment.

2. Economical and efficient

Compared with traditional contracts, disputes often arise due to differences in understanding of contract terms; smart contracts are very good through computing language Disagreement is avoided, almost no disputes are caused, and the cost of reaching consensus is very low. In smart contracts, the arbitration results come out and take effect immediately. Therefore, compared with traditional contracts, smart contracts have the advantages of economy and efficiency.

3. No need for third-party arbitration

Suppose Xiong Da and Xiong Er bet on whether it will rain tomorrow. The one who loses needs to give the other party 100 yuan. If the loser denies it, the winner will not get the reward. For this reason, it is inefficient and time-consuming to find a third-party arbitration institution. But if the bet is written on the smart contract, when the bet is reached, each of them will put 100 yuan into the smart contract address. The smart contract will automatically execute based on the final result, and the winning party will take away all the rewards. It can be seen that smart contracts do not require third-party arbitration.

03
Are smart contracts really smart?

The above are all the advantages of smart contracts. Are smart contracts really smart and without shortcomings? In fact, this is not the case. Smart contracts also have their shortcomings.

As mentioned above, the non-tamperable nature of smart contracts makes it easy to establish trust. But there is also a bad side. If there are loopholes in the smart contract, hackers can exploit the loopholes in the smart contract to make profits for themselves.

To give a simple example, a vending machine originally sold a drink for 5 yuan, but due to negligence, it was written as 50 cents. After the administrator finds out, he can correct it immediately. But if this vending machine calls a smart contract on the blockchain, then this error cannot be modified until the drinks inside are sold out.

On the other hand, The smart contract itself cannot obtain (perceive) external information. It requires external information to adjudicate the contract, and relevant information needs to be written into it before it can make a 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. It needs to provide information to it through other information sources, such as the Central Meteorological Observatory data. After receiving this information, the smart contract The contract can make the decision.

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

04
Summary

To sum up, regarding smart contracts, we know:

A smart contract is a contract that uses computer language instead of legal language to record terms and is automatically executed by a program. Deployed on the block, it also has the characteristics of blockchain data being open, transparent, non-tamperable, and running permanently.

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 have a very low level of smartness.

The article mentioned that the execution of smart contracts does not require the judgment of a third-party agency. It also mentioned that when the execution conditions involve external information, the smart contract cannot sense and needs to enter relevant information into the smart contract. , can the smart contract be triggered to execute the ruling. Do you think these two statements are contradictory? Welcome to share your views in the message area.

The above is the detailed content of The key in Defi, what are smart contracts?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:zhihu.com. If there is any infringement, please contact admin@php.cn delete