Skip to content

Commit 79cdc3e

Browse files
authoredAug 13, 2018
Merge pull request #9 from trailofbits/readme-updates
Minor nitpicks with the readme
2 parents 66b8b46 + 4c93326 commit 79cdc3e

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed
 

‎README.md

+29-26
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,10 @@
11
# pyevmasm
22

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

5-
## Examples
6-
```
7-
>>> from pyevmasm import instruction_table, disassemble_hex, disassemble_all, assemble_hex
8-
>>> instruction_table[20]
9-
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
10-
>>> instruction_table['EQ']
11-
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
12-
>>> instrs = list(disassemble_all(binascii.unhexlify('608060405260043610603f57600035')))
13-
>>> instrs.insert(1, instruction_table['JUMPI'])
14-
>>> a = assemble_hex(instrs)
15-
>>> a
16-
'0x60805760405260043610603f57600035'
17-
>>> print(disassemble_hex(a))
18-
PUSH1 0x80
19-
JUMPI
20-
PUSH1 0x40
21-
MSTORE
22-
...
23-
>>> assemble_hex('PUSH1 0x40\nMSTORE\n')
24-
'0x604052'
25-
```
5+
## CLI Examples with evmasm
266

27-
## evmasm
28-
`evmasm` is a commandline utility that uses pyevmasm to assemble or disassemble EVM.
7+
`evmasm` is a commandline utility that uses pyevmasm to assemble or disassemble EVM:
298

309
```
3110
usage: evmasm [-h] (-a | -d | -t) [-bi] [-bo] [-i [INPUT]] [-o [OUTPUT]]
@@ -46,8 +25,8 @@ optional arguments:
4625
Output file, default=stdout
4726
```
4827

28+
Disassembling the preamble of compiled contract:
4929

50-
Example; disassembling the preamble of compiled contract.
5130
```
5231
$ echo -n "608060405260043610603f57600035" | evmasm -d
5332
00000000: PUSH1 0x80
@@ -62,6 +41,29 @@ $ echo -n "608060405260043610603f57600035" | evmasm -d
6241
0000000e: CALLDATALOAD
6342
```
6443

44+
## Python API Examples
45+
46+
```
47+
>>> from pyevmasm import instruction_table, disassemble_hex, disassemble_all, assemble_hex
48+
>>> instruction_table[20]
49+
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
50+
>>> instruction_table['EQ']
51+
Instruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)
52+
>>> instrs = list(disassemble_all(binascii.unhexlify('608060405260043610603f57600035')))
53+
>>> instrs.insert(1, instruction_table['JUMPI'])
54+
>>> a = assemble_hex(instrs)
55+
>>> a
56+
'0x60805760405260043610603f57600035'
57+
>>> print(disassemble_hex(a))
58+
PUSH1 0x80
59+
JUMPI
60+
PUSH1 0x40
61+
MSTORE
62+
...
63+
>>> assemble_hex('PUSH1 0x40\nMSTORE\n')
64+
'0x604052'
65+
```
66+
6567
# Installation
6668

6769
Python >=2.7 or Python >=3.3 is required.
@@ -71,14 +73,15 @@ Install the latest stable version using pip:
7173
pip install pyevmasm
7274
```
7375

74-
To install the library from source:
76+
Or, install the library from source:
7577
```
7678
git clone https://github.com/trailofbits/pyevmasm
7779
cd pyevmasm
7880
python setup.py install
7981
```
8082

8183
## Documentation
84+
8285
[https://pyevmasm.readthedocs.io](https://pyevmasm.readthedocs.io)
8386

8487
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.

0 commit comments

Comments
 (0)
Please sign in to comment.