Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 319418c

Browse files
authored
Merge pull request #239 from talaia-labs/fixes-0.1.1
Fixes for release v0.1.1
2 parents 7cfa294 + 9e34c10 commit 319418c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+973
-393
lines changed

CONTRIBUTING.md

+7
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,10 @@ We use [pytest](https://docs.pytest.org/en/latest/) to build and run tests. Test
104104

105105
We require that all commits to be merge into master are signed. You can enable commit signing on GitHub by following [Signing commits](https://help.github.com/en/github/authenticating-to-github/signing-commits).
106106

107+
## Installing the development client
108+
109+
You can install the development client for easier testing by setting the development flag (DEV=1) when installing `teos`.
110+
111+
```
112+
DEV=1 python setup.py install
113+
```

DEPENDENCIES.md

+8-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
`teos` has the following system-wide dependencies:
88

9-
- `python3` version 3.6+
9+
- `python3` version 3.7+
1010
- `pip3`
1111
- `openssl` version 1.1+
1212
- `bitcoind`
@@ -58,7 +58,7 @@ And, if it happens to be installed, change the alias to `pip3`, or use `pip3` in
5858

5959
You can get Bitcoin Core from [bitcoin.org](https://bitcoin.org/en/download).
6060

61-
Bitcoin needs to be running with the following options enables:
61+
Bitcoin needs to be running with the following options enabled:
6262

6363
- `zmq` for rawblockhash notifications
6464
- `txindex` to be able to look for non-wallet transactions
@@ -90,7 +90,7 @@ maxtxfee=1
9090

9191
### Installing the Dependencies
9292

93-
`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.
93+
`python3` can 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.
9494

9595
#### Ubuntu
9696

@@ -112,17 +112,10 @@ and for `pip3`:
112112

113113
`pip3` will be installed alongside `python3` in this case.
114114

115-
## Python Dependencies
115+
## Python Dependencies
116116

117-
`teos` has the following dependencies (which can be satisfied by using `pip install -r requirements.txt`):
118-
119-
- `wheel`
120-
- `zmq`
121-
- `flask`
122-
- `cryptography`
123-
- `coincurve`
124-
- `pyzbase32`
125-
- `requests`
126-
- `plyvel`
127-
- `readerwriterlock`
117+
`teos` has several python dependencies that are automatically alongside the it. Should you need to install them manually, you can do so by running:
128118

119+
```
120+
pip install -r requirements.txt`
121+
```

INSTALL.md

+14-20
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@
22

33
`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.
44

5-
There are two ways of running `teos`: running it as a module or adding the library to the `PYTHONPATH` env variable.
5+
There are two ways of installing `teos`, from source or getting it from PyPi (the Python Package Index).
66

7-
## Running `teos` as a Module
8-
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:
7+
No matter the way you chose, once installed the executables for `teosd` and `teos-cli` will be available in the shell.
98

10-
python -m teos.teosd -h
11-
12-
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`
9+
## Installing from source
1310

14-
## Modifying `PYTHONPATH`
15-
**Alternatively**, you can add `teos` to your `PYTHONPATH` by running:
11+
`teos` can be installed from source by running:
1612

17-
export PYTHONPATH=$PYTHONPATH:<absolute_path_to_teos_parent>
18-
19-
For example, for user alice running a UNIX system and having `python-teos` in her home folder, she would run:
20-
21-
export PYTHONPATH=$PYTHONPATH:/home/alice/python-teos/
22-
23-
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:
13+
```
14+
python setup.py install
15+
```
2416

25-
echo 'export PYTHONPATH=$PYTHONPATH:<absolute_path_to_teos_parent>' >> ~/.bashrc
26-
27-
Once the `PYTHONPATH` is set, you should be able to run `teos` straightaway. Try it by running:
17+
## Installing via PyPi
18+
19+
`teos` can be installed from PyPi bu running:
20+
21+
```
22+
pip install teos
23+
```
2824

29-
cd <absolute_path_to_cli_parent>/teos
30-
python teosd.py -h
3125

3226
## Modify Configuration Parameters
3327
If you'd like to modify some of the configuration defaults (such as the bitcoind rpcuser and password) you can do so in the config file located at:

README.md

+28-19
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ Currently working on updating the software to match [BOLT13 rev1](https://github
66

77
The Eye of Satoshi is a Lightning watchtower compliant with [BOLT13](https://github.com/sr-gi/bolt13), written in Python 3.
88

9-
`teos` consists in four main modules:
9+
`python-teos` consists in four main modules:
1010

11-
- `teos`: including the tower's main functionality (server-side)
12-
- `cli`: including a reference command line interface (client-side)
13-
- `common`: including shared functionality between `teos` and `cli`.
11+
- `teos`: including the tower's main functionality (server-side).
12+
- `cli`: including a reference command line interface.
13+
- `common`: including shared functionality between server and client side (useful to build a client).
1414
- `watchtower-plugin`: including a watchtower client plugin for c-lightning.
1515

16-
Additionally, tests for every module can be found at `tests`.
16+
Additionally `contrib` contains tools that are external to the tower (currently `teos_client`, an example Python client for the tower).
17+
18+
Tests for every module can be found at `tests`.
1719

1820
## Dependencies
21+
1922
Refer to [DEPENDENCIES.md](DEPENDENCIES.md)
2023

2124
## Installation
@@ -27,14 +30,12 @@ Refer to [INSTALL.md](INSTALL.md)
2730
Make sure bitcoind is running before running TEOS (it will fail at startup if it cannot connect to bitcoind). You can find
2831
[here](DEPENDENCIES.md#installing-bitcoind) a sample config file.
2932

30-
Before you can run TEOS, you need to follow a few more configuration steps.
31-
3233
### Starting the TEOS daemon 👁
3334

34-
You can run `teos` by running `teosd.py` under `teos`:
35+
Once installed, you can start the tower by running:
3536

3637
```
37-
python -m teos.teosd
38+
teosd
3839
```
3940

4041
### Configuration file and command line parameters
@@ -49,14 +50,14 @@ To change the configuration defaults you can:
4950

5051
and / or
5152

52-
- Add some global options when running the daemon (run `teosd.py -h` for more info).
53+
- Add some global options when running the daemon (run `teosd -h` for more info).
5354

5455
### Passing command line options to `teosd`
5556

5657
Some configuration options can also be passed as options when running `teosd`. We can, for instance, pick the network as follows:
5758

5859
```
59-
python -m teos.teosd --btcnetwork=regtest
60+
teosd --btcnetwork=regtest
6061
```
6162

6263
### Running TEOS in another network
@@ -84,7 +85,7 @@ btc_network = regtest
8485
```
8586

8687
## Running `teos` in a docker container
87-
A `teos` image can be built from the Dockerfile located in `/docker`. You can create the image by running:
88+
A `teos` image can be built from the Dockerfile located in `docker`. You can create the image by running:
8889

8990
cd python-teos
9091
docker build -f docker/Dockerfile -t teos .
@@ -98,6 +99,8 @@ Notice that ENV variables are optional, if unset the corresponding default setti
9899
```
99100
- API_BIND=<teos_api_hostname>
100101
- API_PORT=<teos_api_port>
102+
- RPC_BIND=<teos_rpc_hostname>
103+
- RPC_PORT=<teos_rpc_port>
101104
- BTC_NETWORK=<btc_network>
102105
- BTC_RPC_CONNECT=<btc_node_hostname>
103106
- BTC_RPC_PORT=<btc_node_port>
@@ -161,17 +164,23 @@ Otherwise it will bind to `localost` and we won't be able to send requests to th
161164

162165
## Interacting with a TEOS Instance
163166

164-
You can interact with a `teos` instance (either run by yourself or someone else) by using `teos_cli` under `cli`.
167+
You can interact with a `teos` instance (either run by yourself or someone else) by using `teos-cli` under `teos/cli`. This is an admin tool that has privileged access to the watchtower, and it should therefore only be used within a trusted environment (for example, the same machine).
168+
169+
While `teos-cli` works independently of `teos`, it shares the same configuration file by default, of which it only uses a subset of its settings. The folder can be changed using the `--datadir` command line argument, if desired.
170+
171+
For help on the available arguments and commands, you can run:
172+
173+
```
174+
teos-cli -h
175+
```
165176

166-
Since `teos_cli` works independently of `teos`, it uses a different configuration. The defaults can be found at [cli/\_\_init\_\_.py](cli/__init__.py). The same approach as with `teosd` is followed:
177+
## Interacting with TEOS as a client
167178

168-
- A config file (`~/.teos_cli/teos_cli.conf`) can be set to change the defaults.
169-
- Some options ca also be changed via command line.
170-
- The configuration file template can be found at [cli/template.conf](cli/template.conf))
179+
The [contrib/client](contrib/client) folder contains an example Python client that can interact with the watchtower in order to register, add appointments and later retrieve them.
171180

172-
`teos_cli` needs an independent set of keys that are also automatically generated in the same way as `teos`.
181+
See [here](contrib/client) for more information on how to use the client.
173182

174-
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.
183+
Note that while the client is a simple way to interact with `teos`, ideally its functionality should be part of your wallet or lightning node. `teos_client` can be used as an example for how to send data to a [BOLT13](https://github.com/sr-gi/bolt13) compliant watchtower.
175184

176185
## Contributing
177186
Refer to [CONTRIBUTING.md](CONTRIBUTING.md)

common/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version_info = (0, 1, 1)
2+
__version__ = ".".join([str(v) for v in version_info])

common/constants.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import logging.handlers
2-
31
# Locator
42
LOCATOR_LEN_HEX = 32
53
LOCATOR_LEN_BYTES = LOCATOR_LEN_HEX // 2
@@ -20,6 +18,3 @@
2018

2119
# Temporary constants, may be changed
2220
ENCRYPTED_BLOB_MAX_SIZE_HEX = 2 * 2048
23-
24-
# The port used for the tcp logging service is 9020
25-
TCP_LOGGING_PORT = logging.handlers.DEFAULT_TCP_LOGGING_PORT

common/errors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
APPOINTMENT_FIELD_TOO_SMALL = -5
77
APPOINTMENT_FIELD_TOO_BIG = -6
88
APPOINTMENT_WRONG_FIELD = -7
9-
APPOINTMENT_INVALID_SIGNATURE_OR_INSUFFICIENT_SLOTS = -8
9+
APPOINTMENT_INVALID_SIGNATURE_OR_SUBSCRIPTION_ERROR = -8
1010
APPOINTMENT_ALREADY_TRIGGERED = -9
1111

1212
# Registration errors [-33, -64]

common/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cryptography==2.8
1+
cryptography>=2.8
22
coincurve
33
pyzbase32
44
plyvel

contrib/client/DEPENDENCIES.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Dependencies
22

3-
`teos_client` has both system-wide and Python dependencies. This document walks you through how to satisfy them.
3+
`teos-client` has both system-wide and Python dependencies. This document walks you through how to satisfy them.
44

55
## System-wide dependencies
66

7-
`teos_client` has the following system-wide dependencies:
7+
`teos-client` has the following system-wide dependencies:
88

9-
- `python3` version 3.6+
9+
- `python3` version 3.7+
1010
- `pip3`
1111
- `openssl` version 1.1+
1212

@@ -28,7 +28,7 @@ It is also likely that, if `python3` is installed in our system, the `python` al
2828

2929
python3 --version
3030

31-
If `python3` is installed but the `python` alias is not set to it, we should either set it, or use `python3` to run `teos_client`.
31+
If `python3` is installed but the `python` alias is not set to it, we should either set it, or use `python3` to run `teos-client`.
3232

3333
Regarding `pip`, we can check what version is installed in our system (if any) by running:
3434

@@ -51,7 +51,7 @@ And, if it happens to be installed, change the alias to `pip3`, or use `pip3` in
5151

5252
### Installing the dependencies
5353

54-
`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.
54+
`python3` can 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.
5555

5656
#### Ubuntu
5757

@@ -73,10 +73,10 @@ and for `pip3`:
7373

7474
`pip3` will be installed alongside `python3` in this case.
7575

76-
## Python dependencies
76+
## Python Dependencies
7777

78-
`teos_client` has the following dependencies (which can be satisfied by using `pip install -r requirements.txt`):
78+
`teos-client` has several python dependencies that are automatically alongside the it. Should you need to install them manually, you can do so by running:
7979

80-
- `cryptography`
81-
- `requests`
82-
- `structlog`
80+
```
81+
pip install -r requirements.txt`
82+
```

contrib/client/INSTALL.md

+8-33
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,13 @@
11
# Install
22

3-
`teos_client` 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.
3+
`teos-client` gets installed alongside `teos` as long as you set the development flag when installing `teos`:
44

5-
There are two ways of running `teos_client`: running it as a module or adding the library to the PYTHONPATH env variable.
5+
```
6+
DEV=1 python setup.py install
7+
```
68

7-
## Running `teos_client` as a module
8-
The **easiest** way to run `teos_client` is as a module. To do so you need to use `python -m`. From the root directory of `python-teos`, run:
9+
You can also get a standalone client from pip:
910

10-
python -m contrib.client.teos_client -h
11-
12-
Notice that if you run `teos_client` as a module, you'll need to replace all the calls from `python teos_client.py <argument>` to `python -m contrib.client.teos_client <argument>`
13-
14-
## Modifying `PYTHONPATH`
15-
**Alternatively**, you can add `teos_client` to your `PYTHONPATH` by running:
16-
17-
export PYTHONPATH=$PYTHONPATH:<absolute_path_to_python-teos_root>
18-
19-
For example, for user alice running a UNIX system and having `python-teos` in her home folder, she would run:
20-
21-
export PYTHONPATH=$PYTHONPATH:/home/alice/python-teos/
22-
23-
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:
24-
25-
echo 'export PYTHONPATH=$PYTHONPATH:<absolute_path_to_python-teos_root>' >> ~/.bashrc
26-
27-
Once the `PYTHONPATH` is set, you should be able to run `teos_client` straightaway. Try it by running:
28-
29-
cd <absolute_path_to_python-teos_root>/contrib/client
30-
python teos_client.py -h
31-
32-
33-
## Modify configuration parameters
34-
If you'd like to modify some of the configuration defaults (such as the user directory, where the logs and appointment receipts will be stored) you can do so in the config file located at:
35-
36-
<data_dir>/.teos_client/teos_client.conf
37-
38-
`<data_dir>` defaults to your home directory (`~`).
11+
```
12+
pip install teos-client
13+
```

0 commit comments

Comments
 (0)