Smart Contract in Blockchain

Smart Contract in Blockchain

What is a smart contract ?

A smart contract is a program that is stored on the Blockchain. For example – This is a smart contract program written in solidity programming language for the Ethereum Blockchain.


smart contract

Which programming language is used for writing smart contracts ?

Every Blockchain supports a different programming language for writing smart contracts. For example – Ethereum Blockchain supports solidity, Solana Blockchain supports Rust, Neo Blockchain supports C#, Python, Typescript, Java, GO.

Why do we need smart contracts ?

Let us understand this with the help of an example. Let’s say there is A and B. A is fruit supplier and B is fruit seller.


After A has done delivery of fruits to B. B pays money to A. And this is how business transactions work. But after delivery, B realizes that the fruit supplied by A is rotten. And now B cannot sell the fruits to his customers. Hence, B is at a loss.


So what B can do so that next time he/she is not in this similar situation again ?





B can use a smart contract. This smart contract will make sure that B will pay to A only and only if fruits delivered by A are in good condition. This is what the flow diagram of a smart contract will look like.

flow diagram

What this smart contract is doing is that it is taking input as temperature from IOT (used for calculating temperature). This IOT will be installed in the fruit delivery truck container. If IOT detects a temperature of the container greater than 30 degree Celsius, then delivery will be canceled and B will not need to pay to A. If IOT detects a temperature of the container less than 30 degree Celsius, then delivery will be done and money (crypto) will be transferred to A. 

How smart contract program is different from any other program written in C, Java, Python, etc. ?

The best part of a smart contract program is that it is immutable unlike any other programs. By immutable, I mean once a smart contract is deployed on the Blockchain, nobody can change the smart contract, nobody can manipulate the smart contract.

Another thing about the smart contract program is it does not require any human intervention. In the above example, if the temperature is less than 30 degrees Celsius, in that case, cryptocurrency will be directly transferred from B’s account to A’s account. On the other hand, if the temperature is greater than 30 degrees Celsius, then no cryptocurrency transfer will take place.

So, I hope concept regarding smart contract is clear now. Please give a comment if you liked this blog.


Sharing is caring

Did you like what Kshitij wrote? Thank them for their work by sharing it on social media.


No comments so far