Welcome to the documentation for Pantos Service Node.
The Pantos Service Node is responsible for initiating cross-chain transfers on behalf of the users. To initiate a cross-chain token transfer, a client has to send a signed request to a service node. To find an appropriate service node, the client can query the PantosHub contract of the source blockchain. To enable this, each service node registers itself at the PantosHub contract of each source blockchain supported by the service node.
The Pantos Service Node is split into two applications:
The web server application is responsible for the following:
- Serving signed (by the service node) bids.
- Accepting signed (by the user) transfer requests.
The celery application is responsible for the following:
- Updating the bids later served to the user through the web application.
- Submitting the signed transfer requests to the source blockchain.
We provide two ways to modify the app configuration, either through service-node-config.env
or service-node-config.yml
. We recommend using the .env
file, as the .yml
file is overwritten on every install.
While using the .env
file you need to be aware that any fields containing certain special characters need to be wrapped around single quotes (e.g. ETHEREUM_PRIVATE_KEY_PASSWORD='12$$#%R^'
).
The application will complain on startup should the configuration be incorrect.
There are two ways to install the apps using pre-built packages:
We provide Debian packages alongside every release, you can find them in the releases tab. Further information on how to use the service node packages can be found here.
We have a PPA hosted on GitHub, which can be accessed as follows:
curl -s --compressed "https://pantos-io.github.io/servicenode/KEY.gpg" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/servicenode.gpg >/dev/null
sudo curl -s --compressed -o /etc/apt/sources.list.d/pantos-servicenode.list "https://pantos-io.github.io/servicenode/pantos-servicenode.list"
sudo apt update
sudo apt install pantos-service-node
We also distribute docker images in DockerHub with each release. These are made available under the pantosio project as either app or worker.
You can run a local setup with docker by doing the following steps:
- Run
make docker
on theethereum-contracts
project - The variables
DB_URL
,CELERY_BACKEND
andCELERY_BROKER
are already defined in thedocker-compose.yml
- Modify the
docker.env
file to match your current setup - Ensure you have a
signer_key
file located in the same directory. If you don't, you can create one withmake signer-key
- Run
make docker
The production setup is slightly different, for convenience we provide a separate .env
file and make
method.
- The variables
DB_URL
,CELERY_BACKEND
andCELERY_BROKER
are already defined in thedocker-compose.yml
- Modify the
.env
file (notdocker.env
) to match your current setup - Ensure you have a
signer_key
file located in the same directory. If you don't, you can create one withmake signer-key
- Run
make docker-prod
Please note that you may need to add a load balancer or another webserver in front of this setup should you want to host this setup under a specific domain.
If you're hosting this on a cloud provider (AWS, GCP, Azure or alike), these are normally provided. You just need to point the load balancer to the port exposed by the app, 8080
, and configure the rest accordingly.
We distribute the package in pypi under the following project and https://pypi.org/project/pantos-service-node/. You can install it to your project by using pip install pantos-service-node
.
Please make sure that your environment meets the following requirements:
The Pantos Service Node supports Python 3.10 or higher. Ensure that you have the correct Python version installed before the installation steps. You can download the latest version of Python from the official Python website.
The Pantos Service Node has been tested with the library versions specified in poetry.lock.
Poetry is our tool of choice for dependency management and packaging.
Installing: https://python-poetry.org/docs/#installing-with-the-official-installer or https://python-poetry.org/docs/#installing-with-pipx
By default poetry creates the venv directory under {cache-dir}/virtualenvs
. If you opt for creating the virtualenv inside the project’s root directory, execute the following command:
poetry config virtualenvs.in-project true
Conda is only required to build the Debian package. To install conda, follow the instructions here. Check the installation was correct running conda -version
.
Create the virtual environment and install the dependencies:
poetry install --no-root
In order to run pre-commit before a commit is done, you have to install it:
pre-commit install --hook-type commit-msg -f && pre-commit install
Whenever you try to make a commit, the pre-commit steps are executed.
Run the following command from the repository's root directory:
make code
Launch the PostgreSQL interactive terminal:
sudo -u postgres psql
Create a Service Node user and three databases:
CREATE ROLE "pantos-service-node" WITH LOGIN PASSWORD '<PASSWORD>';
CREATE DATABASE "pantos-service-node" WITH OWNER "pantos-service-node";
CREATE DATABASE "pantos-service-node-celery" WITH OWNER "pantos-service-node";
CREATE DATABASE "pantos-service-node-test" WITH OWNER "pantos-service-node";
Create a Service Node user and virtual host:
sudo rabbitmqctl add_user pantos-service-node <PASSWORD>
sudo rabbitmqctl add_vhost pantos-service-node
sudo rabbitmqctl set_permissions -p pantos-service-node pantos-service-node ".*" ".*" ".*"
For contributions take a look at our code of conduct.