From 09443792a700f0cd66088f82db0ffc93d093cc75 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 26 Dec 2016 16:40:38 +0200 Subject: [PATCH] improved instructions, update pytest reqs --- INSTALL.md | 65 ++++++++++++++++++++++++++++++++ README.md | 90 ++++---------------------------------------- TESTING.md | 23 +++++++++++ requirements-dev.txt | 4 +- 4 files changed, 98 insertions(+), 84 deletions(-) create mode 100644 INSTALL.md create mode 100644 TESTING.md diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..308211d --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,65 @@ +### Installation on Linux + +To install everything (client and server), install these packages: + +sudo apt-get install python-dev python-pip git build-essential +automake pkg-config libtool libffi-dev libssl-dev + +(+ libsodium-dev if you can find it, else build after) + +(to build libsodium after): + + git clone git://github.com/jedisct1/libsodium.git + cd libsodium + git checkout tags/1.0.4 + ./autogen.sh + ./configure + make check + sudo make install + cd .. + +Then: + + sudo pip install virtualenv + mkdir jmvenv + cd jmvenv; source bin/activate; cd .. + +Install this repo in the virtualenv: + + git clone https://github.com/AdamISZ/joinmarket-clientserver + cd joinmarket-clientserver + +#### Installing packages to run everything in-one: + + python setupall.py --daemon + python setupall.py --client-bitcoin + +If you have installed this "full" version of the client, you can use it with the +command line scripts as explained in the [scripts README](https://github.com/AdamISZ/joinmarket-clientserver/tree/master/scripts). + +#### Installing the daemon separately + +Just do + + python setupall.py --daemon + +Then, you can run the daemon on its own with + + cd scripts; python joinmarketd.py + +The reason for doing this may be either (1) to run command-line scripts provided here, but +in a separate process from the daemon; or, (2) to run a separate (e.g. wallet plugin) codebase +to do the bitcoin operations. + +In the former case you will need still to install the local packages: + + python setupall.py --client-bitcoin + +and then edit your `joinmarket.cfg` section `DAEMON`, setting `no_daemon = 0`. + +The latter case applies to the Electrum plugin, see [here](https://github.com/AdamISZ/electrum-joinmarket-plugin). + +There, you need to install the client code (without Joinmarket's bitcoin): + + python setupall.py --client-only + diff --git a/README.md b/README.md index c406847..f150762 100644 --- a/README.md +++ b/README.md @@ -18,93 +18,19 @@ have extremely minimal to no impact on the backend code, since the latter just i communication of a set of formatted messages, and allows the client to decide on their validity beyond simply syntax. -Joinmarket's own [messaging protocol] is thus enforced *only* in the server/daemon. +Joinmarket's own [messaging protocol](https://github.com/JoinMarket-Org/JoinMarket-Docs/blob/master/Joinmarket-messaging-protocol.md) is thus enforced *only* in the server/daemon. The client and server currently communicate using twisted.protocol.amp, see -[AMP](https://amp-protocol.net/) which is a very clean asynchronous messaging protocol, +[AMP](https://amp-protocol.net/), and the specification of the communication between the client and server is isolated to [this](https://github.com/AdamISZ/joinmarket-clientserver/blob/master/jmbase/commands.py) module. +Currently the messaging layer of Joinmarket is IRC-only (but easily extensible, see [here](https://github.com/JoinMarket-Org/joinmarket/issues/650). +The IRC layer is also implemented here using Twisted, reducing the complexity required with threading. -The server is currently implemented as a daemon (see `scripts/joinmarketd.py`), in future -it may be convenient to create the option to run it within the same process as the client. +The "server" is just a daemon service that can be run as a separate process (see `scripts/joinmarketd.py`), or for convenience in the same process (the default for command line scripts). +To install, follow the instructions in INSTALL.md. -####Installation on Linux +Instructions for running command line scripts are in scripts/README.md. -This is a WIP. - -To install everything (client and server), install these packages: - -sudo apt-get install python-dev python-pip git build-essential -automake pkg-config libtool libffi-dev libssl-dev - -(+ libsodium-dev if you can find it, else build after) - -(to build libsodium after): - - git clone git://github.com/jedisct1/libsodium.git - cd libsodium - git checkout tags/1.0.4 - ./autogen.sh - ./configure - make check - sudo make install - cd .. - -Then: - - sudo pip install virtualenv - mkdir jmvenv - cd jmvenv; source bin/activate; cd .. - -Install this repo in the virtualenv: - - git clone https://github.com/AdamISZ/joinmarket-clientserver - cd joinmarket-clientserver - -Next, you can install in 3 different modes: - -1. For the "backend", a daemon, install: - - `python setupall.py --daemon` - - Then, you can run the daemon with `cd scripts; python joinmarketd.py ` - -2. For the client code, using joinmarket's own bitcoin library on the command line: - - `python setupall.py --client-bitcoin` - -If you have installed this "full" version of the client, you can use it with the -command line scripts as explained in the [scripts README](https://github.com/AdamISZ/joinmarket-clientserver/tree/master/scripts). - -3. For the client code, using another bitcoin backend library (currently only Electrum -supported, see https://github.com/AdamISZ/electrum-joinmarket-plugin for details): - - `python setupall.py --client-only` - - You can then access the library via `import jmclient`. In particular the - jmclient.Taker class must be instantiated. - -#####Test instructions (for developers): - -This is a rough sketch, some more background is found in [JM wiki](https://github.com/Joinmarket-Org/joinmarket/wiki/Testing) - -Make sure to have bitcoind installed. Also need miniircd installed to the root dir: - - git clone https://github.com/Joinmarket-Org/miniircd - -Install the test requirements (still in your virtualenv as mentioned above): - - pip install -r requirements-dev.txt - -Curl is also needed: - - sudo apt-get install curl - -Running the test suite should be done like: - - python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcroot=/path/to/bitcoin/bin/ --btcpwd=123456abcdef --btcconf=/path/to/bitcoin.conf --nirc=2 - -(you'll first want to copy bitcoin.conf in the test/ directory to a place you choose, and -copy the regtest_joinmarket.cfg file from the test/ directory to the root directory, -both files will need minor edits for your btc configuration) +Instructions for developers for testing in TESTING.md. diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 0000000..af15489 --- /dev/null +++ b/TESTING.md @@ -0,0 +1,23 @@ +### Test instructions (for developers): + +This is a rough sketch, some more background is found in [JM wiki](https://github.com/Joinmarket-Org/joinmarket/wiki/Testing) + +Make sure to have bitcoind installed. Also need miniircd installed to the root dir: + + git clone https://github.com/Joinmarket-Org/miniircd + +Install the test requirements (still in your virtualenv as mentioned above): + + pip install -r requirements-dev.txt + +Curl is also needed: + + sudo apt-get install curl + +Running the test suite should be done like: + + python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcroot=/path/to/bitcoin/bin/ --btcpwd=123456abcdef --btcconf=/path/to/bitcoin.conf --nirc=2 + +(you'll first want to copy bitcoin.conf in the test/ directory to a place you choose, and +copy the regtest_joinmarket.cfg file from the test/ directory to the root directory, +both files will need minor edits for your btc configuration). diff --git a/requirements-dev.txt b/requirements-dev.txt index 5fe0533..3e29aca 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,8 +1,8 @@ # matplotlib # numpy pexpect -pytest==2.8.2 -pytest-cov==2.2.1 +pytest==3.0.5 +pytest-cov==2.4.0 python-coveralls mock