Default implementation (manual)
The client off-chain module is deployed via Docker image, implemented by the Asterizm team.
To deploy the client off-chain module, you must first install the Docker, which installs together with Docker Compose.
The official installation guide: https://docs.docker.com/engine/install/
The image is a node scanner written on GO. It is publicly available at https://hub.docker.com/.
Download command (in the server console):
After installing the Docker, please follow these steps:
Create a
docker-compose.yml
to automate the deployment of the server;Set up the server environment;
Start containers, and place migrations into the database;
Add the private keys of contract owners via
asterizm-console
or Fireblocks integration.
1. Docker-compose.yml
This file is used to automate the deployment of the client's server using Docker Compose.
For example, let's configure the service so that we can send transfers between Ethereum (EVM) and Everscale (TVM) networks.
Create a base directory on the server and navigate to it. Let's call it
/opt/asterizm
- in the terminal runmkdir /opt/asterizm && cd /opt/asterizm
(assign current user permissions to the directory withchown {username} /opt/asterizm
command)Next, you need to create directories for the system containers to work, run the following commands:
mkdir -p docker-data/db mkdir -p docker-data/config
With these commands, the structure for the Docker containers to work will be created.Now let's create
docker-compose.yml
-touch /opt/asterizm/docker-compose.yml
:
In this file, you have to specify the database user name, as well as the database passwords.
After creating this file, you can proceed to the next step of configuring the client off-chain module.
2. Setting up the server environment
For the most part, installing Docker is the main step in setting up the environment, but you should do a few more things to work comfortably with the client's off-chain module.
Create a basic server configuration file: touch docker-data/config/Project.yml
:
Important: Please note that the configuration format for EVM and TVM networks is slightly different: in TVM networks the OwnerPublicKey parameter is added
Supported encryption methods (CipherMethod parameter): AES-{128, 192, 256}-{CBC, OFB, CFB, CTR}. Recommended: AES-256-CBC.
In order for the off-chain module to properly extract the payload received from the contract, it is necessary to specify what types of data are stored in it. For this purpose, the PayloadStruct parameter is used. You need to specify what types of parameters are stored in your contract. System-supported parameters: bool, string, bytes, int (all sizes), uint (all sizes).
You can configure the logging level of the client off-chain module. This parameter affects the completeness of the information in the module's logs. Logs are written to stdout, so you can see them in docker container logs (docker logs -f {container-name}
). There are 4 levels:
INFO (logs minimal required information, standard actions),
WARN (includes INFO logging level, adds a detailed log of some exceptions),
ERROR (includes WARN logging level, adds full system error log),
DEBUG (includes ERROR logging level, adds a log of most system actions, used for error detection and debugging, not recommended for product deployment).
Default logging level (if the configuration parameter is not set) is INFO.
3. Running Docker containers
To start the client's server containers, you need to execute a single command (note the path to the docker-compose.yml
file):
docker compose -f /opt/asterizm/docker-compose.yml up -d
After running this command, the Docker containers of the client off-chain module will be up and running.
The next step is to create a database and run migrations and fixtures.
To do this, run the following commands:
docker exec asterizm-db psql -U database-user -c "CREATE DATABASE client_server"
- This command will create a database in the asterizm-db container (note the database user name, it was specified indocker-compose.yml
);docker exec asterizm-console /app/main migrations/up
- this command extracts migrations to the database;docker exec asterizm-console /app/main db/seed
- this command extracts fixtures onto the database. Important: you can add-test
flag for filling database with testnet networks.
After executing these commands, the client off-chain module's database is ready to work.
It is necessary to restart the client's server containers. To do that, please use this command: docker compose -f /opt/asterizm/docker-compose.yml restart
4.a. Managing system owners
To enable operation, it is necessary to add data about contract owners to the system. This can be done using the following console command:
This command adds a contract owner of a specific network. It accepts the following parameters:
network-symbol - mandatory parameter, the network symbol (e.g., ETH, POL, etc.)
owner-private-key - mandatory parameter, the private key of the owner
owner-public-key - optional parameter, the public key of the owner (used in TVM systems only)
address-type - owner address type (used in TON systems only), available values: v3r1, v3r2, highloadv3, v4r1, v4r2, v5r1
To display a list of owners already added to the system, execute the following command:
To display a list of owners already added to the system, you can execute the following command:
network-symbol - optional parameter, the network symbol (e.g., ETH, POL, etc.)
Added owners cannot be deleted; they can only be deactivated. This is done with the following command:
This command deactivates a previously added owner. The command accepts the following parameters:
owner-id - mandatory parameter, the ID of the owner, which can be obtained by executing the console method for listing owners
Deactivated owners can be reactivated. This is achieved by executing the following console command:
This command activates a previously deactivated owner. The command accepts the following parameters:
owner-id - mandatory parameter, the ID of the owner, which can be obtained by executing the console method for listing owners.
4.b. Fireblocks integration
For the successful operation of the Asterizm Protocol system, it is essential to manage the private keys of contract owners. In certain cases, this may pose a security risk due to potential access by unauthorized parties, such as system developers.
To address this issue we integrated Fireblocks. Through this system, the owner of the client server can store private keys within it, configuring specific permissions for each key. This eliminates the need to store private keys of owners on the client server.
To integrate Fireblocks, registration in the system by obtaining an ApiKey and RSA file is required. These details must be added to the configuration file of the client server (Project.yml
), specifically in the network section:
This configuration block needs to be added to the configuration of each network that will utilize owners stored in the Fireblocks system.
Important! If the Asterizm Protocol detects the Fireblocks configuration file, along with owners added through the console command, the system will specifically use the Fireblocks owners.
After setting up the configuration file, it is necessary to restart the system containers (if they were previously running) with the following command: docker compose -f /opt/asterizm/docker-compose.yml restart
Last updated