What is a smart contract? Simply Explained
Smart contract is just a phrase used to describe computer code that can facilitate the exchange of money, content, property, shares, or anything of value. When running on the blockchain a smart contract becomes like a self-operating computer program that automatically executes when specific conditions are met. Because smart contracts run on the blockchain, they run exactly as programmed without any possibility of censorship, downtime, fraud or third party interference.
“ [Ethereum] blockchain has some extraordinary capabilities. One of them is that you can build smart contracts. It`s kind of what it sounds like. It`s a contract that self-executes, and the contract handles the enforcement, the management, performance, and payment” Don Tapscott
Smart contracts - Simply Explained
Smart contracts are how things get done in the Ethereum ecosystem. When someone wants to get a particular task done in Ethereum they initiate a smart contract with one or more people. Smart contracts are a series of instructions, written using the programming language “solidity”, which work on the basis of the IFTTT logic aka the IF-THIS-THEN-THAT logic. Basically, if the first set of instructions are done then execute the next function and after that the next and keep on repeating until you reach the end of the contract.
The best way to understand that is by imagining a vending machine. Each and every step that you take acts like a trigger for the next step to execute itself. It is kinda like the domino effect. So, let’s examine the steps that you will take while interacting with the vending machine:
Step 1: You give the vending machine some money.
Step 2: You punch in the button corresponding to the item that you want.
Step 3: The item comes out and you collect it.
Now look at all those steps and think about it. Will any of the steps work if the previous one wasn’t executed? Each and every one of those steps is directly related to the previous step. There is one more factor to think about, and it is an integral part of smart contracts. You see, in your entire interaction with the vending machine, you (the requestor) were solely working with the machine (the provider). There were absolutely no third parties involved.
So, now how would this transaction have looked like if it happened in the Ethereum network? Suppose you just bought something from a vending machine in the Ethereum network, how will the steps look like then?
Step 1: You give the vending machine some money and this gets recorded by all the nodes in the Ethereum network and the transaction gets updated in the ledger.
Step 2: You punch in the button corresponding to the item that you want and record of that gets updated in the Ethereum network and ledger.
Step 3: The item comes out and you collect it and this gets recorded by all the nodes and the ledger.
Every transaction that you do through the smart contracts will get recorded and updated by the network. What this does is that it keeps everyone involved with the contract accountable for their actions. It takes away human malice by making every action taken visible to the entire network. But, having said that, what mainly incentivizes these people to fulfill their end of the bargain anyway? What are they getting by helping out the requestors? This is where Ether comes in.