Skip to content

1. Installing pyethereum and serpent

Ren Zhang edited this page Jul 7, 2017 · 16 revisions

Windows

Unfortunately, to the best of my knowledge, the only way to run pyethereum and serpent on Windows is via a Linux virtual machine.

Linux and OS X

pyethereum

This part combines pyethereum Developer Notes and pyethereum home page with some fixes. Note that both python 2 and python 3 are supported. If you want to install pyethereum and serpent on python 3, just substitute "python" with "python3", and "pip" with "python3 -m pip" or "pip3" in the commands.

First, install some necessary libraries.

For Linux:

sudo apt-get update
sudo apt install libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev git python-pip
pip install pytest

For OS X:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # install homebrew
brew install pkg-config libffi autoconf automake libtool openssl python
sudo pip install cryptography
pip install pytest
sudo env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install scrypt

The last line adds openssl to environment variables before installing scrypt. For the rest of this guide, OS X's steps are identical with Linux's.

Now we are ready to install pyethereum. Although it is suggested in several places to use the latest "develop" branch of pyethereum (such as in this paper and the pyethereum home page), this branch is constantly changing and may contain some unresolved issues. Therefore I cloned the pyethereum repository on Jun. 27, 2017, which I successfully installed, in this repository. You can download it by:

git clone https://github.com/nirenzang/Serpent-Pyethereum-Tutorial.git

Then move the pyethereum directory to your chosen destination.

Alternatively, here's how to install the "develop" branch, verified on Jul. 4, 2017.

git clone https://github.com/ethereum/py_pairing.git
cd py_pairing
sudo python setup.py install
git clone https://github.com/ethereum/pyethereum.git

Now that we have pyethereum downloaded and the necessary libraries installed, we can proceed and finish the installation:

cd pyethereum
sudo pip install -r requirements.txt
sudo python setup.py install

serpent

The intallation guide on serpent github homepage works. Here is an extended version:

git clone https://github.com/ethereum/serpent.git
cd serpent
git checkout develop
make
sudo make install
sudo python setup.py install

At last, go back to the pyethereum directory and try

python -m pytest ethereum/tests/test_contracts.py

If all the tests pass, we are ready to start programming smart contracts!

Clone this wiki locally