Persistence Docs
K

Oracle Price Feeder

The x/oracle requires that all validators vote on the price of assets which governance has decided to add. In order to vote on these prices, the persistenceOne team has built the Oracle price feeder.

How to setup

  1. First, install the oracle-feeder:

    a. Install the binary from releases

    • Download the binary
    • Make the binary executable: chmod +x oracle-feeder
    • Move the binary to /usr/local/bin

    b. Or install using source code

    • clone oracle-feeder: git clone https://github.com/persistenceOne/oracle-feeder
    • install: cd oracle-feeder && make install
  2. Setup account

    • Setup your keyring - checkout this doc

    • You can setup a separate key for oracle account or use the validator's key as the oracle account

    • Delegate consent to the oracle account (Not needed if you are using validator's key as oracle account)

      persistenceCore tx oracle delegate-feed-consent <validator-key> $(persistenceCore keys show <oracle-key> -a --keyring-backend file) --keyring-backend file
  3. Create config file

    • Download the example config (or copy from source code)

      wget https://raw.githubusercontent.com/persistenceOne/oracle-feeder/main/price-feeder.example.toml
    • Update [account] information with correct chain-id (core-1 for mainnet, test-core-1 for testnet), address and validator address from your keyring

      [account] address = "persistence152nvc6f096v6n6tr5lg50xq22ak0chsr0ru7xc" # oracle account address chain_id = "test-core-1" validator = "persistencevaloper1pkkayn066msg6kn33wnl5srhdt3tnu2v94kvz9"

      In order to get your oracle address & validator address, you can run:

      persistenceCore keys show <oracle-key> -a --keyring-backend file persistenceCore keys show <validator-key> -a --bech=val --keyring-backend file
    • Update [keyring] information (learn about keyring backend here)

      [keyring] backend="file" dir="<path to .persistenceCore dir>" passphrase="xxxx"
  4. Create a systemd service file

    • Run this command to create oracle-feeder.service, make sure to update the config path.

      sudo tee /etc/systemd/system/oracle-feeder.service > /dev/null <<EOF [Unit] Description=PersistenceOne Oracle Price Feeder After=online.target[Service] StartLimitIntervalSec=0 StartLimitBurst=0 [Service] Environment="ORACLE_FEEDER_KEY_PASSPHRASE=xxxx" # remove this line, if not using env variable Type=simple User=$USER ExecStart=$(which oracle-feeder) <path/to/oracle/config.toml> --log-level=debug Restart=on-failure RestartSec=5s LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF
  5. Start your service

    sudo systemctl daemon-reload sudo systemctl enable oracle-feeder sudo systemctl start oracle-feeder
  6. Please check to make sure your oracle feeder is running successfully

    sudo journalctl -u oracle-feeder.service -f

Next

Overview