Smart contract is a self executing program based on agreement or logic we provided in the program.
There are three types of contract:
- Smart Legal Contracts
- Digital Will, A legal agreement between two parties - Decentralized Autonomous Organizations (DAO)
- No One is boss. Decisions are made based on voting (smart contract) - Application Logic Contracts
- Communication with smart devices through contracts (IOT)
Each Contract lives on the Ethereum network and has an unique address with ether balance. If we want execute something on the contract we need to use the contract address to do actions. It has data and code associated with it Similar to OOPS concept.
Ethereum nodes don't run the solidity code. First, Transforms the code to bytecode and deploy it in the network. Each nodes has EVM which will executes the bytecode.
Languages to write contracts:
- Solidity - Javascript like
- Vyper - Python like
Contract Limitations:
- Anyone can validate transaction
- Contract execution is deterministic and state change depends on the input
- Contract cannot access outside resources and can't generate truly random number.
Comments
Post a Comment