Package: python-teos
State of the CodeCurrently working on updating the software to matchBOLT13 rev1.The Eye of Satoshi (TEOS)The Eye of Satoshi is a Lightning watchtower compliant withBOLT13, written in Python 3.python-teosconsists in four main modules:teos: including the tower's main functionality (server-side).cli: including a reference command line interface.common: including shared functionality between server and client side (useful to build a client).watchtower-plugin: including a watchtower client plugin for c-lightning.Additionallycontribcontains tools that are external to the tower (currentlyteos_client, an example Python client for the tower).Tests for every module can be found attests.DependenciesRefer toDEPENDENCIES.mdInstallationRefer toINSTALL.mdRunning TEOSMake sure bitcoind is running before running TEOS (it will fail at startup if it cannot connect to bitcoind). You can findherea sample config file.Starting the TEOS daemon 👁Once installed, you can start the tower by running:teosdConfiguration file and command line parametersteoscomes with a default configuration that can be found atteos/__init__.py.The configuration includes, amongst others, where your data folder is placed, what network it connects to, etc.To change the configuration defaults you can:Define a configuration file namedteos.conffollowing the template (checkteos/template.conf) and place it in thedata_dir(that defaults to~/.teos/)and / orAdd some global options when running the daemon (runteosd -hfor more info).Passing command line options toteosdSome configuration options can also be passed as options when runningteosd. We can, for instance, pick the network as follows:teosd --btcnetwork=regtestRunning TEOS in another networkBy default,teosruns onmainnet. In order to run it on another network you need to change the network parameter in the configuration file or pass the network parameter as a command line option. Notice that if teos does not find abitcoindnode running in the same network that it is set to run, it will refuse to run.The configuration file option to change the network whereteoswill run isbtc_networkunder thebitcoindsection:[bitcoind]
btc_rpc_user = user
btc_rpc_password = passwd
btc_rpc_connect = localhost
btc_network = mainnetFor regtest, it should look like:[bitcoind]
btc_rpc_user = user
btc_rpc_password = passwd
btc_rpc_connect = localhost
btc_network = regtestRunningteosin a docker containerAteosimage can be built from the Dockerfile located indocker. You can create the image by running:cd python-teos
docker build -f docker/Dockerfile -t teos .Then you can create a container by running:docker run -it -e ENVS teosNotice that ENV variables are optional, if unset the corresponding default setting is used. The following ENVs are available:- API_BIND=<teos_api_hostname>
- API_PORT=<teos_api_port>
- RPC_BIND=<teos_rpc_hostname>
- RPC_PORT=<teos_rpc_port>
- BTC_NETWORK=<btc_network>
- BTC_RPC_CONNECT=<btc_node_hostname>
- BTC_RPC_PORT=<btc_node_port>
- BTC_RPC_USER=<btc_rpc_username>
- BTC_RPC_PASSWORD=<btc_rpc_password>
- BTC_FEED_CONNECT=<btc_zmq_hostname>
- BTC_FEED_PORT=<btc_zmq_port>You may also want to run docker with a volume, so you can have data persistence inteosdatabases and keys.
If so, run:docker volume create teos-dataAnd add the the mount parameter todocker run:--mount source=teos-data,target=/root/.teosIf you are runningteosandbitcoindin the same machine, continue reading for how to create the container based on your OS.bitcoindrunning on the same machine (UNIX)The easiest way to run both together in he same machine using UNIX is to set the container to use the host network.For example, if bothteosandbitcoindare running on default settings, rundocker run --network=host \
  --name teos \
  --mount source=teos-data,target=/root/.teos \
  -e BTC_RPC_USER=<rpc username> \
  -e BTC_RPC_PASSWD=<rpc password> \
  -it teosNotice that you may still need to set your RPC authentication details, since, hopefully, your credentials won't match theteosdefaults.bitcoindrunning on the same machine (OSX or Windows)Docker for OSX and Windows does not allow to use the host network (nor to use thedocker0bridge interface). To workaround this
you can use the specialhost.docker.internaldomain.docker run -p 9814:9814 \
  --name teos \
  --mount source=teos-data,target=/root/.teos \
  -e BTC_RPC_CONNECT=host.docker.internal \
  -e BTC_FEED_CONNECT=host.docker.internal \
  -e BTC_RPC_USER=<rpc username> \
  -e BTC_RPC_PASSWD=<rpc password> \
  -e API_BIND=0.0.0.0 \
  -it teosNotice that we also needed to addAPI_BIND=0.0.0.0to bind the API to all interfaces of the container.
Otherwise it will bind tolocalostand we won't be able to send requests to the tower from the host.Tower id and signing keyteosneeds a pair of keys that will serve as tower id and signing key. The former can be used by users to identify the tower, whereas the latter is used by the tower to sign responses. These keys are automatically generated on the first run, and can be refreshed by runningteoswith the--overwritekeyflag.Interacting with a TEOS InstanceYou can interact with ateosinstance (either run by yourself or someone else) by usingteos-cliunderteos/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).Whileteos-cliworks independently ofteos, 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--datadircommand line argument, if desired.For help on the available arguments and commands, you can run:teos-cli -hInteracting with TEOS as a clientThecontrib/clientfolder contains an example Python client that can interact with the watchtower in order to register, add appointments and later retrieve them.Seeherefor more information on how to use the client.Note that while the client is a simple way to interact withteos, ideally its functionality should be part of your wallet or lightning node.teos_clientcan be used as an example for how to send data to aBOLT13compliant watchtower.ContributingRefer toCONTRIBUTING.md