What is a Smart Contract

a smart contract is a program that runs on Ethereum blockchain

But why do we call it a smart contract if its just a program?

simply because a smart contract is an agreement between two parties.

Parties involved in the contract have to fulfill certain things in the application , each party set certain rules.

that’s why they call it a contract but in digital format so it became smart contract.

for example:

lets imagine we have a furniture shop and furniture supplier.

the supplier supplies a chair, sofa and other type of furniture to the shop.

What will happen if the furniture delivered by the supplier is not in good condition ?

The shop will stop buying from this supplier and customers will stop buying from the shop ..right? so both parties are in a huge loss.

Ok, now what can we do to prevent this loss?

To prevent such loss the shop and the supplier has to enter a smart contract

We can design the contract (Aka agreement) as follow:

The contract’s job is to act as a middle-man, so the shop pays the contract the items cost, and in the contract there is a code states that if the items has any damage to its condition the contract will not release the money to the supplier

So the shop is protected from any mistakes that could occur by the supplier .