工具:
- 在线decompile:https://www.ethervm.io/decompile
- 命令行decompile:https://github.com/Arachnid/evmdis
- python decompile:https://github.com/crytic/pyevmasm
- 图形化decompile:https://github.com/crytic/ethersplay
- 其他:https://www.pnfsoftware.com/blog/ethereum-smart-contract-decompiler/
- signature查询:https://www.4byte.directory/
反汇编系列文章
- Reversing and debugging EVM Smart contracts: First steps in assembly\ (part 1️⃣)
- Reversing and debugging EVM Smart contracts: Deployment of a smart contract (Part\ 2️⃣)\
- Reversing and debugging EVM Smart contracts: How the storage layout works? (part\ 3️⃣)\
- Reversing and Debugging EVM Smart contracts: 5 Instructions to end/abort the Execution (part\ 4️⃣)\
- Reversing and debugging EVM Smart contracts: The Execution flow if/else/for/functions (part\ 5️⃣)\
- Reversing and debugging EVM Smart contracts: Full Smart Contract layout (part\ 6️⃣)\
- Reversing and debugging EVM Smart contracts: External Calls and contract deployment (part 7️⃣)
计算方法的sig
async function main() {
let transferEvent = "Transfer(address,address,uint256)"
let sig1 = web3.eth.abi.encodeEventSignature(transferEvent)
let sig2 = web3.eth.abi.encodeFunctionSignature(transferEvent)
//should be: 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
console.log('event sig1:', sig1)
console.log('event sig2:', sig2)
let transferFun = "test()"
let sig3 = web3.eth.abi.encodeFunctionSignature(transferFun)
console.log('Function sig:', sig3)
}