Smart Contract in Ethereum

Now-a-days Web3.0 is trending and there are lot of stuffs also in talks like blockchain, NFT, Ethereum, Solidity, etc. etc..

As many of us would know about the blockchain, let's just see it's definition

Blockchain is a continuously growing list of records or blocks you can say, which are completely decentralized with distributed databases and immutable ledger meaning continuous blocks linked to each other.

Blockchain

So now let's move towards our topic Smart Contract.

Example

Let's take an example for this. Suppose there is company which helps various NGO's to collect the funds for their campaigns. Various NGO's files pledged amount to their site and rest of the work is done by that company, which can also be called as "crowd-funding".

If the amount contributed by various people is equal to or greater than the pledged amount the NGO's will get the amount by deducting the some commission by the platform provider company.

Else if the money funded is not equal to the pledged amount, the money will be returned to the people.

Similarly, the smart contract's work. See the formal definition of

"Smart Contract"...

"smart contract" is simply a program that runs on the Ethereum blockchain. It's a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain.

Smart contracts are a type of Ethereum account. This means they have a balance and they can send transactions over the network. However they're not controlled by a user, instead they are deployed to the network and run as programmed. User accounts can then interact with a smart contract by submitting transactions that execute a function defined on the smart contract.

In simple language, it is a certain set of rules written with the help of scripting language like Solidity in Ethereum , which can be considered as JavaScript.

Where the smart contract will be present in blockchain?

So when there will be a Peer-to-Peer network of blockchain where all the nodes are interconnected to each other i.e. ledger. Each node will contain a separate blockchain. So where does the smart contract will be present?.

It will be present alongside with the blockchain of node.

Peer to Peer Network

Real-World Smart Contract in use....

So when the Jack Dorsey's first tweet was sold to Person A as NFT(Non-fungible Token) ,all the transaction was noted in smart contract and money was transferred to the original owner. Now when that Person A will sell that tweet to Person B all the transaction will be noted and maintained by the "Smart Contract" and the royalty amount will be sent to the Jack Dorsey.

Smart Contract in Jack Dorsey's tweet

Conclusion

Smart contracts can define rules, like a regular contract, and automatically enforce them via the code. Smart contracts cannot be deleted by default, and interactions with them are irreversible.