Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Installing the libsecp256k1 binding

x90" * 365 edited this page Aug 14, 2018 · 5 revisions

NOTE: This applies to version 0.2.0+. The other instructions will be deprecated soon.

Installing the libsecp256k1 binding on Linux/OSX

Start by following the README: pip install -r requirements.txt.

In some cases, this will work (if you already have the libsecp256k1 shared library). For the large majority of people, this will not be the case, and you will see an installation failure. In that case, you have to prepare the packages required to build it; although, once you have, the pip installation will do the actual build under the hood. The requirements are listed at the project homepage here; you shouldn't need the env variable settings mentioned. I have added python-dev which seems to be an additional requirement. They are:

On Debian / Ubuntu: build-essential automake pkg-config libtool libffi-dev libgmp-dev python-dev libsecp256k1-dev

On OS X the necessary homebrew packages are: automake pkg-config libtool libffi gmp

Installing the libsecp256k1 binding on Windows

This should happen automatically if you follow the Windows instructions

Installing the libsecp256k1 binding on TAILS

These instructions are for those who want to run joinmarket scripts (as opposed to -Qt) on TAILS and use the libsecp256k1 binding.

Tests have been done on 2.3 and 1.7.8. It's recommended to run the latest TAILS version for security reasons.

##For TAILS 2.3

Here is the result of experiments done on a new TAILS 2.3 instance.

sudo apt-get update

required to install packages on a fresh TAILS instance.

sudo apt-get install build-essential automake libtool pkg-config libffi-dev python-dev python-pip

development dependencies required to do the building of the underlying libsecp256k1 dynamic library (and make the Python binding)

sudo torsocks pip install secp256k1

this part does the actual build and installs the Python binding in /usr/local/lib/python2.7/dist-packages. Again, sudo is needed.

sudo chmod -R ugo+rX /usr/local/lib/python2.7/dist-packages/

This unpleasant hack is required because for some reason the files are created without permissions for non-root user. I would appreciate any advice in fixing this in whatever way is most sensible.

After this, secp256k1 should be available: to check, type python (as amnesia) and then type import secp256k1 at the Python prompt. There should be no error message. If so, joinmarket scripts will pick it up.

##For TAILS 1.7.8

Here is the result of experiments done on a new TAILS 1.7.8 instance.

sudo apt-get update

required to install packages on a fresh TAILS instance.

sudo apt-get install build-essential automake libtool pkg-config libffi5 libffi-dev python-dev

development dependencies required to do the building of the underlying libsecp256k1 dynamic library (and make the Python binding)

torify curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo torify python get-pip.py

recommended way to update pip. However something is slightly "off" about the permissions after doing this (see chmod command below). Note that I tried to do this part without sudo and it doesn't work.

sudo torify pip install secp256k1

this part does the actual build and installs the Python binding in /usr/local/lib/python2.7/dist-packages. Again, sudo is needed.

sudo chmod -R ugo+rX /usr/local/lib/python2.7/dist-packages/

This unpleasant hack is required because for some reason the files are created without permissions for non-root user (again, the whole process without sudo fails). I would appreciate any advice in fixing this.

After this, secp256k1 should be available: to check, type python (as amnesia) and then type import secp256k1 at the Python prompt. There should be no error message.