
An introduction
We will be using some analogies as we explain this subject
Let's say went to a good eatery in your neighborhood to have a meal, you got in and placed your order, and after placing the order you immediately made payment
The few mins after, as you are about to leave the waiter asked you to pay, you reminded him, I just paid you and he said NO you did not,
So now you are stuck and you are left with only two things to do, either to call the police or serve the eatery for the proportion of meals you took
The problem that occurred here was that you had to trust the waiter from the moment you gave him the money to the moment he records your payment.
Smart Contract is a way to solve this problem - they are essentially just piece of software that does what it's supposed to do or what it is coded for.
A vending machine is a very good example of how a smart contract operates - when you put in your money, you get your things (whatsoever you buy out) if you don't put in any money, you get nothing - it simply does what it's being assigned to do, it does not have its brain, it's completely trustless.
Smart Contracts are fancy words for a piece of code that automatically executes something in a predetermined way.
They are mainly used to remove the need for trusted intermediaries, disputes, or trust
Smart Contract in blockchain
When people refer to smart contracts, in a proper context they are referring to codes that are stored on blockchains.
With the aid of blockchain, the code is
- Immutable ( cannot be coded in the reverse)
- Public and visible to all
- everyone can call for the execution of the code
Smart contract platforms are usually blockchains that host smart contracts or decentralized applications. The user of this kind of platform can perform various actions such as lending and borrowing funds, staking of assets, or minting of NFTs.
Some popular example of this kind of platform we'll discuss is Ethereum, Solana, and Polygon.