https://github.com/quiet-node/evm-disassembler-ts
A lightweight EVM bytecode disassembler which performs static analysis on EVM bytecode to provide a higher level of abstraction for the bytecode than raw EVM operations.
https://github.com/quiet-node/evm-disassembler-ts
Last synced: 9 days ago
JSON representation
A lightweight EVM bytecode disassembler which performs static analysis on EVM bytecode to provide a higher level of abstraction for the bytecode than raw EVM operations.
- Host: GitHub
- URL: https://github.com/quiet-node/evm-disassembler-ts
- Owner: quiet-node
- Created: 2023-11-20T20:00:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T02:32:04.000Z (about 2 years ago)
- Last Synced: 2024-05-29T17:23:13.168Z (about 2 years ago)
- Language: TypeScript
- Homepage:
- Size: 64.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# EVM Bytecode Disassmebler
A highly lightweight EVM bytecode disassembler, this tool conducts static analysis on Ethereum Virtual Machine (EVM) bytecode. Its purpose is to offer a higher level of abstraction for the bytecode compared to raw EVM operations.
Additionally, the tool can automatically detect whether there is IPFS or Swarm hash CBOR-encoded metadata at the end of the bytecode and exclude it during disassembly.
## Install the package
```bash
npm install evm-disassembler
```
## Basic Usage
```typescript
import { Disassembler } from 'evm-disassembler';
const BYTECODE = '6080604052603e80600f5f395ff3fe'; // or "0x6080604052603e80600f5f395ff3fe";
const disassembly = Disassembler.disassemble(BYTECODE);
console.log(disassembly);
// expected output:
// [
// { index16: '0x0', hex: '60', mnemonic: 'PUSH1', operand: [ '80' ] },
// { index16: '0x4', hex: '52', mnemonic: 'MSTORE', operand: [] },
// { index16: '0x2', hex: '60', mnemonic: 'PUSH1', operand: [ '40' ] },
// { index16: '0x5', hex: '60', mnemonic: 'PUSH1', operand: [ '3e' ] },
// { index16: '0x7', hex: '80', mnemonic: 'DUP1', operand: [] },
// { index16: '0x8', hex: '60', mnemonic: 'PUSH1', operand: [ '0f' ] },
// { index16: '0xa', hex: '5f', mnemonic: 'PUSH0', operand: [] },
// { index16: '0xb', hex: '39', mnemonic: 'CODECOPY', operand: [] },
// { index16: '0xc', hex: '5f', mnemonic: 'PUSH0', operand: [] },
// { index16: '0xd', hex: 'f3', mnemonic: 'RETURN', operand: [] },
// { index16: '0xe', hex: 'fe', mnemonic: 'INVALID', operand: [] }
// ]
```