Smart Contract can be defined as a virtual agreement of a transaction/exchange of goods or assets that may or may not involve money. Its main role is for two parties to conduct a business transaction/trade, that can be digitally self-executed and self-enforced, acutely eliminating the need for a ‘middleman’. This would transfer power away from those who currently manage or verify transactions – a seismic change to the way the world currently operates.
Since the business to be conducted is digital, it is very important that the code adheres to the requirements of the interested parties. Therefore, the logic must closely match those. Usually Ethereum is used to code such programs as it provides the most modifiability of all blockchain platforms. But the basic principle is still the “If…this…else…this” statement. Pretty straightforward however the connotations may vary and hence it can be more complex. The code is then encrypted using cryptography and then spread to other computers using Distributed Ledgers of the blockchain. Any changes in the code made by either or all parties is visible to all as the ledger is public. The first party then initiates the transaction and the instruction is sent to the network for execution. No party can determine the outcome as the control of the program is not in their hands.