The truth about smart contracts

geek12345 2021-05-15 01:51:17 阅读数:369

本文一共[544]字,预计阅读时长:1分钟~
truth smart contracts

It's like “ Blockchain ”,“AI” and “ cloud ” It's the same word ,“ Intelligent contract ” It's one of those phrases that gets a lot of hype . After all , There's nothing more interesting than having people believe what's going on without going through the justice system . The promises of smart contracts include :

  • Automatically , There is no need to trust and execute the contract fairly .
  • In contract building , Contract execution and cancellation of middleman in contract execution .
  • ( Hint ) Delete lawyers .

I agree with hype . After all , If we can eliminate the need to trust each other in execution , So how efficient things will be ?

in any case , What is a smart contract ? It's not the realm of Ethereum ? Isn't that the way of the future ? Why do you block progress ?

In this paper , I'm going to look at what smart contracts are and the engineering realities associated with them ( Please note that : It's not that simple and it's very hard to protect ).

What is a smart contract ?

A normal contract is an agreement between two or more parties , Connect them to something in the future .Alice Maybe to Bob Pay some money in exchange for the use of Bob The house of ( That is, rent ).Charlie May agree to fix Denise Any future damage to the car , In exchange for a monthly payment ( It's also called auto insurance ).

The difference between smart contracts is that conditions are evaluated and executed by computer code , So that it doesn't have to trust . therefore , If Alice Agreed that from now on 3 Months ( The future ) towards Bob payment 500 Dollars for delivery , So some code can determine if the condition is correct (Alice Has paid Bob? already 3 Three months ?) And implement ( Provide... From hosting ) Without giving either party the ability to exit .

The key feature of smart contract is that it has no trust in execution . in other words , You don't have to rely on a third party to enforce conditions . A smart contract should be executed in a timely and objective manner , Instead of relying on the other side to deliver what they say, it's even worse , Rely on lawyers and the legal system to correct things .

Intelligent contract

Use “ smart ” The word means that these contracts have some innate wisdom . It's not . The wisdom of a contract is that it does not require the cooperation of the other party to carry out the agreement . One “ smart ” 's contract will lock non paying renters out of their apartments , Instead of having to kick out renters who don't pay . The implementation of agreed consequences makes smart contracts powerful , Rather than the information inherent in the contract .

A really smart contract takes into account all the extenuating circumstances , Look at the spirit of the contract , Even in the darkest of times, a fair verdict has to be made . let me put it another way , A really smart contract is like a very good judgment . contrary , under these circumstances ,“ Intelligent contract ” It's not intelligent at all . It's actually rule-based , Follow the rules to T, No secondary consideration or legal “ The spirit of ”.

let me put it another way , Making the contract without trust means that we really can't have any ambiguities , This brings us to the next problem .

Smart contracts are really hard

Because of Ethereum's intensive marketing , People mistakenly believe that smart contracts exist only in Ethereum . It is not true. . Bitcoin from 2009 Since then, there has been a very wide range of smart Contract languages called Script. in fact , Smart contracts have been around for a long time 1995 Years before bitcoin . The difference between bitcoin's smart contract language and Ethereum is that Ethereum is Turing complete . in other words ,Solidity(ETH Smart contract language ) Allow more complex contracts , But it makes them harder to analyze .

Complexity has some big consequences . Although complex contracts allow for more complex situations , But complex contracts are hard to ensure . Even in a normal contract , The more complex the contract is , The harder it is to enforce the law , Because complications add more uncertainty and explanation space . Through smart contracts , Security means dealing with every possible way a contract can be executed , And make sure the contract is in line with the author's intention .

Execution in Turing complete environment is very difficult and difficult to analyze . Protecting Turing's complete smart contract is equivalent to proving that the computer program is error free . We know it's very difficult , Because almost all existing computer programs have errors .

It takes years of study and hard examinations to write a normal contract . Smart contracts need at least that level of capability , But at present, many of them are written by novices who don't understand their security needs . This can be seen clearly from various contracts that have been proved to be defective .

The way bitcoin solves this problem is without Turing integrity . This makes contracts easier to analyze , Because the possible states of a program are easier to enumerate and check .

Ethereum's solution is to place the burden on the smart contract Writers . Contract writers need to make sure that the contract is in line with their intentions .

Smart contracts are not real contracts ( At least in the ETH On )

Although it sounds good in theory to leave the responsibility of the warranty contract to the author , But in practice , This has had some serious centralization consequences .

Ethereum launched “ Code is the law ” Ideas . in other words , Ethereum's contract is the ultimate authority , No one can veto the contract . The idea is to show smart contract developers that they are independent . If you screw up your smart contract , So in a sense , You deserve it . When DAO Event time , That's the end of it .

DAO representative “ Decentralized autonomous organizations ”, And set up a fund in Ethereum , As a way to show what a platform can do . Users can deposit money in DAO, And according to DAO Return on your investment . The decision itself will be crowdsourced and decentralized . When ETH The transaction price is 20 Around us dollar ,DAO stay ETH raised 1.5 Billion dollars . It all sounds good in theory , But there's a problem . The code is not well protected , Leading someone to find a way to consume DAO The money .

A lot of people say that this person put the money DAO As “ hackers ”. In a sense ,“ hackers ” Found a way to get money out of the contract in a way that the creator didn't want , This is the truth . But in a broad sense , This is not a hacker at all , It's just that some people take advantage of the quirks in smart contracts . It's not much different from creative CPAs finding tax loopholes to save customers' money .

What happened next was , Ethereum decided that the code was no longer legal and restored entry DAO All the money for . let me put it another way , Contract writers and investors have done some stupid things , The Ethereum developers decided to save them out .

The consequences of this incident are well documented . Ethereum classics are born , Retain the DAO, And kept “ Code is the law ” Principles . Besides , Developers began to avoid using Ethereum's Turing-completeness attribute , Because it turns out to be hard to guarantee .ERC20 and ERC721 Standard is the most commonly used smart contract template in Ethereum , It is important to point out that both types of contracts can be written without any Turing integrity .

Smart contracts are digital only

Even without Turing integrity , Smart contracts sound good, too . After all , Who likes to have to go to court to get what reasonably belongs to them ? Is it easier to use smart contracts than ordinary contracts ?

for example , Will smart contracts not benefit real estate ?Alice It can be proved that she owns the house .Bob You can remit money for a house and exchange it for a house . No ownership , No trust , The machine executes quickly , There's no need for a judge , Bureaucratic or property insurance issues . That sounds cool , Am I right? ?

Here are two questions . First , Centralized execution of smart contracts is not real trust . You still need to trust the central party to execute . No trust is the key feature , So centralized execution doesn't really make sense . To make smart contracts truly trustless , You need a platform that's actually centralized .

This leads us to a second problem . In a decentralized environment , Only when there is a clear link between the digital version and the physical version , Smart contracts work . in other words , Whenever the digital version of a house changes ownership , The physical version also has to change ownership . The digital world needs “ understand ” The physical world . This is known as “Oracle problem ”.

When Alice Transfer the house to Bob when , The smart contract needs to know that she actually transferred the house to Bob. There are several ways to do this , But they all have the same basic problems . There has to be some trust in certain third parties to verify events in the physical world .

for example , The house can be represented as an irreplaceable mark on Ethereum .Alice You can transfer the house to Bob To get a certain amount of ETH. This is the problem .Bob You need to believe that Token It actually represents the house . There must be some Oracle Make sure that the house Token Transferring to him actually means that the house is his legal house .

Besides , Even if the administration says Token It's actually housing , If Token Stolen , What will happen ? Does the house belong to the thief now ? If Token What to do with losing ? Is the house no longer for sale ? Can house tokens be reissued ? If so , By whom ?

There is a difficult problem in linking digital assets with physical assets , Whether it's fruit , Car or house , At least in the context of decentralization . Physical assets are regulated by your jurisdiction , This means that in addition to the smart contracts you create , They trust something in a sense . This means that possession in a smart contract does not necessarily mean having and suffering from the same trust problems as a normal contract in the real world . Smart contracts that trust third parties eliminate the killer feature of no trust .

Even e-books , The same is true of digital assets like health records or movies . These digital assets are “ right ” Ultimately, it's up to other authorities ,Oracle Need to be trusted .

From this point of view , An oracle is a stupid judge . You actually get more than just machine execution and simplified execution , It's the complexity of having to code all possible outcomes using subjectivity and human judgment of risk . let me put it another way , By making the contract “ Become smart ”, You have to trust someone while you're writing , It makes writing more complicated .

No, Oracle The only thing that works is the digital hosting tool . essentially , Both sides of the deal don't just need to be digital , You also need to carry tools . in other words ,Token The ownership of can't have a dependency outside the smart contract platform . Only if the smart contract has a digital ticket holder tool , Smart contract is really no trust .

Conclusion

I hope smart contracts are more useful than they are . Unfortunately , We humans think that most of the content of the contract brings a lot of assumptions and established case law , It doesn't need to be clear .

Besides , It turns out that using Turing integrity is a simple way to screw up and cause all kinds of unexpected behavior . We should mark the smart contract platform as Turing vulnerable , Not Turing .DAO The event also proves the validity of the contract “ The spirit of ” It's implicit trust , And it's more helpful than we realize .

Smart contracts are simply too easy to screw up , It's too hard to protect , Too hard to achieve no trust , And there are too many external dependencies that can be used for most things . In fact, the only real place for smart contracts to increase trust is digital bearer tools on decentralized platforms such as bitcoin .

======================================================================

If you want to learn blockchain and Blockchain Technologies Build a career , So please see some Ethereum we share 、 The currency 、EOS、Fabric And other interactive online programming practical courses related to blockchain :

  • java Ethereum development tutorial , Mainly aimed at java and android Programmers develop blockchain Ethereum web3j Detailed explanation .
  • python The etheric fang , Mainly aimed at python Used by the Engineer web3.py Detailed explanation of blockchain Ethereum development .
  • php The etheric fang , It mainly introduces the use of php Conduct smart contract development interaction , Create an account 、 transaction 、 Transfer accounts 、 Token development, filters and transactions .
  • Introduction to Ethereum , It mainly introduces smart contract and dapp application development , Suitable for entry .
  • Advanced course of Ethereum development , It mainly introduces the use of node.js、mongodb、 Blockchain 、ipfs Realize decentralization of e-commerce DApp actual combat , Suitable for advanced .
  • ERC721 Ethereum proves the actual battle , The course is a digital art creation and sharing DApp The actual development of the main line , In depth to explain the concept of Ethereum heterogeneity pass 、 Standards and development programs . It contains ERC-721 Autonomous implementation of standards , Explain OpenZeppelin Second development of contract code base , The actual project adopts Truffle,IPFS, It has realized the general stock exchange and decentralized general stock exchange .
  • C# The etheric fang , It mainly explains how to use C# Based on Development .Net The Ethereum application of , Including account management 、 Status and transactions 、 Smart contract development and interaction 、 Filters and trading etc .
  • java Bitcoin development tutorial , This course is for beginners , It covers the core concepts of bitcoin , For example, blockchain storage 、 Decentralized consensus mechanism 、 Keys and scripts 、 Trade with UTXO etc. , At the same time, it also explains in detail how to Java Bitcoin support function is integrated in the code , For example, create an address 、 Manage your wallet 、 Construct naked transactions, etc , yes Java A rare bitcoin development learning course for Engineers .
  • php Bitcoin development tutorial , This course is for beginners , It covers the core concepts of bitcoin , For example, blockchain storage 、 Decentralized consensus mechanism 、 Keys and scripts 、 Trade with UTXO etc. , At the same time, it also explains in detail how to Php Bitcoin support function is integrated in the code , For example, create an address 、 Manage your wallet 、 Construct naked transactions, etc , yes Php A rare bitcoin development learning course for Engineers .
  • c# Bitcoin development tutorial , This course is for beginners , It covers the core concepts of bitcoin , For example, blockchain storage 、 Decentralized consensus mechanism 、 Keys and scripts 、 Trade with UTXO etc. , At the same time, it also explains in detail how to C# Bitcoin support function is integrated in the code , For example, create an address 、 Manage your wallet 、 Construct naked transactions, etc , yes C# A rare bitcoin development learning course for Engineers .
  • EOS Introductory tutorial , This course helps you get a quick introduction to EOS Development of decentralized application of blockchain , Content covered EOS Tool chain 、 Accounts and wallets 、 Issue tokens 、 Smart contract development and deployment 、 Use code to interact with smart contracts and other core knowledge points , At last, we use all the knowledge points to complete a note DApp Development of .
  • Play in depth EOS Wallet development , This course uses mobile phones EOS The whole development process of wallet is the main line , Learn more EOS Blockchain application development , The course covers accounts 、 Computing resources 、 Intelligent contract 、 Actions and transactions, etc EOS The core concept of blockchain , It also explains how to use eosjs and eosjs-ecc Development package access EOS Blockchain , And how to React Integration of front-end applications EOS Blockchain support . The content of the course is simple , It's very suitable for front-end engineers to study deeply EOS Blockchain application development .
  • Hyperledger Fabric Blockchain development details , This course is for beginners , The content includes Hyperledger Fabric The identity certificate and MSP service 、 Authority strategy 、 Channel configuration and startup 、 Chain code communication interface and other core concepts , Also contains Fabric Network design 、nodejs Chain code and operation practice of application development , yes Nodejs Engineers learn Fabric The best choice for blockchain development .
  • Hyperledger Fabric java Blockchain development details , The course is for beginners , The content includes Hyperledger Fabric The identity certificate and MSP service 、 Authority strategy 、 Channel configuration and startup 、 Chain code communication interface and other core concepts , Also contains Fabric Network design 、java Chain code and operation practice of application development , yes java Engineers learn Fabric The best choice for blockchain development .
  • tendermint Blockchain development details , This course is suitable for the students who want to use tendermint Engineers who develop blockchain , The course includes tendermint The core concepts in the application development model , for example ABCI Interface 、 Ms merkel tree 、 Multi version state library, etc , It also includes rich practical codes such as token issuance , yes go The best choice for language engineers to get started with blockchain development .

Original translation of Huizhi , Reprint please indicate the source . Here is The truth about smart contracts

版权声明:本文为[geek12345]所创,转载请带上原文链接,感谢。 https://netfreeman.com/2021/05/20210515012020253r.html