Skip to content

Node server for Reflector, decentralized Stellar price feed oracle

License

Notifications You must be signed in to change notification settings

AhaLabs/reflector-node

 
 

Repository files navigation

@reflector/reflector-node

Node server for Reflector, decentralized Stellar price feed oracle

Check architecture and general concepts overview to learn what's inside and how it works.

Usage | Prerequisites

  1. Build and deploy Reflector Oracle contract.
  2. Create a multisig account to protect the contract. Ensure that each signer corresponds to a distinct Reflector cluster node and master weight is set to 0.

Initial cluster configuration

Prepare app.config.json file and save it to the home directory which will be utilized by Reflector node.

{
  "secret": "S...G",
  "dataSources": {
    "pubnet": {
      "name": "pubnet",
      "type": "db",
      "dbConnection": "postgres://stellar:@{server_ip_address}:{server_port}/stellar-core",
      "sorobanRpc": ["https://localhost:8003/", "https://soroban-rpc.mainnet.stellar.gateway.fm/"],
    },
    "exchanges": {
      "name": "exchanges",
      "type": "api"
    }
  },
  "dbSyncDelay": 15,
  "port": 30447
}

Where:

  • secret - the secret key of the node
  • dataSources - price data sources cofigurations
  • dataSources.exchanges.proxy - [optional] proxy configuration for the data source (connectionString - array of socks5 proxy URLs).
  • dbSyncDelay - [optional] delay in seconds for database synchronization (should be identical for all nodes in the cluster)
  • port - [optional] custom TCP port for inbound connections

If you are joining the existing cluster, ask other node operators to share their basic config params, then override secret and data sources configuration parameters.


Usage | Docker image (for node operators)

Docker configurations to run Reflector node Docker image.

Prerequisites:

  • Docker

Running Docker container

Example startup script:

docker run -it -d \
    -p 30347:30347 \
    -v "REFLECTOR_WORKDIR:/reflector-node/app/home" \
    --name=reflector-node \
    reflectornet/reflector-node:latest
  • REFLECTOR_WORKDIR - path to the working directory where Reflector will store config and logs

If you want to use Stellar Docker image as DB source, you can use the following command:

docker run -it -d \
    -e POSTGRES_PASSWORD=123456 \
    -p 5432:5432 \
    -v "STELLAR_WORKDIR:/opt/stellar" \
    --name stellar \
    stellar/quickstart:soroban-dev \
    --testnet
  • POSTGRES_PASSWORD - password for the PostgreSQL database
  • STELLAR_WORKDIR - path to the working directory where Stellar will store data
  • 5432 - port of the local PostgreSQL database

Note: You need to set dbConnection in app.config.json to postgres://stellar:[email protected]:5432/stellar-core where 123456 is the password for the PostgreSQL database.

Default ports

  • 30347: WebSocket port for inter-cluster communication

Volumes

  • Reflector working directory, e.g. REFLECTOR_WORKDIR:/reflector-node/app/home

Updating node

  1. Pull the latest docker image from Docker Hub
    docker pull reflectornet/reflector-node:latest
  2. Stop current node container
    docker stop {container_id_or_name}
  3. Remove current container
    docker rm {container_id_or_name}
  4. Start new container
    Use the same startup command for the updated container (general startup command format is described above)

Usage | Standalone (for node developers)

Prerequisites:

  • NodeJS 18+
  1. Checkout this repository
    git checkout [email protected]:reflector-network/reflector-node.git
  2. Install dependencies
    npm i
  3. Start Reflector node
    npm run start

Admin Dashboard

Admin Dashboard is a GUI that simplifies common administrative tasks, monitoring, and management of Reflector nodes.
Check admin guide for a short 101 course on node administration.

About

Node server for Reflector, decentralized Stellar price feed oracle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.1%
  • Other 0.9%