All Projects → crytic → pyevmasm

crytic / pyevmasm

Licence: Apache-2.0 license
Ethereum Virtual Machine (EVM) disassembler and assembler

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyevmasm

one-wallet
1wallet - unconventional keyless, non-custodial wallet secured by Google Authenticator. EVM-compatible, smart contract operated, with composable security.
Stars: ✭ 85 (-58.74%)
Mutual labels:  evm
evm llvm
Official repo of the EVM LLVM project
Stars: ✭ 72 (-65.05%)
Mutual labels:  evm
secureum-mind map
This repo is less actively maintained now but I still monitor it for PR's.
Stars: ✭ 422 (+104.85%)
Mutual labels:  evm
heco-chain
HECO-Chain client based on the go-ethereum fork
Stars: ✭ 239 (+16.02%)
Mutual labels:  evm
Contracts
All WiBX blockchain chain code
Stars: ✭ 20 (-90.29%)
Mutual labels:  evm
foundry
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Stars: ✭ 4,623 (+2144.17%)
Mutual labels:  evm
LunDAO
LunDAO 是一個鼓勵撰寫與 Ethereum 社群相關的中深度的中文文章,透過一個短期的實驗專案嘗試 DAO 可以如何進行社群治理以及回饋社群貢獻。
Stars: ✭ 50 (-75.73%)
Mutual labels:  evm
Shockky
Shockwave File Disassember
Stars: ✭ 41 (-80.1%)
Mutual labels:  dissassembler
minority
Ethereum 2.0 node multiplexer between consensus and execution
Stars: ✭ 94 (-54.37%)
Mutual labels:  evm
hashport-validator
Official repository containing the source code of the Hashport validators
Stars: ✭ 19 (-90.78%)
Mutual labels:  evm
pali-wallet
The Official Syscoin browser wallet. Open source, easy to use & multichain.
Stars: ✭ 30 (-85.44%)
Mutual labels:  evm
awesome-ethereum-events
Inspired by the awesome list of awesome lists of awesome lists of...
Stars: ✭ 18 (-91.26%)
Mutual labels:  evm
reef-chain
EVM compatible chain with NPoS/PoC consensus
Stars: ✭ 142 (-31.07%)
Mutual labels:  evm
etk
evm toolkit
Stars: ✭ 244 (+18.45%)
Mutual labels:  evm
revm
Revolutionary Machine (revm) is a fast Ethereum virtual machine written in rust.
Stars: ✭ 383 (+85.92%)
Mutual labels:  evm
submarine sends
A proof-of-concept implementation of Submarine Sends for Ethereum
Stars: ✭ 29 (-85.92%)
Mutual labels:  evm
bytecode-verifier
Compile Solidity source code and verify its bytecode matches the blockchain
Stars: ✭ 78 (-62.14%)
Mutual labels:  evm
vandal
Static program analysis framework for Ethereum smart contract bytecode.
Stars: ✭ 121 (-41.26%)
Mutual labels:  evm
prb-math
Solidity library for advanced fixed-point math
Stars: ✭ 404 (+96.12%)
Mutual labels:  evm
100-days-of-Web3
A list of FREE resources to make Web3 accessible to everyone.
Stars: ✭ 2,801 (+1259.71%)
Mutual labels:  evm

pyevmasm

Build Status

PyPI version Slack Status

pyevmasm is an assembler and disassembler library for the Ethereum Virtual Machine (EVM). It includes a commandline utility and a Python API.

CLI Examples with evmasm

evmasm is a commandline utility that uses pyevmasm to assemble or disassemble EVM:

usage: evmasm [-h] (-a | -d | -t) [-bi] [-bo] [-i [INPUT]] [-o [OUTPUT]] [-f FORK]

pyevmasm the EVM assembler and disassembler

optional arguments:
  -h, --help            show this help message and exit
  -a, --assemble        Assemble EVM instructions to opcodes
  -d, --disassemble     Disassemble EVM to opcodes
  -t, --print-opcode-table
                        List supported EVM opcodes
  -bi, --binary-input   Binary input mode (-d only)
  -bo, --binary-output  Binary output mode (-a only)
  -i [INPUT], --input [INPUT]
                        Input file, default=stdin
  -o [OUTPUT], --output [OUTPUT]
                        Output file, default=stdout
  -f FORK, --fork FORK  Fork, default: byzantium. Possible: frontier,
                        homestead, tangerine_whistle, spurious_dragon,
                        byzantium, constantinople, serenity. Also an unsigned
                        block number is accepted to select the fork.

Disassembling the preamble of compiled contract:

$ echo -n "608060405260043610603f57600035" | evmasm -d
00000000: PUSH1 0x80
00000002: PUSH1 0x40
00000004: MSTORE
00000005: PUSH1 0x4
00000007: CALLDATASIZE
00000008: LT
00000009: PUSH1 0x3f
0000000b: JUMPI
0000000c: PUSH1 0x0
0000000e: CALLDATALOAD

Python API Examples

>>> from pyevmasm import instruction_tables, disassemble_hex, disassemble_all, assemble_hex
>>> instruction_table = instruction_tables['byzantium']
>>> instruction_table[20]
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
>>> instruction_table['EQ']
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
>>> instrs = list(disassemble_all(binascii.unhexlify('608060405260043610603f57600035')))
>>> instrs.insert(1, instruction_table['JUMPI'])
>>> a = assemble_hex(instrs)
>>> a
'0x60805760405260043610603f57600035'
>>> print(disassemble_hex(a))
PUSH1 0x80
JUMPI
PUSH1 0x40
MSTORE
...
>>> assemble_hex('PUSH1 0x40\nMSTORE\n')
'0x604052'

Installation

Python >=2.7 or Python >=3.3 is required.

Install the latest stable version using pip:

pip install pyevmasm

Or, install the library from source:

git clone https://github.com/trailofbits/pyevmasm
cd pyevmasm
python setup.py install --user

Documentation

https://pyevmasm.readthedocs.io

New issues, feature requests, and contributions are welcome. Join us in #ethereum channel on the Empire Hacking Slack to discuss Ethereum security tool development.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].