Introduction to SMART CONTRACTS

Introduction to SMART CONTRACTS

ยท

3 min read

Table of contents

No heading

No headings in the article.

You can read my last article on "WHY ETHEREUM" here ๐Ÿ‘‡

taniskannpurna.hashnode.dev/limitations-of-..

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. !!โœŒ๏ธ!!

Did you find this article valuable?

Support Tanisk Annpurna by becoming a sponsor. Any amount is appreciated!

ย