Solidity原理(六):用solc编译smart contract,用evm反编译bytecode
首先需要安装solc和evmsolc:https://github.com/ethereum/solidity/releasesevm: https://geth.ethereum.org/downloads/编译一个smart contract可以通过指令 solc --bin-runtime filepath来得到bytecode反编译bytecode可以通过evm --dissam b...
文章共184字 · 阅读需要大约1分钟
一键AI生成摘要,助你高效阅读
问答
·
首先需要安装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,函数签名等
更多推荐
已为社区贡献1条内容
所有评论(0)