2

Does the EVM process transactions or is it used solely to execute contract code?

I wonder whether the EVM is used to process transactions? I know it is used to execute (or interpret) the bytecode of contracts, but is it also invoked on transactions for transfering funds between accounts or sending a message to a contract?

0

As you can read here:

The Ethereum virtual machine is the engine in which transaction code gets executed, and is the core differentiating feature between Ethereum and other systems.

  • Is transaction code another term for "contract code"? – Shuzheng Sep 20 '17 at 13:19
  • No, transaction code would refer to the data value optionally included with a transaction. That data is processed by the code of the receiving contract. – maurelian Sep 20 '17 at 13:37
  • Every transaction has a script section, aka. code section. In the case of Ethereum, this code is executed by the Ethereum Virtual Machine - EVM. This code section is a bytearray holding the OP codes, this can be seen as a compiled program from a source code possible written with Solidity. – ruizpauker Sep 20 '17 at 15:54
0

I wonder whether the EVM is used to process transactions? I know it is used to execute (or interpret) the bytecode of contracts, but is it also invoked on transactions for transfering funds between accounts...

Only if the transaction is sent to a contract address. In that case, yes, the bytecode will be loaded, and the EVM will interpret the instructions.

... or sending a message to a contract?

Yes. Assuming you mean a message call, which the yellow paper defines as:

Message Call: The act of passing a message from one Account to another.

In which case, yes, that is processed by the EVM using the CALL opcode.

If you put this code into remix, then send a transaction to B.getA(), and look at the debugger, you can see this in action.

pragma solidity ^0.4.10;

contract A {
    uint public value = 1;
}

contract B {
    A a = new A();

    function getA() returns(uint){
        return a.value();
    }
}

remix call opcode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.