diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b2abd3a..2a13c1b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ if rcode == 0: rcode, message = self.check_end_time(end_time, start_time, block_height) ``` -## Dev requirements +## Dev Requirements In order to contrubite you will need to install additional dependencies. They can be found at `requirements-dev.txt`. Install them by running: pip install -r requirements-dev.txt diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index de59c84..4f9e611 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -2,7 +2,7 @@ `teos` has both system-wide and Python dependencies. This document walks you through how to satisfy them. -## System-wide dependencies +## System-wide Dependencies `teos` has the following system-wide dependencies: @@ -84,7 +84,7 @@ zmqpubhashtx=tcp://127.0.0.1:28333 zmqpubrawtx=tcp://127.0.0.1:28333 ``` -### Installing the dependencies +### Installing the Dependencies `python3` ca be downloaded from the [Python official website](https://www.python.org/downloads/) or installed using a package manager, depending on your distribution. Examples for both UNIX-like and OSX systems are provided. @@ -108,7 +108,7 @@ and for `pip3`: `pip3` will be installed alongside `python3` in this case. -## Python dependencies +## Python Dependencies `teos` has the following dependencies (which can be satisfied by using `pip install -r requirements.txt`): diff --git a/INSTALL.md b/INSTALL.md index e615ac3..26cdad5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,34 +2,29 @@ `teos` has some dependencies that can be satisfied by following [DEPENDENCIES.md](DEPENDENCIES.md). If your system already satisfies the dependencies, you can skip that part. -There are two ways of running `teos`: adding the library to the `PYTHONPATH` env variable, or running it as a module. +There are two ways of running `teos`: running it as a module or adding the library to the `PYTHONPATH` env variable. -## Modifying `PYTHONPATH` -In order to run `teos`, you should set your `PYTHONPATH` env variable to include the teos parent folder. You can do so by running: - - export PYTHONPATH=$PYTHONPATH: - -For example, for user alice running a UNIX system and having `teos` in her home folder, she would run: - - export PYTHONPATH=$PYTHONPATH:/home/alice/ - -You should also include the command in your `.bashrc` to avoid having to run it every time you open a new terminal. You can do it by running: - - echo 'export PYTHONPATH=$PYTHONPATH:' >> ~/.bashrc - -Once the `PYTHONPATH` is set, you should be able to run `teos` straightaway. Try it by running: - - cd /teos/ - python teosd.py - -## Running `teos` as a module -Python code can be also run as a module, to do so you need to use `python -m`. From the teos parent directory run: +## Running `teos` as a Module +The easiest way to run `teos` is as a module. To do so you need to use `python -m`. From the teos parent directory run: python -m teos.teosd Notice that if you run `teos` as a module, you'll need to replace all the calls from `python teosd.py` to `python -m teos.teosd` -## Modify configuration parameters +## Modifying `PYTHONPATH` +Alternatively, you can add `teos` to your `PYTHONPATH`. You can do so by running: + + export PYTHONPATH=$PYTHONPATH: + +For example, for user alice running a UNIX system and having `python-teos` in her home folder, she would run: + + export PYTHONPATH=$PYTHONPATH:/home/alice/python-teos/ + +You should also include the command in your `.bashrc` to avoid having to run it every time you open a new terminal. You can do it by running: + + echo 'export PYTHONPATH=$PYTHONPATH:' >> ~/.bashrc + +## Modify Configuration Parameters If you'd like to modify some of the configuration defaults (such as the user directory, where the logs will be stored) you can do so in the config file located at: /teos/conf.py diff --git a/README.md b/README.md index 051cffa..60942b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## State of the code +## State of the Code Currently working on updating the software to match [BOLT13 rev1](https://github.com/sr-gi/bolt13). @@ -6,7 +6,7 @@ Currently working on updating the software to match [BOLT13 rev1](https://github The Eye of Satoshi is a Lightning watchtower compliant with [BOLT13](https://github.com/sr-gi/bolt13), written in Python 3. -TEOS consists in three main modules: +`teos` consists in three main modules: - `teos`: including the tower's main functionality (server-side) - `cli`: including a reference command line interface (client-side) @@ -24,19 +24,41 @@ BTC_NETWORK = "regtest" ### Running TEOS You can run `teos` buy running `teosd.py` under `teos`. -To run `teos` you need a set of keys (to sign appointments) stored in your data directory. You can use `generate_keys.py` to generate those keys. +`teos` comes with a default configuration file (check [conf.py](teos/conf.py)). The configuration file include, amongst others, where your data folder is placed, what network it connects to, etc. -`teos` comes with a default configuration file (check [conf.py](teos/conf.py)). The configuration file include, amost others, where your data folder is placed, what network it connects to, etc. +To run `teos` you need a set of keys (to sign appointments) stored in your data directory. You can follow [generate keys](#generate-keys) to generate them. -### Interacting with a TEOS instance +### Interacting with a TEOS Instance You can interact with a `teos` instance (either run by yourself or someone else) by using `teos_cli` under `cli`. Since `teos_cli` works independently of `teos`, it uses a different configuration file (check [cli/conf.py](cli/conf.py)). -`teos_cli` also needs an independent set of keys (that can be generated using `generate_keys.py`) as well as the public key of the tower instance (`teos_pk.der`). The same data directory can be used for both if you are running things locally. +`teos_cli` also needs an independent set of keys (that can be generated following [generate keys](#generate-keys)) as well as the public key of the tower instance (`teos_pk.der`). The same data directory can be used for both if you are running things locally. Notice that `teos_cli` is a simple way to interact with `teos`, but ideally that should be part of your wallet functionality (therefore why they are independent entities). `teos_cli` can be used as an example for how to send data to a [BOLT13](https://github.com/sr-gi/bolt13) compliant watchtower. - + +### Generate Keys + +In order to generate a pair of keys for `teos` (or `teos_cli`) you can use `generate_keys.py`. + +The script generates a set of keys (`teos_sk.der` and `teos_pk.der`) in the current directory, by default. The name and output directory can be changed using `-n` and `-d` respectively. + +The following command will generate a set of keys for `teos` and store it in the default data directory (`~/.teos`): +``` +python generate_keys.py -d ~./teos +``` + +The following command will generate a set of keys for `teos_cli` and store it in the default data directory (`~/.teos_cli`): +``` +python generate_keys.py -n cli -d ~./teos_cli +``` + +Notice that `cli` needs a copy of the tower public key, so you should make a copy of that if you're using different data directories (as in this example): + +``` +cp ~./teos/teos_pk.der ~./teos_cli/teos_pk.der +``` + ## Dependencies Refer to [DEPENDENCIES.md](DEPENDENCIES.md)