Running Slinky Oracle for Initia

· guide incentive initia
In this article/blog we will explain and give a tutorial to set up a oracle in initia testnet.
We will not discuss the definition of initiative and network architecture in this article.
Overview
Slinky oracle - the first restaked oracle aggregator, built for perps markets & DeFi that need maximal performance & minimal trust. Powered by Skip
The Slinky Oracle consists of two main elements:
-
An on-chain component that retrieves price data from the sidecar with each block, forwards these prices to the blockchain through vote extensions, and compiles prices from all validators involved.
-
A sidecar process dedicated to polling price information from various providers and delivering this data to the on-chain component.
For additional information on the oracle, refer to the Slinky repository at https://github.com/skip-mev/slinky/.
So how to get it up and running and connected to your validator?
Guide Running Slinky Oracle
Prerequisites
- Validator active set
- Golang + 1.22
if you have not installed Golang
- Install golang
VER="1.22.1"
wget "https://go.dev/dl/go$VER.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz"
rm "go$VER.linux-amd64.tar.gz"
echo -e "\n# go\nexport PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bashrc
source ~/.bashrc
Get slinky
As of writing this we are using tag version v0.4.3 on the initia testnet
- Clone & compile
git clone https://github.com/skip-mev/slinky.git
cd slinky
git checkout v0.4.3
make install
- Check if installed
slinky --help
Configuration
- Create ~/.oracle
mkdir -p ~/.oracle
- Download oracle.json
wget -O ~/.oracle/oracle.json "https://raw.githubusercontent.com/skip-mev/slinky/v0.4.3/config/core/oracle.json"
- Check the url marketmap_api in ~/.oracle/oracle.json and make sure it is the same as grpc address in your ~/.initia/config/app.toml . Our grpc address is
0.0.0.0:1090
...
{
"name": "marketmap_api",
"api": {
"enabled": true,
"timeout": 20000000000,
"interval": 10000000000,
"reconnectTimeout": 2000000000,
"maxQueries": 1,
"atomic": true,
"url": "0.0.0.0:1090", // point to your grpc address
"endpoints": null,
"batchSize": 0,
"name": "marketmap_api"
},
"type": "market_map_provider"
}
...
Start slinky
- set service
sudo tee /etc/systemd/system/slinky.service > /dev/null <<EOF
[Unit]
Description=oracle slinky
After=network-online.target
[Service]
User=$USER
Type=simple
ExecStart=$(which slinky) --oracle-config-path $HOME/.oracle/oracle.json
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
- enable service
sudo systemctl daemon-reload
sudo systemctl enable slinky
- start service
sudo systemctl start slinky
journalctl -fu slinky -o cat
you’ll see a log like this
Enable Oracle Vote Extension
In order to utilize the Slinky oracle data in the Initia node, the Oracle setting should be enabled in the ~/.initia/config/app.toml
.
- Open and edit
app.toml
###############################################################################
### Oracle ###
###############################################################################
[oracle]
# Enabled indicates whether the oracle is enabled.
enabled = "true"
# Oracle Address is the URL of the out of process oracle sidecar. This is used to
# connect to the oracle sidecar when the application boots up. Note that the address
# can be modified at any point, but will only take effect after the application is
# restarted. This can be the address of an oracle container running on the same
# machine or a remote machine.
oracle_address = "0.0.0.0:8080"
# Client Timeout is the time that the client is willing to wait for responses from
# the oracle before timing out.
client_timeout = "300ms"
# MetricsEnabled determines whether oracle metrics are enabled. Specifically
# this enables instrumentation of the oracle client and the interaction between
# the oracle and the app.
metrics_enabled = "false"
make sure you save the changes
- and then restart your node initia.
Done!
For check the current aggregated prices
curl localhost:8080/slinky/oracle/v1/prices | jq
Additionally
- Remove and clean slinky
sudo systemctl stop slinky
sudo systemctl disable slinky
sudo rm /etc/systemd/system/slinky.service
rm $(which slinky)
rm -r .oracle
rm -r slinky
Resources
- https://docs.initia.xyz/run-initia-node/running-initia-node/oracle
- https://github.com/skip-mev/slinky
Looking for another guide ?
- Reach us at [email protected]
- Join Discord_genznodes
- Telegram