Home Техника Договорен слой

Договорен слой



Introduction

Thefeaturesofeachblockoftheblockchainareprogrammableandembeddable.Thecontractlayerincludesscripts,algorithms,andsmartcontracts,whichcanbesimplyunderstoodasacopyAcustomelectroniccontractiscalledasmartcontractbecauseitcanautomaticallytriggerexecutionwhentheconstraintconditionsaremet,withoutmanualintervention,andcanalsobeautomaticallyterminatedwhentheconditionsarenotmet.Theoretically,itcantriggerexecutionasagreedinadvance.Allterms.Thisisalsooneofthecoretechnologiesthatblockchaincanliberatethecreditsystem.Thepreviousblockchaindidnothavethislayer.Therefore,theoriginalblockchaincanonlybeusedfortransactions,andcannotbeusedinotherfieldsorforotherlogicalprocessing.However,theemergenceofthecontractlayerhasmadeitarealitytouseblockchaininotherfields,suchasforIOT.ThispartofEthereumincludestwoparts:EVM(EthereumVirtualMachine)andsmartcontract.

Договорен слой

Bitcoinscript

Bitcoinusesasimple,stack-based,left-to-rightscriptinglanguage,andascriptisessentiallyattachedtoBitcointransactionsAlistofasetofinstructions.Bitcointransactionsrelyontwotypesofscriptstobeverified,namely,lockingscriptsandunlockingscripts.DifferentcombinationsofthetwocanderiveanunlimitednumberofcontrolconditionsinBitcointransactions.Amongthem,thelockedscriptisan"obstacle"attachedtothetransactionoutputvalue,whichstipulatestheconditionsforspendingtheoutputofthistransactioninthefuture;theunlockingscriptisascriptthatmeetsthespendingconditionssetbythelockedscriptonanoutput,anditwillallowTheoutputisconsumed.Forexample,mostBitcointransactionsusetherecipient’spublickeyencryptionandprivatekeydecryption.Therefore,thelockscriptinthecorrespondingP2PKH(Paytopublickeyhash)standardtransactionscriptusestherecipient’spublickey.Realizethefunctionofpreventingoutput,andusethedigitalsignaturecorrespondingtotheprivatekeytounlockit.TheBitcoinscriptsystemcanrealizeflexibletransactioncontrol.Forexample,bystipulatingacertainperiodoftime(suchasaweek)astheunlockingcondition,delayedpaymentcanberealized;bystipulatingthattherecipientandtheguarantormustsignacommonprivatekeytocontrolabitcoin,asecuredtransactioncanberealized;bydesigningaTherulesforcheckingwhetheracertainprobabilityeventoccursaccordingtoexternalinformationsourcesandattachingittoacertainnumberofBitcointransactionsasanunlockingscriptcanrealizeapplicationssuchasgamblingandpredictionmarkets;bysettingatleastNprivatekeysetstoprovideOnlyMprivatekeyscanbeunlocked,andM−Nmulti-signaturecanberealized,thatis,paymentcanberealizedonlywhenatleastMagreedsignaturesamongNpotentialrecipients.Multi-signaturecanbewidelyusedinscenariossuchascompanydecision-making,financialsupervision,intermediaryguaranteesandeveninheritancedistribution.Bitcoinscriptistheembryonicformofsmartcontracts,givingbirthtothefirstprogrammableglobalcurrencyinhumanhistory.However,theBitcoinscriptsystemisnotTuringcomplete.Therearenocomplexloopsandflowcontrol.Thiscangreatlyreducecomplexityanduncertaintywhilelosingacertaindegreeofflexibility,andcanavoidlogicbombssuchasinfiniteloops.Causessecurityattackssuchasdenialofservice.Inordertoimprovetheflexibilityandscalabilityofthescriptingsystem,researchershavetriedtosuperimposeanewprotocolontopoftheBitcoinprotocoltomeettheneedsofbuildingmorecomplexsmartcontractsontheblockchain.EthereumhasdevelopedaTuringcompletescriptinglanguage,userscanbuildarbitrarilycomplexandpreciselydefinedsmartcontractsanddecentralizedapplicationsbasedonEthereum,thuslayingthefoundationforbuildingprogrammablefinancialandsocialsystemsbasedonblockchain.

Smartcontract

