Oracle


# Change indexer to kv, configure pruning,open rpc port, Change keyring backend to test
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.symphonyd/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"5000\"/" $HOME/.symphonyd/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"20\"/" $HOME/.symphonyd/config/app.toml
symphonyd config keyring-backend test
sed -i -e "s/^indexer *=.*/indexer = \"kv\"/" $HOME/.symphonyd/config/config.toml
sed -i 's|laddr = "tcp://127.0.0.1:29157"|laddr = "tcp://0.0.0.0:29157"|' $HOME/.symphonyd/config/config.toml
sudo systemctl restart symphony

# Install Dependencies
sudo apt update
sudo apt install python3.10
sudo apt install python3.10-venv

# Clone Oracle Repo
cd $HOME
git clone https://github.com/cmancrypto/symphony-oracle-voter.git
cd symphony-oracle-voter
git checkout v0.0.4r3

# Change keyring backend
sed -i 's/keyring_back_end = os.getenv("KEY_BACKEND","os")/keyring_back_end = os.getenv("KEY_BACKEND","test")/' /root/symphony-oracle-voter/config.py

# Create .env file
cat <<EOF > .env
VALIDATOR_ADDRESS= Validator-address
VALIDATOR_ACC_ADDRESS= Wallet-address
SYMPHONY_LCD= http://localhost:29117 
TENDERMINT_RPC= http://localhost:29157 
EOF

# Initiate Python virtual env
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
deactivate

# Create Systemd
sudo tee /etc/systemd/system/symphony-oracle.service > /dev/null <<EOF
[Unit]
Description=Symphony Oracle
After=network.target

[Service]
# Environment variables
Environment="SYMPHONYD_PATH=$HOME/go/bin/symphonyd"
Environment="PYTHON_ENV=production"
Environment="LOG_LEVEL=INFO"
Environment="DEBUG=false"

# Service configuration
Type=simple
User=$USER
WorkingDirectory=$HOME/symphony-oracle-voter
ExecStart=$HOME/symphony-oracle-voter/venv/bin/python3 -u $HOME/symphony-oracle-voter/main.py
Restart=always
RestartSec=3
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
EOF


# Start oracle service
sudo systemctl daemon-reload
sudo systemctl enable symphony-oracle.service
sudo systemctl status symphony-oracle.service
sudo systemctl restart symphony-oracle.service
sudo systemctl stop symphony-oracle.service
sudo journalctl -u  symphony-oracle -f -o cat

Last updated