Running the Relay with a TLBC-node (with docker)
About this tutorial
All commands in this tutorial should be run from the
The tutorial was tested on Ubuntu 20.04 with Docker 19.03. The steps should work on other Linux versions and Mac, but you'll most probably have to slightly modify some commands.
You need a machine with at least 2GB(preferably 4GB) of RAM. Running this on a machine with less than 2GB of RAM will fail.
The docker/trustlines/tlbc directory in the relay repository contains the files needed to start components of the trustlines protocol (tlbc-node, relay, indexer) via docker-compose. Following these setup instructions will give you a:
- TLBC-Node with OpenEthereum
- Py-eth-index connected to the TLBC-Node
- Relay instance connected to the TLBC-Node
The config by default exposes port 5000 to connect to the relay. It is advised to actually put a proxy (nginx, caddy, apache or traefik) in front of the relay server.
The docker-compose file contains service definitions for the following services:
db: A service running a postgres server. The postgres files will be stored in the
tlbc: A service running a modified OpenEthereum node for the trustlines blockchain. The blockchain data will be stored in the
index: A service running py-eth-index, which synchronizes certain information from OpenEthereum into the postgres database.
relay: The relay server itself.
To find the location of the volumes on the system you can run:
This will list the created volumes. Then you can execute:
This will give you the path to the volume data.
We need to do some initial setup and configuration for the system to work. You
need to provide the
addresses.json file, which should be put in the directory
addresses.json file specifies which currency networks your py-eth-index & relay instance are
going to index. If you want to run your relay only with a set of particular currency networks
adapt the file accordingly.
If you want the Trustlines Blockchain with the official set of currency networks, you can run:
addresses.json file also includes references to the identity related contracts.
#Generate Keys / Use existing key
To run the relay you need an account with TLC to pay for the transactions. If you have one, use your existing keystore file.
If you don't have one, you can generate a new account with the
contract-deploy-tools and fund that account with TLC coins
(through metamask for example)
To generate a new keystore file with the
contract-deploy-tools you need python3 installed on your system (default on Ubuntu)
and pip3. If pip3 is missing on your machine install it with
If python3 and pip3 are installed you can run the following to install the
Once complete generate the
keystore.json file by running:
deploy-tools fails with
Command not found. You'll have to modify your
We also need to store the password in clear text. Please create a file
pass.pwd containing only the password on the first line.
node-config.dist.toml file to
change the unlock address to the address that is specified in your keystore.json.
To view the address in the keystore.json file you could cat the file:
This will print something like this:
Copy the address and add a
0x to it and add it to the node-config.toml.
config.toml. Then if necessary you can modify parameters in the
If you are making modifications to any config files after you've started a docker image you'll have to stop the image, remove it and then start it again for the modifications to be applied.
CONTAINER_ID is the ID of the container when you run
docker ps. The
SERVICE_NAME is the name of the service you
want to start as specified in the docker-compose.yaml file.
#Setup Initial Database
We need to set up the database and import the ABIs for the index service by running the following commands:
After that, you can start the system with
docker-compose up -d,
though you have to wait for the blockchain node to sync with the
trustlines blockchain in order to have a fully functioning system.
The account address that you've set up above will have to pay for transactions. Please fund it with enough coins.
#Test the Installation
Please try to run the following command:
It should print the relay version running on the server.
A short list with helpful commands.
#Printing all running docker containers
#Stopping all running containers
-q prints only the running container ids in a list form.
#Removing all containers
a flag stands for all containers, not just the running ones.
#Printing docker logs
-f flag stands for follow. Basically you won't just see the log, but the screen will update when new logs arrive.
--tail 500 specifies to just print the last 500 lines. If you don't provide the
tail argument depending on how long
the container has been running you can wait a lot of time till all the logs print on your screen.
Setup a reverse Proxy and prevent requests on port 5000 to connect directly to the relay. A good and easy proxy to install is caddy.