This article was first published on Stories by Qtum on Medium
As part of the upcoming hard fork, Qtum will introduce several precompiled contracts to the EVM on top of Qtum, which will enable more efficient smart contracts that offer the creation and transfer of confidential assets.
Ethereum has two kinds of accounts, the externally owned account, and the contract account. Externally Owned Account (EOA) is a kind of account controlled by private keys and without any code associated with it. A Contract Account (CA) is an account assigned to a smart contract, controlled by contract. An externally owned account can send a transaction, which can be a transfer transaction or a transaction related to a smart contract to create or trigger a smart contract.
Each transaction of Ethereum will be converted into a Message object, which is passed to the EVM for execution, and then EVM will convert the Message object into a Contract object. If it is a normal transfer transaction, the corresponding account balance will be modified in StateDB. If it is a transaction that creates or invokes a smart contract, the bytecode is loaded and executed by the interpreter in the EVM, and the StateDB may be queried or modified during execution. As you can see from the figure, the Contract object loads the corresponding contract code from the database according to the address of the contract, and then sends it to the interpreter for execution.
The EVM interpreter is a stack-based machine with its PC, stack, memory, and gas pool. A contract code will be interpreted as a strip of opcodes and then executed. Before executing opcode, the EVM interpreter will check the required Gas and the current Gas remaining for the command. If the Gas is insufficient, it will return the ErrOutOfGas error. Because EVM is a stack-based ...
To keep reading, please go to the original article at:
Stories by Qtum on Medium