The life cycle of smart contracts on the blockchain

in smartcontract •  3 years ago 

Smart contracts were first introduced on the second generation of the ethereum blockchain. These are simply programs designed to be executed when certain predefined criteria are met on the blockchain. The goal of having smart contracts is to execute them quickly, without intermediaries and with automation. Smart contracts consist of three main components: contractual arrangements between parties, management of the conditions set in the performance of contractual obligations, and execution of the contract.

Potential activities that can be run using smart contracts include payment transfers, vehicle registration, sending alerts, invoicing, etc. Once the selected transaction is completed, the blockchain data is updated. Such a framework ensures that it cannot be manipulated by third parties and can only be viewed by the parties involved in the transaction. A blockchain-based digital ledger system is essential due to the need to ensure the security and privacy of the parties to the transaction. Data for individual transactions are sequentially bundled and stored in blocks on the blockchain. Eliminating centralized oversight helps improve the security and tamper-proof nature of such transactions.

软文配图.jpg

Unlike the blockchain lifecycle, which begins with problem identification and ends with problem resolution, smart contracts on the blockchain go through different phases.

Creation phase

Contract negotiation and reaffirmation is an important part of the first phase. The parties involved must reach consensus on the terms outlined in the contract. This is very similar to the traditional contract negotiation we are used to doing in a physical way, except that it is maintained digitally. Contract participants must also have a wallet on the blockchain that is used to draft the smart contract. Once the content of the contract has been determined, it must be codified into a document. Due to the individualized nature of each smart contract, coding sometimes becomes difficult. Therefore, most blockchain developers provide ways to test the behavior of smart contracts as they are created to mimic their actual behavior.

Freezing phase

Transactions on the blockchain are verified by a set of computers on the network called nodes. These nodes are nothing more than blockchain miners who use their computing power to ensure fair governance of smart contracts. In return for their services, these miners are also paid a small fee. This framework ensures that the blockchain has only legitimate contracts and is not clogged with bogus entries. During the "freeze" phase, contracts and their participants are open to the public on a public ledger. During this period, any form of fund transfer is blocked as the nodes act as the governing body, verifying that the prerequisites for contract execution are met.

Execution Phase

The integrity of the smart contract is verified by a certified node and the contract's interference engine (or compiler) executes the code. When input is received from one party in the form of a coin (as a promise of the good to be exchanged), the jamming engine creates a transaction triggered by the satisfaction of the criteria. The new transaction data is then added to the blockchain and again verified by the management node to ensure performance according to the terms agreed in the contract. This validation process is managed by a "consensus mechanism", i.e. proof of work or proof of interest.

Contract Completion

Once the transaction data has been written to the blockchain's distributed ledger, the consensus mechanism verifies that the assets transferred by the first party have been received and unfreezes them for the recipient. This marks the completion of the smart contract, which is then closed and recorded.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!