Solidity原理(六):用solc编译smart contract,用evm反编译bytecode
·
首先需要安装solc和evm
solc: https://github.com/ethereum/solidity/releases
evm: https://geth.ethereum.org/downloads/
编译一个smart contract可以通过指令 solc --bin-runtime filepath来得到bytecode
反汇编bytecode可以通过evm --disasm bytecodeFilePath
反汇编以后的文件如下:
前面的数字就是pc(programmer counter), 以20行的指令为例,0x008d代表21行的JUMPI跳转的pc值是141.
solc还有下面几个非常好用的指令,可以获得合约的ast,asm(汇编码),opcode,bin,abi,函数签名等
更多推荐
所有评论(0)