×
☰ Menu

Working of Smart Contracts

Smart contracts work by following simple

"if/when

.

.

then..."

statements that are written into code on a blockchain. The actions are carried out by a network of computers when predetermined conditions are met and verified. Upon completion of the transaction, the blockchain is updated.

Let's see how this plays out in a supply chain example. Buyer B wishes to purchase something from Seller A, so she deposits funds in an escrow account. Shipper C will deliver the product to Buyer B on behalf of Seller A. The money in escrow will be released to Seller A and Shipper C once Buyer B receives the item. If Buyer B does not receive the shipment by Date Z, the escrow funds will be returned to him. When this transaction is completed, Manufacturer G is notified to produce another of the sold items in order to increase supply. This is all done automatically.

A smart contract is a type of computer program that encodes business logic and runs on a dedicated virtual machine embedded in a blockchain or other distributed ledger.

Detailed stepwise working of a smart contract is explained below:

Step 1: Business teams work with developers to define their criteria for the desired behavior of the smart contract in response to specific events or circumstances.

Step 2: Simple events include things like payment authorization, shipment receipt, and a utility meter reading threshold.

Step 3: More sophisticated logic may be used to encode more complex operations, such as determining the value of a derivative financial instrument or automatically releasing an insurance payment.

Step 4: The developers then use a smart contract writing platform to create and test the logic. After the application is written, it is sent to a separate team for security testing.

Step 5: An internal expert or a company that specializes in vetting smart contract security could be used.

Step 6: The contract is then deployed on an existing blockchain or other distributed ledger infrastructure once it has been authorized.

Step 7: The smart contract is configured to listen for event updates from an "oracle," which is effectively a cryptographically secure streaming data source, once it has been deployed.

Step 8: Once it obtains the necessary combination of events from one or more oracles, the smart contract executes.