Kujira Oracle Guide¶
Introduction¶
Validators are required to submit price feeds for the on-chain oracle.
The price-feeder
app can get price data from multiple providers and
submit oracle votes to perform this duty.
Requirements¶
- This guide assumes you are running Ubuntu 22.04.
price-feeder
needs access to a running node's RPC and gRPC ports. This guide assumes you have it on the same machine and useslocalhost
with default ports 26657 and 9090. Change these inconfig.toml
as needed.
User setup¶
Best practice is to run node software on an isolated unprivileged user.
We'll create the kujioracle
user in this guide; if your username is different
change it wherever it appears.
Create the kujioracle
user¶
Build environment setup¶
If you've already followed the Node Guide, the only steps you need in this section are Install go toolchain #2 and #3. Repeating the others won't hurt if you want to be safe.
Install build packages¶
Install go toolchain¶
- Download and extract go 1.18.5.
- Login as
kujioracle
. - Configure environment variables for
kujioracle
.
Build price-feeder
¶
- Login as
kujioracle
(skip if you're already logged in). - Build
kujirad
v0.5.0. We'll use the binary to create the keyring file. - Build
price-feeder
.
Configure price-feeder
¶
Create a wallet¶
This wallet will be relatively insecure, only store the funds you need to send votes.
- Login as
kujioracle
(skip if you're already logged in). - Create the wallet and a password for the keyring.
- Configure the
keyring-file
directory. This allowsprice-feeder
to find the keyring.
Set the feeder delegation¶
This step will authorize your new wallet to send oracle votes on behalf of your validator. The transaction should be sent from the validator wallet so run on a node where it's available.
- Replace
<oracle_wallet>
with your new wallet address. - Replace
<validator_wallet>
with you validator wallet name.
Create the config¶
- Login as
kujioracle
(skip if you're already logged in). -
Create the config file with your favorite text editor.
- Replace
<wallet_address>
with your oracle wallet address (e.g.kujira16jchc8l8hfk98g4gnqk4pld29z385qyseeqqd0
) - Replace
<validator_address>
with your validator address (e.g.kujiravaloper1e9rm4nszmfg3fdhrw6s9j69stqddk7ga2x84yf
)
~/config.tomlgas_adjustment = 1.5 gas_prices = "0.00125ukuji" enable_server = true enable_voter = true provider_timeout = "500ms" [server] listen_addr = "0.0.0.0:7171" read_timeout = "20s" verbose_cors = true write_timeout = "20s" [[deviation_thresholds]] base = "USDT" threshold = "2" [[currency_pairs]] base = "ATOM" providers = [ "binance", "kraken", "osmosis", ] quote = "USD" [account] address = "<wallet_address>" chain_id = "kaiyo-1" validator = "<validator_address>" prefix = "kujira" [keyring] backend = "file" dir = "/home/kujioracle/.kujira" [rpc] grpc_endpoint = "localhost:9090" rpc_timeout = "500ms" tmrpc_endpoint = "http://localhost:26657" [telemetry] enable_hostname = true enable_hostname_label = true enable_service_label = true enabled = true global_labels = [["chain_id", "kaiyo-1"]] service_name = "price-feeder" type = "prometheus" [[provider_endpoints]] name = "binance" rest = "https://api1.binance.us" websocket = "stream.binance.us:9443"
- Replace
Configure the currency pairs¶
The [[currency_pairs]]
provided in the config above is only an example, each validator
should modify this to submit prices for the denoms whitelisted by the chain. Keep an eye
out for governance proposals introducing new denoms and check the current ones here:
kaiyo-1 oracle parameters.
Run price-feeder
¶
- Login as
kujioracle
(skip if you're already logged in). - Run the app, providing the password on
stdin
.
Create a service¶
A systemd service will keep price-feeder
running in the background and restart it if it stops.
- Create the service file with
sudo
using your favorite text editor. Replace<keyring_password>
with the one you created./etc/systemd/system/kujira-price-feeder.service[Unit] Description=kujira-price-feeder After=network.target [Service] Type=simple User=kujioracle ExecStart=/home/kujioracle/go/bin/price-feeder /home/kujioracle/config.toml --log-level debug Restart=on-abort LimitNOFILE=65535 Environment="PRICE_FEEDER_PASS=<keyring_password>" WorkingDirectory=/home/kujioracle [Install] WantedBy=multi-user.target
- Reload
systemd
to pick up the new service. - Start the service.
- Tail your service logs.
- (Optional) Enable the service. This will set it to start on every boot.