When I compile a blank contract:
contract A {}
with
solc --optimize --optimize-runs 300000 --opcodes test.sol
I get:
PUSH1 0x60 PUSH1 0x40 MSTORE PUSH1 0x6 DUP1 PUSH1 0x10 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN PUSH1 0x60 PUSH1 0x40 MSTORE STOP
What is it? As I understand this bytecode not the code of contract, but code which during execution generate contract. But I don't get, what is going on.
Probably
PUSH1 0x60 PUSH1 0x40 MSTORE
is a pattern to allocate 64 bytes(0x40) in memory. If yes, why we need manually allocate it?
There are a few lines in Yellow paper about separation 'code' and 'data'. I can see it, when run solc
with --asm-json
. But how this two parts actually interact?
I feel like I missed a very important paper or manual where everything is cleared. Where can I get it?
To summarize:
- What does bytecode of blank contract do? If it is possible, I need explanation for each opcode.
- How interact
code
anddata
sections of contract? - Where I can find full info about how evm works?