What is a Smart Contract?
- computer virus
- EVM context
- Decentralized World Computer
- Nick Szabo was a Cryptographer who coined the phrase in 1991 and defined it as “a set of promises, specified in digital form, including protocols within which the parties perform on the opposite promises”.
Ethereum smart contracts
- Ethereum’s smart contracts are supported different computer languages, which developers use to program their own functionalities.
- The Smart contracts are high-level programming abstractions that are compiled right down to EVM bytecode and deployed to the Ethereum blockchain for execution.
- The most important research-oriented language is under development called Vyper (a strongly-typed Python-derived decidable language).
- Smart contracts are often public, which exposes the likelihood to prove functionality, e.g. self-contained provably fair casinos.
- One issue associated with using smart contracts on a public blockchain is that bugs, including security holes, are visible to all or any but can’t be fixed quickly. One example of this is the 17 June 2016 assault on The DAO, which couldn’t be quickly stopped or reversed.
- There is research underway on the way to use formal verification to precise and prove non-trivial properties. A Microsoft Research report noted that writing solid smart contracts are often extremely difficult in practice, using The DAO hack for instance this problem.
- The report explained the tools that Microsoft had developed for verifying contracts, and noted that a large-scale analysis of published contracts is probably going to uncover widespread vulnerabilities. The report also stated that it’s possible to verify the equivalence of a Solidity program and therefore the EVM code.
- Ethereum apps are written in one among seven different Turing complete languages. Developers use the language to make and publish applications that they know will run inside Ethereum. The stable coin teether and DAI, and therefore the prediction market Augur are samples of applications that run on Ethereum.
- The use case proposals have comprised finance, the IoT, farm-to-table produce, electricity sourcing, and pricing. For example, Breitling issues digital certificates of authenticity to owners of its watches on Ethereum which may be transferred to new owners and help prove authenticity. Ethereum is (as of 2020) the leading blockchain platform for initial coin offerings projects, with over 50% market share.
The life cycle of a sensible Contract
- Written during an application-oriented language, such as Solidity.
- It compiled to the low-level bytecode that runs in EVM.
- Deployed employing a sealed instrument transaction.
- Contract Addresses are often utilized in a transaction because of the recipient for sending funds to the contract or calling one among the contract’s functions.
- Contracts only run if they’re called by a transaction.
- Contracts never run “on their own” or within the background”.
- Smart contracts aren’t executed “in parallel” in any sense
Smart Contract execution
- Can call another contract which will call another contract, and so on.
- First, accept a sequence of execution will always be called by a transaction from an EOA.
- Recorded as long as all execution terminates successfully, otherwise RollBack.
- Failed Transaction remains recorded as having been attempted.
- Ether which spent on gas for the implementation is deducted from originating account,
- It otherwise has not had enough effects on the contract or account state.
Deleting smart contract
- Contract code can’t be changed.
- By vanishing the code and its inner state(storage) from its address,—–Leaving a blank account.
- Executing on EVM opcode called SELF DESTRUCT.
- The Costs “negative gas” a gas refund (incentive for releasing network resources) doesn’t remove the transaction history (past) of the contract–IMMUTABILITY. SELF DESTRUCT capability will only be available if the contract possess that functionality
- EVM may be a valid machine that runs a special sort of code called EVM byte code.
- Any application-oriented language might be adopted to write down smart contracts.
- A variety of special-purpose languages have emerged for might be adopted to write down smart/programming smart contracts.
- Declarative(Functional) programming languages (Haskell and SQL)
- Imperative(Procedural) programming languages(C++ and Java)