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.
This solution has 2 components:
-
- Obtain information from various data sources (exchanges, forex data, etc),
- Model the data,
- Enable a url to query the data,
-
- Reads the exchange rates data from a data source (
price-server
) - Periodically submits vote and prevote messages following the oracle voting procedure
- Reads the exchange rates data from a data source (
- Validator node setup
- Public / private network
- Instance for blockchain node(s) that will be used for broadcasting the transaction.
- Instance for running price server bounded to the internet.
- 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.
-
Install Docker
-
curl -o docker-compose.yml https://raw.githubusercontent.com/classic-terra/oracle-feeder/main/docker-compose.yml
-
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)
-
Bring up your stack by running
docker-compose up -d
-
Install Node.js (https://nodejs.org/)
-
Clone this repository
git clone https://github.com/classic-terra/oracle-feeder
cd oracle-feeder
- 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
- 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>
docker-compose up -d
docker-compose stop
docker-compose down
docker-compose logs -f
docker-compose down
docker-compose pull
docker-compose up -d
docker-compose -f docker-compose.yml -f docker-compose.build.yml build --no-cache