Oracle Service

The Slinky Oracle consists of two main elements:

Clone and Build

CONF_DIR=/data/oracle
sudo mkdir -pv $CONF_DIR
sudo cd $CONF_DIR
export TAG=v0.4.3
git clone https://github.com/skip-mev/slinky.git
cd slinky
git checkout $TAG # Tag the desired version
make install

Setup Config and Service

INITIA_GRPC="127.0.0.1:9090"
sudo cp $CONF_DIR/slinky/config/core/oracle.json $CONF_DIR

sudo tee /etc/systemd/system/oracle.service > /dev/null << EOF
[Unit]
Description=initia oracle service
After=network-online.target

[Service]
User=$USER
Type=simple
ExecStart=$(which slinky) --oracle-config-path $CONF_DIR/oracle.json --market-map-endpoint $INITIA_GRPC
Restart=on-failure
WorkingDirectory=$CONF_DIR
SyslogIdentifier=oracle
LimitNOFILE=65545

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable oracle.service
sudo systemctl start oracle.service
sudo journalctl -u oracle.service -f -o cat

Validating Prices

make run-oracle-client

# example 
2024/06/11 11:00:00 Calling Prices RPC...
2024/06/11 11:00:00 Currency Pair, Price: (AAVE/USD, 8499550314)
2024/06/11 11:00:00 Currency Pair, Price: (ADA/USD, 4104127111)
2024/06/11 11:00:00 Currency Pair, Price: (AEVO/USD, 629159588)
2024/06/11 11:00:00 Currency Pair, Price: (AGIX/USD, 6268611971)
2024/06/11 11:00:00 Currency Pair, Price: (ALGO/USD, 1537411901)
2024/06/11 11:00:00 Currency Pair, Price: (APE/USD, 1047516738)
2024/06/11 11:00:00 Currency Pair, Price: (APT/USD, 7827320875)

Validator Enable Oracle Vote

# config/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 = "127.0.0.1:8080"

# Client Timeout is the time that the client is willing to wait for responses from 
# the oracle before timing out.
client_timeout = "500ms"

# 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"

Last updated