Skip to content

Commit c9b2a22

Browse files
authored
Update README.md
1 parent 1aec6a0 commit c9b2a22

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,58 @@
11
# pyevmasm
22

3-
pyevmasm is an assembler and disassembler library for the Ethereum Virtual Machine (EVM). pyevmasm supports python 2.7 and newer.
3+
pyevmasm is an assembler and disassembler library for the Ethereum Virtual Machine (EVM). pyevmasm supports python 2.7 and newer. You can find the documentation [here](rtdlink).
44

55
This library is currently new and under development.
66

77
New issues, feature requests, and contributions are welcome. Join us in #ethereum channel on the [Empire Hacking Slack](https://empireslacking.herokuapp.com) to discuss Ethereum security tool development.
88

9+
10+
Example;
11+
```
12+
>>> from pyevmasm import instruction_table, disassemble_hex, disassemble_all, assemble_hex
13+
>>> instruction_table[20]
14+
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
15+
>>> instruction_table['EQ']
16+
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
17+
>>> instrs = list(disassemble_all(binascii.unhexlify('608060405260043610603f57600035')))
18+
>>> instrs.insert(1, instruction_table['JUMPI'])
19+
>>> a = assemble_hex(instrs)
20+
>>> a
21+
'0x60805760405260043610603f57600035'
22+
>>> print(disassemble_hex(a))
23+
PUSH1 0x80
24+
JUMPI
25+
PUSH1 0x40
26+
MSTORE
27+
...
28+
>>> assemble_hex('PUSH1 0x40\nMSTORE\n')
29+
'0x604052'
30+
```
31+
932
# evmasm
10-
evmasm is a commandline utility that uses pyevmasm to assemble or disassemble EVM. Below is an example of disassembling the preamble of compiled contract.
33+
evmasm is a commandline utility that uses pyevmasm to assemble or disassemble EVM.
34+
35+
```
36+
usage: evmasm [-h] (-a | -d | -t) [-bi] [-bo] [-i [INPUT]] [-o [OUTPUT]]
37+
38+
pyevmasm the EVM assembler and disassembler
39+
40+
optional arguments:
41+
-h, --help show this help message and exit
42+
-a, --assemble Assemble EVM instructions to opcodes
43+
-d, --disassemble Disassemble EVM to opcodes
44+
-t, --print-opcode-table
45+
List supported EVM opcodes
46+
-bi, --binary-input Binary input mode (-d only)
47+
-bo, --binary-output Binary output mode (-a only)
48+
-i [INPUT], --input [INPUT]
49+
Input file, default=stdin
50+
-o [OUTPUT], --output [OUTPUT]
51+
Output file, default=stdout
52+
```
53+
1154

55+
Example; disassembling the preamble of compiled contract.
1256
```
1357
$ echo -n "608060405260043610603f57600035" | evmasm -d
1458
00000000: PUSH1 0x80

0 commit comments

Comments
 (0)