Introduction to SMART CONTRACTS
Tags: smartcontracts, blockchain, ethereum, web3
Published: 2022-07-07 21:05:44

*You can read my last article on "WHY ETHEREUM" here 👇*
> https://dev.to/taniskannpurna/limitations-of-blockchain-solved-by-ethereum-3hei

Let's start….

💜 REAL WORLD CONTRACTS
Paper Contracts are already present in the world. So why we need the SMART CONTRACTS, well there is a issue with our current contract

- Paper contracts are basically backed by Government. One relies that if the contracts agreement are not fulfilled then they can complain to government.
- But What happens if the government doesn't support. What one can do if suddenly government changes something and your contract gets null.
- No one can do anything now.

So what is the solution then ?....

💜 SMART CONTRACTS
- Smart Contract is an electronic contract written in solidity and then deployed to EVM(Ethereum Virtual Machine).
- Smart Contract is like a promise that can not be broken.

💜 HOW IT WORKS
We have already seen how blockchain and Ethereum works.
- Just like bank accounts we have accounts on Ethereum.
- Now We have account number in banks which is unique. Similarly, we have account address that is unique.
- We have balances in bank accounts. Similarly, we have balances in accounts.

Now, Ethereum handles smart contract similarly...
- When we deploy a smart contract to Ethereum, It is also treated as an account on the chain.
- Ethereum provides the smart contract its unique address, its own balance and ability for other accounts to use deployed smart contracts.
- These smart contracts lives on the chain and as soon as certain condition is met, it executes proper function for that.

So we can see, How any external authority or anyone can change or make the contract null.

👉 Remember, Smart Contracts once deployed on the chain can not be altered/Changed because Chain makes it too hard for the change. We can block it / give the access but we cannot alter it.

💜 APPLICATIONS OF SMART CONTRACTS
It can be used to create these ...
- DeFi -> Decentralized Finance
- DAOs -> Decentralized Autonomous Organization
- NFTs -> Non-fungible tokens
- Dapps -> Decentralized Apps

💜 HOW EVM HANDLES SMART CONTRACT
- Smart contracts are written in solidity, a programming language heavily inspired by JavaScript.
- But EVM does not understand solidity or any high level languages. It understand BYTECODE i.e. a low level language.
- Now writing  BYTECODE is not human readable, So we convert our SOLIDITY -> BYTECODE and then send to EVM.
- But we also require ABI(Application Binary Interface). This helps our JavaScript code to interact with EVM BYTECODE.
- Now we can use many packages to convert our smart contract into ABI and BYTECODE. Few of them are "solcjs","ethers","hardhat" and many more.

This is the way EVM handles smart contract. In the next article we will see in more details about ABI, BYTECODE and how we can convert our smart contract to these.
We will also get basics of solidity and how to write smart contract and many more..

> Hello, I am Tanisk Annpurna
> 
> I post about

> 🚀web3, Blockchain, Ethereum

> 🐦Smart Contract, Solidity

> 🎉JavaScript, ReactJS, NodeJS

> 
> Follow and like for more such posts.
> !!✌️!!