TheconceptofsmartcontractwasfirstproposedbyscholarNickSzaboin1994.Itwasoriginallydefinedasasetofcommitmentsdefinedindigitalform,includingcontractparticipantscanexecuteonitThesepromisedagreementsareoriginallydesignedtocreatevariousflexibleandcontrollablesmartassetsbyembeddingsmartcontractsintophysicalentities.Duetobackwardcalculationmethodsandlackofapplicationscenarios,smartcontractshavenotreceivedextensiveattentionfromresearchers.Theemergenceofblockchaintechnologyredefinessmartcontracts.Smartcontractisthecorecomponentoftheblockchain(contractlayer).Itisanevent-driven,statefulcomputerprogramrunningonareproduciblesharedblockchaindataledger,whichcanrealizeactiveorpassiveprocessingofdata.Functionssuchasreceiving,storingandsendingvalue,aswellascontrollingandmanagingvarioustypesofsmartassetsonthechain.Asanembeddedprogrammedcontract,smartcontractscanbebuiltintoanyblockchaindata,transactions,tangibleorintangibleassetstoformprogrammablecontrolsoftware-definedsystems,markets,andassets.Smartcontractsnotonlyprovideinnovativesolutionsfortheissuance,transaction,creation,andmanagementoftraditionalfinancialassets,butalsocanplayanimportantroleinassetmanagement,contractmanagement,andregulatoryenforcementinthesocialsystem.Specifically,asmartcontractisasetofscenarios—responsibleproceduralrulesandlogic.Itisadecentralized,trustedandsharedprogramcodedeployedontheblockchain.Smartcontractsalsohavethegeneralcharacteristicsofblockchaindata,suchasdistributedrecording,storage,andverification,andcannotbetamperedwithorforged.Thepartieswhosignedthecontractreachedanagreementonthecontentofthecontract,theconditionsforbreachofcontract,theliabilityforbreachofcontract,andtheexternalverificationdatasource.Whennecessary,thecontractcodewascheckedandtestedtoensurethatitwascorrect,andthendeployedontheblockchainintheformofasmartcontract,sothatitdoesnotdependonit.Theautomationofanycentralorganizationexecutesthecontractonbehalfofthesignatories.Theprogrammablenatureofthesmartcontractallowsthesignatorytoaddarbitrarilycomplexterms.TheoperatingmechanismofthesmartcontractisshowninFigure1:Normally,afterthesmartcontractissignedbytheparties,itisattachedtotheblockchaindata(suchasabitcointransaction)intheformofprogramcode,anditisspreadthroughtheP2PnetworkandthenodeAfterverification,itisrecordedinaspecificblockoftheblockchain.Smartcontractsencapsulateseveralpredefinedstatesandtransitionrules,scenariosthattriggercontractexecution(suchasarrivalataspecifictimeoroccurrenceofspecificevents,etc.),andresponseactionsinspecificscenarios.Theblockchaincanmonitorthestatusofsmartcontractsinrealtime,andactivateandexecutethecontractafterverifyingexternaldatasourcesandconfirmingthatcertaintriggerconditionsaremet.

Smartcontractshavethecharacteristicsofautonomy,self-sufficiencyanddecentralization.Autonomymeansthatthecontractwillrunautomaticallyonceitisstarted,withoutanyinterventionbyothersignatories;self-sufficiencymeansthatthecontractcanobtainfundsbyprovidingservicesorissuingassets,andusethesefundswhenneeded;decentralizationmeansSmartcontractsarecontractsthatareguaranteedtobeexecutedbydecentralizedstorageandverificationprogramcodesratherthancentralizedentities,whichcanensurethefairnessandimpartialityofthecontracttoalargeextent.Smartcontractsareofgreatsignificancetoblockchaintechnology.Ontheonehand,thesmartcontractistheactivatoroftheblockchain,whichgivesflexibleandprogrammablemechanismsandalgorithmstothestaticunderlyingblockchaindata.TheautomationandprogrammablefeaturesofthesmartcontractmakeitpossibletoencapsulatethedistributedblockchainsystemThecomplexbehaviorofeachnodebecomesasoftwareagentrobotinthevirtualworldcomposedofblockchain,whichhelpstopromotetheapplicationofblockchaintechnologyinvariousdistributedartificialintelligencesystems,makingitpossibletobuildvarioustypesofrobotsbasedonblockchaintechnology.Decentralizedapplication(Dapp),decentralizedautonomousorganization(DAO),decentralizedautonomouscorporation(DAC)andevendecentralizedautonomoussociety(DAS))becomepossible.Asfarasthestatusquoisconcerned,themaindevelopmenttrendofblockchainandsmartcontracttechnologyistheevolutionfromautomationtointelligence.Theessentiallogicoftheexistingvarioustypesofsmartcontractsandtheirapplicationsismostlystillbasedonthe"IF-THEN"typeconditionalresponserulesofthepredefinedscenarios,whichcanmeettheneedsofautomatedtransactionsanddataprocessing.Thefuturesmartcontractsshouldhavethefunctionsof"WHAT-IF"deductionbasedonunknownscenarios,calculationexperiments,andacertaindegreeofautonomousdecision-making,soastorealizetheleapfrom"automated"contractstotrue"smart"contracts.

This article is from the network, does not represent the position of this station. Please indicate the origin of reprint
TOP