Integrate a new Blockchain/API

If you miss any Blockchain, we invite you to integrate it yourself and make a PR with the integration.

To do so, follow this tutorial.

Create a Dockerfile

First of all, you need to create a Dockerfile with the blockchain node. In case there is already an official, native node, you do not need to perform this step.

Dockerfiles are inside the packages directory. Each required service will implement a package in this directory.

Create a Docker-compose

The entire node architecture is routed through network-separated docker-composes in the docker-compose directory. These docker-composes are used to define the configuration of all the necessary containers on the node.

Adding a token configuration in the Connector

First, you need to create a package with the following structure in the Connector folder:

/Connector/
    /{TOKEN}/
        /rpcschemas/
            config.json
        __init.py__
        apirpc.py
        config.py
        constants.py
        handler.py
        utils.py

You have to replace {TOKEN} with the token symbol you are testing in lower case

  • __init.py__: import the necessary files

  • apirpc.py: Wrapper API implementation

  • config.py: Wrapper API configuration. It contains a class with the necessary variables.

  • constants.py: Constants file

  • handler.py: Admin API implementation for the token

  • utils.py: Some useful methods

To maintain uniformity in the code, try to follow the standard methods already implemented in apirpc.py.

Adding the Wrapper API definition

Inside the Connector folder, there is a file called availableCurrencies.json. This file contains the definition of each one of the Wrapper APIs.

The availableCurrencies.json file defines all the information necessary to raise the API corresponding to a currency.

In order to add a Wrapper API you need to define the new Wrapper API here. Here is a template you can use:

[
  {
    "name": "${CURRENCY}",
    "token": "${TOKEN}",
    "networks": {
      "${NETWORK_1}": {
        "services": ["${DOCKER_COMPOSE_SERVICE_1}", "DOCKER_COMPOSE_SERVICE_2", ...],
        "dockerComposePath": "${PATH_TO_DOCKER-COMPOSE}",
        "configurable": [
          "${CONFIGURABLE_ENDPOINT_1}",
          "${CONFIGURABLE_ENDPOINT_2}",
          ...
        ]
      },
      "${NETWORK_2}": {
        "services": ["${DOCKER_COMPOSE_SERVICE_1}", "DOCKER_COMPOSE_SERVICE_2", ...],
        "dockerComposePath": "${PATH_TO_DOCKER-COMPOSE}",
        "configurable": [
          "${CONFIGURABLE_ENDPOINT_1}",
          "${CONFIGURABLE_ENDPOINT_2}",
          ...
        ]
      }
      ... MORE NETWORKS HERE ...
    }
  },
  ... MORE WRAPPER API DEFINITIONS HERE ...
]

Adding a default configuration

Optionally, you can create a default configuration so that you do not have to enter the configuration each time you start the node.

Go to scripts folder and create a new default configuration for your Blockchain inside the defaultConfig.json file:

[
  {
    "token": "${TOKEN}",
    "networks": {
      "${NETWORK_1}": {
        "config": {
          "${CONFIGURABLE_ENDPOINT_1}": "${ENDPOINT_1}",
          "${CONFIGURABLE_ENDPOINT_2}": "${ENDPOINT_2}"
        }
      },
      "${NETWORK_2}": {
        "config": {
          "${CONFIGURABLE_ENDPOINT_1}": "${ENDPOINT_1}",
          "${CONFIGURABLE_ENDPOINT_2}": "${ENDPOINT_2}"
        }
      }
    }
  },

Last updated