Smart contracts follow simple“if/when…then…”statements programmed into code on a decentralized ledger. Computer networks execute the actions (issuing stocks to the relevant parties; sending notifications; vehicle registration; ticket allotment) when predefined restraints have been met and approved. After each transaction completion, the blockchain is updated.
Let’s understand the functionality with an example of a Supply Chain Smart Contract.
Buyer Y wants to purchase an item from Sellar X and transferred the amount to the escrow account. Sellar X request Transporter Z to complete the delivery.Now the role of "if/when…then" statements come into action.
- If Buyer Y receives the product, Transporter Z and Sellar X get the amount held in escrow.
- If the item is not delivered to Buyer Y by deadline A, the amount in escrow moves back to the Buyer's account.
- As per the delivery and transaction success, the Manufacturer is notified to create more products to satisfy the demand and supply ratio.
All these operations are executed automatically through the Smart Contracts.
Within a blockchain contract, there can be various stipulations as required to let the members agree for transaction completion. To establish consensus, network members must identify how events and their details are described, consent to the laws that manage those transactions, look for all permissible exemptions, and determine a conflict resolution framework. It's generally an iterative process that includes both business shareholders and developers.