A web-based tool for decompiling Ethereum Virtual Machine (EVM) bytecode into human-readable assembly-like instructions, featuring interactive workflow visualization and security analysis capabilities.
Install Node.js and npm: Ensure you have Node.js and npm installed on your machine. You can download them from nodejs.org.
//Create the Project Directory: Create a directory for your project and navigate into it: mkdir evm-bytecode-decompiler cd evm-bytecode-decompiler
// Then npm init -y
// Install Dependencies: Install the dependencies listed in package.json: npm install
// Run the Project Locally: Use the http-server script to serve your project locally: npm start
This will start a local server, and you can access your decompiler by navigating to http://localhost:8080 in your web browser.
Full Project Structure: evm-bytecode-decompiler/ ├── index.html ├── styles.css ├── mermaid.css ├── mermaid.js ├── decompiler.js ├── pentest.js ├── package.json └── package-lock.json
- Bytecode Decompilation: Converts hex EVM bytecode into readable opcode instructions with definitions
- Interactive Workflow Visualization: Mermaid flowchart showing contract execution flow with stage-by-stage highlighting
- Security Analysis: Built-in pentest simulations for common vulnerabilities:
- Reentrancy attacks
- Integer overflow/underflow
- Front-running susceptibility
- Access control issues
- Transaction ordering dependencies (MEV)
- Wallet Integration: Connect Ethereum wallets via MetaMask/Web3 providers
- Contract Analysis: Identifies contract type, features, and security properties
- External Tool Integration: Send bytecode to external converters (EVM to RISC-V, etc.)
- Responsive Design: Works on desktop and mobile devices
.
├── index.html # Main application interface
├── mermaid.js # Mermaid initialization and stage control logic
├── mermaid.css # Styling for Mermaid diagrams and UI components
├── pentest.js # Security simulation functions
├── .vscode/ # VS Code settings
└── README.md # This file
-
Open the Application: Simply open
index.htmlin any modern web browser (Chrome, Firefox, Safari, Edge recommended) -
Decompile Bytecode:
- Paste EVM bytecode (hex format, with or without
0xprefix) into the "Input Bytecode" textarea - Click the "Decompile" button to see the decompiled output
- View analysis in the "Bytecode Analysis" and "Contract Information" panels
- Paste EVM bytecode (hex format, with or without
-
Visualize Contract Flow:
- The Mermaid flowchart in the workflow panel shows the typical contract execution flow
- Use the stage buttons (►) to highlight different execution phases:
- Call Received
- Read / Validate
- State Change
- External Call
- Return / Emit
-
Run Security Tests:
- Use the pentest suite buttons to analyze the bytecode for common vulnerabilities:
- Simulate Reentrancy
- Simulate Integer Overflow
- Simulate Front-running
- Simulate Access Control Bypass
- Simulate Tx-Ordering (Nonce/MEV)
- Use the pentest suite buttons to analyze the bytecode for common vulnerabilities:
-
Connect Wallet (Optional):
- Click "Connect Wallet" to link your Ethereum wallet (requires MetaMask or similar)
- Enter a contract address and click "Get Bytecode" to automatically fetch bytecode from the blockchain
-
Use External Converter:
- Click the "EVM→RISC-V Converter" button to open the external conversion tool
- Your current bytecode will be sent to the converter for processing
The application loads with an example bytecode demonstrating a simple contract. Try decompiling it to see how the tool works.
-
Dependencies:
- Web3.js (loaded via CDN) for Ethereum blockchain interaction
- Mermaid.js (loaded via ES module) for flowchart visualization
- No build process or Node.js dependencies required - pure client-side web app
-
Browser Support:
- Modern browsers with ES6 module support
- Tested in Chrome, Firefox, Safari, and Edge
-
Security Note:
- All processing happens client-side - no bytecode is sent to external servers unless you explicitly use the external converter or blockchain lookup features
- Infura URL in the code requires your own project ID for blockchain lookups
- Mermaid Initialization: Fixed conflicting Mermaid initializations that were causing rendering errors
- Git Repository Safety: Added repository to Git's safe.directory list to resolve ownership warnings
- Stage Highlighting: Corrected Mermaid node highlighting logic for proper workflow visualization
- Modify
mermaid.cssto change the visual appearance of the flowchart and UI - Update the opcode definitions in
index.htmlif needed (though they follow Ethereum Yellow Paper standards) - Adjust the Mermaid flowchart in
index.html(lines 115-126) to represent different contract patterns
This is a static web application - no special development setup is required. Simply edit the files and refresh your browser to see changes.
For VS Code users, the .vscode directory contains recommended settings.
MIT License - feel free to use, modify, and distribute this tool as needed.
- Based on Ethereum Yellow Paper opcode definitions
- Uses Mermaid.js for diagram rendering
- Web3.js for Ethereum blockchain interaction