Skip to content

classic-terra/oracle-feeder

 
 

Repository files navigation

Terra Oracle Feeder

This contains the Oracle feeder software that is used for periodically submitting oracle votes for the exchange rate of the different assets offered by the oracle chain. This implementation can be used as-is, but also can serve as a reference for creating your own custom oracle feeder.

Every validator must participate in the oracle process and periodically submit a vote for the exchange rate of LUNC in all whitelisted denominations. Because this process occurs every 30 seconds, validators must set up an automated process to avoid getting slashed and jailed.

Overview

This solution has 2 components:

  1. price-server

    • Obtain information from various data sources (exchanges, forex data, etc),
    • Model the data,
    • Enable a url to query the data,
  2. feeder

    • Reads the exchange rates data from a data source (price-server)
    • Periodically submits vote and prevote messages following the oracle voting procedure

Requirements

  1. Validator node setup
  2. Public / private network
  3. Instance for blockchain node(s) that will be used for broadcasting the transaction.
  4. Instance for running price server bounded to the internet.
  5. Instance for running feeder in the private network, which can be used with the validator node. The important part is that it should stay in the private network.

Using docker-compose (Recommended) (Experimental)

  1. Install Docker

  2. curl -o docker-compose.yml https://raw.githubusercontent.com/classic-terra/oracle-feeder/main/docker-compose.yml

  3. Review the docker-compose.yml service oracle-feeder and change ENV accordingly

  • ORACLE_FEEDER_PASSWORD=password (required) Oracle feeder keyring password
  • ORACLE_FEEDER_MNENOMIC=word1 word2... (required) (Oracle feeder mnemonic, this address will be responsible for updating price)
  • ORACLE_FEEDER_VALIDATORS=terravaloper1xxx (required) (Oracle feeder validator that feeder address is bount to) How to bound? (REMEMBER TO BOUND YOUR VOTER TO VALIDATOR BEFORE RUNNING)
  • ORACLE_FEEDER_LCD_ADDRESS=https://terra-classic-lcd.publicnode.com,https://lcd.terraclassic.community (optional)
  • ORACLE_FEEDER_CHAIN_ID=columbus-5 (optional)
  1. Bring up your stack by running

    docker-compose up -d

Manual deployment instructions

  1. Install Node.js (https://nodejs.org/)

  2. Clone this repository

git clone https://github.com/classic-terra/oracle-feeder
cd oracle-feeder
  1. Configure and launch price-server, following instructions here.
cd price-server
npm install

# Copy sample config file
cp ./config/default-sample.js ./config/default.js

# make edits
vim ./config/default.js

# price is available at `http://127.0.0.1:8532/latest`
npm run start
  1. Configure and launch feeder, following instructions here.
cd feeder
npm install

# configure to use feeder account
npm start add-key

# start voting (note: multiple lcd-url and validators can be specified)
$ npm start vote -- \
   --data-source-url http://localhost:8532/latest \
   --lcd-url https://terra-classic-lcd.publicnode.com \
   --lcd-url https://lcd.terraclassic.community \
   --chain-id columbus-5 \
   --validators <terravaloper address> \
   --password <password>

Cheat Sheet:

Start

docker-compose up -d

Stop

docker-compose stop

Clean

docker-compose down

View Logs

docker-compose logs -f

Upgrade

docker-compose down
docker-compose pull
docker-compose up -d

Build from source

docker-compose -f docker-compose.yml -f docker-compose.build.yml build --no-cache

Packages

 
 
 

Languages

  • TypeScript 84.0%
  • JavaScript 14.8%
  • Other 1.2%