How to set up the Price Server & Oracle Feeder for your Terra Classic Validator

TL;DR

git clone https://github.com/terra-rebels/oracle-feeder
cd oracle-feeder
CURR=`pwd`
cd $CURR/price-server/config
cp default-sample.js default.js
# Modify default.js
npm install
npm start
# From another terminal
cd $CURR/feeder
npm install
npm start update-key
npm start vote -- \
--source http://localhost:8532/latest \
--lcd https://lcd.terra.dev \
--chain-id columbus-5 \
--validator terravaloperxxx
--password "<password>"

2022–10–28 update: The repository is updated to use the Terra Rebels version.

The Price Server/Feeder is an essential component in the Terra Classic chain. Validators are obligated to run this service and provide accurate currency prices. Consequently, they are rewarded for doing so — and penalised otherwise as well.

This article explains the steps to set up the service.

Prerequisites

  • Your validator node should already be configured.
  • Node.js version 12 or later.

Pre-setup

1. Download the source code

Download the source code from the repository.

git clone https://github.com/terra-rebels/oracle-feeder

2. Check out the correct branch

Traditionally, the version of the codebase to use has been indicated by the tags. As of this writing, the version to use should be the tip of the main branch (commit 5084f8441eb74f518163250ae38837bc2566aebc). In other words, there is no additional checkout to do.

cd oracle-feeder
ORACLE=`pwd`

There are two services that need to be run — the Price Server to collect currency prices, and the Oracle Feeder to send the prices to the chain. The same codebase supplies the source code to run both of these services.

The Price Server code is found in the price-server directory. The Oracle Feeder is found in the feeder directory.

Price Server Setup

1. Modify the configuration file

A sample configuration file is provided for the price server. This is found at config/default-sample.js

Copy this file and rename it so that the program recognises it.

cd $ORACLE/price-server/config
cp default-sample.js default.js

This file specifies the currencies that are in the basket of the stablecoins in Terra Classic.

The property that requires attention is `fiatProvider`. There are several price providers listed under this property. Some of the services require paid plans from the providers. Apply for the services as you deem fit and set the API keys respectively. Comment out or remove those that you are not using.

2. Start the Price Server

After the configuration file is edited correctly, install the dependencies and start the server.

cd $ORACLE/price-server
npm install
npm start

For more information, refer to the README file at price-server/README.md

Oracle Feeder Setup

1. Set up the key for the Oracle Feeder

Create a new key responsible for submitting the oracle votes. This can be done using terrad. (This key can be created using any other way you create a wallet. The pieces of information that you need are the seed phrase and the address.)

terrad keys add feeder

(feeder is just a name given to this new account. This can be changed to a different name of your choosing.)

Like every other wallet that you create, you should keep the seed phrase safely.

Take note of the address (starting with terra1) of the newly created wallet and the seed phrase as well. They will be needed in the later steps.

The address can be obtained from the command below:

terrad keys show feeder

Next, designate this new account as the key to submit the vote. This step is called feeder consent delegation.

terrad tx oracle set-feeder <feeder-address> --from=validator-wallet
  • <feeder-address> is the address of the newly created wallet that you noted from the step before.
  • validator-wallet is the name of hte wallet that is the key for your validator.

2. Set up the Oracle Feeder

cd $ORACLE/feeder
npm install
npm start update-key

After running this command, you will be prompted to enter a passphrase to encrypt the contents of the file that will be read by the Feeder program to submit oracle votes.

Enter a passphrase to encrypt your key to disk: ***
Repeat the passphrase: ***

Then you will be prompted to enter the seed phrase (a.k.a. bip39 mnemonic). Enter the seed phrase of the “feeder” account created earlier.

Enter your bip39 mnemonic: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx

After this is done, a voter.json file will be created in the same directory.

3. Start the Oracle Feeder

Run the feeder using the command:

npm start vote -- \
--source http://localhost:8532/latest \
--lcd https://lcd.terra.dev \
--chain-id columbus-5 \
--validator terravaloperxxx
--password "<password>"
  • --source specifies the Price Server providing the information.
  • --lcd specifies the Light Client Daemon from which the information of the chain is read. If your validator node is running the LCD, you can specify your own node (http://localhost:1317). Otherwise, you can use https://lcd.terra.dev
  • --chain-id is the name of the chain (duh).
  • --validator specifies the address of the validator (starting with terravaloper).
  • --password is the passphrase that you entered in the earlier step.

After running this command, your Oracle Feeder will start submitting results to the Price Oracle every 5 blocks.

(Note: If you get the message “Not supported for the network”, go back to “2. Set up the Oracle Feeder”, and run “npm install @terra-money/terra.js@3.0.4” to downgrade the terra.js library.)

For more information, refer to the README file at feeder/README.md

Post set-up notes

Both services need to be running all the time (just like your validator client). You should configure them as system services so that they run automatically on startup. This part of the configuration is left as an exercise to you as it is OS-dependent.

The Oracle Feeder is dependent on the Price Server. Without the Price Server, your Oracle Feeder has no information to submit. So make sure that both are running.

It is fine to run these services on the same server as your validator node — the main concern is if the node has enough memory to run all three services. 32GB of memory should be sufficient.

When your validator is running, check its performance at terra-classic.aurastake.com

The Uptime column shows the votes submitted by the validators and the Oracle Vote column shows the submitted price votes.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
AuraStake

AuraStake

Dedicated to a Better Web3 Experience