What is a Smart Contract and How Does It Work?

Modified on Mon, 19 Aug at 4:57 PM

What is a Smart Contract?

Smart contracts are small computer programs stored in the Ethereum blockchain that can be activated by funding them with some Ethers (ETH), Ethereum’s native token. A smart contract contains rules and regulations between a buyer and a seller. It can facilitate the exchange of documents, company shares, money, properties, and almost anything of value.

Its main goal is to digitally oversee, verify, enforce, or sign an agreement. 
Unlike normal contracts that require the presence of banks, governments, brokers, agents, or lawyers as a middleman, a smart contract is self-executing. It can automatically verify a contract and then execute the agreed-upon terms without a third party or middlemen. While Bitcoin blockchain can also carry out smart contracts, its programming language is very complex and too restrictive to develop anything. Ethereum blockchain, on the other hand, is very friendly for developers as it can run any program regardless of the programming language.

How does it work?

  1. Creation of Terms 
    The agreement between a buyer and a seller is directly converted into lines of code. All the transactions or contracts that happened and will happen are automatically recorded in the Ethereum blockchain. Every contract has its own blockchain address. Once a smart contract is broadcasted into the Ethereum blockchain, anyone can interact with it through that address.

  2. Triggering Events
    A required event with an expiration date is needed in order to be fulfilled for the contract to execute itself based on the coded terms. The code pertains to the “series of instructions”, written by using the programming language “solidity” which works based on the IF-THIS-THEN-THAT logic. This means if the first set of instructions is accomplished, then the required function will happen, and so on until you reach the end of the contract.

  3. Closing the Agreement 
    Once the smart contract is created, both buyers and sellers need to trigger the set of events required from their side. If no action is created by one side of the party before the agreed date, the blockchain will release a refund to the other party.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article