Configuring Ubuntu for µRaiden network and populus

This tutorial assumes that we have just installed Ubuntu 16.04 and no third-party packages have been installed yet.

Step 1. Install python3.6

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt-get update

sudo apt-get install python3.6

Step 2. Update default symbolic links of python and python3

sudo /usr/bin

sudo rm python python3

sudo ln -s python3.6 python

sudo ln -s python3.6 python3

Step 3. Install and upgrade pip3

sudo apt-get install python3-pip

sudo -H pip3 install --upgrade pip setuptools

Step 4. Install git, autoconf, autogen, and libtool

sudo apt-get install git autoconf autogen libtool

Step 5. Install secp256k1 from its repo



cd secp256k1

./autogen.sh

./configure --enable-module-recovery

make

./tests

sudo make install git clone https://github.com/bitcoin-core/secp256k1.git cd secp256k1./autogen.sh./configure --enable-module-recoverymake./testssudo make install

Step 6. Install simplejson with pip3

sudo -H pip3 install simplejson

Step 7. Install python3.6-dev

First, find the local apt_pkg shared object:

sudo find / -name "*apt_pkg*"

Then, cd to the directory found in the above command, and run the following commands.

sudo ln -s apt_pkg.cpython-35m-x86_64-linux-gnu.so apt_pkg.so

sudo add-apt-repository ppa:fkrull/deadsnakes

sudo apt-get update

sudo apt-get install python3.6-dev

Step 8. Install libssl-dev

sudo apt-get install libssl-dev

Step 9: Clone µRaiden repo and test the prerequisites.



cd microraiden/contracts

nano requirements.txt git clone https://github.com/raiden-network/microraiden.git cd microraiden/contractsnano requirements.txt

Change json to simplejson and then close the file.

sudo -H pip3 install -r requirements.txt

Step 10: Install python3.6-gdbm

sudo apt-get install python3.6-gdbm

Step 11: Install populus and gevent

sudo -H pip3 install populus

sudo -H pip3 install gevent

Step 12: Install solc binary

sudo apt-get install software-properties-common

sudo add-apt-repository -y ppa:ethereum/ethereum

sudo apt-get update

sudo apt-get install solc

Step 13: In contract directory of µRaiden, compile the smart contracts:

mv populus.json project.json

populus compile

Step 14: Try to run pytest

pytest -p no:warnings 2> /dev/null

pytest may report errors for some missing python modules. If so, continue the following steps

Step 15: Fix the compatibility issue of the web3 module

For every missing modules reported in Step 14, find the files with the names of those missing modules in the above repo. Manually add them to your local web3 module. Your web3 module can be found with following command:

sudo find / -name web3

Probably, the found directory should be

/usr/local/lib/python3.6/dist-packages/web3

Step 16: When Step 14 has gone through, you may see that there are 107 tests and 90 of them have passed the test and 17 of them are failed. To fix the failed ones, open the following files:

test_channel_close.py

test_channel_create.py

test_channel_topup.py

test_ecverify.py

test_token.py

test_uraiden.py

And for every equality assertion between addresses, add .upper() on both side of the equality. For example, assert addr == sender in file test_channel_close.py should be updated with assert addr.upper() == sender.uppper . Fixing this for all assertions in above files and run Step 14 again. The output should be like this:

Step 17: Last but not the least, some of the apps may not be compatible with python3.6 (e.g. Slack, Terminal). If you find that those applications do not work any more, remove python and python3 in your /usr/bin and recreate python linking to python2.7 and python3 linking to python3.5. Then, reboot.

Step 18: Change python3 to python3.6 in the first line of the following files: