Content
In addition to creating a smart contract, you must also have an environment where you can execute it. However, this execution environment must have some properties. These attributes are:
Certainty.
Can be terminated.
Isolated.
- Certainty
If the program gives the same output to a given input every time, the program is deterministic. E.g. If 3+1=4 then 3+1 is always 4 (assuming the same base). Therefore, when a program provides the same output to the same set of inputs in different computers, the program is called deterministic. The environment must ensure that the execution of the smart contract is always certain.
- Can be terminated
In mathematical logic, we have an error called the halting problem. Basically, it shows that it is impossible to know whether a given program can perform its function within a certain time limit. In 1936, Alan Turing used Cantor's diagonal problem to infer that there is no way to know whether a certain program can be completed within a time limit.
This is obviously a problem with smart contracts, because by definition, a contract must be able to terminate within a given time limit. Therefore, the environment must be able to stop the operation of the smart contract.
- Isolation
In the blockchain, anyone and everyone can upload smart contracts. However, because of this, the contract may contain viruses and errors, knowingly and unknowingly.
If the contract is not isolated, this may hamper the entire system. Therefore, keeping the contract in a sandbox is essential to protect the entire environment from any negative effects.
Ethereum uses a virtual machine called the Ethereum Virtual Machine (EVM) to execute its smart contracts.