Page cover image

Allora Worker

Requirements

Requirement
Specification

Operating System

Ubuntu 22.04

CPU

Minimum of 1/2 core

Memory

2 to 4 GB

Storage

SSD / NVMe with at least 5 GB of space

1. Install dependencies

sudo apt update -y && apt install screen nano curl unzip git -y

2. Install Docker

cat << 'EOF' > docker-install.sh
#!/bin/bash

# Update and install necessary dependencies
apt-get update && apt-get upgrade -y
apt-get install -y curl wget git nano jq

# Install Docker
echo "Installing Docker..."
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
docker version

# Install Docker-Compose
echo "Installing Docker Compose..."
VER=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)
curl -L "https://github.com/docker/compose/releases/download/$VER/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

# Add user to Docker group
echo "Adding current user to the Docker group..."
sudo groupadd docker
sudo usermod -aG docker $USER
EOF

chmod +x docker-install.sh && ./docker-install.sh

3. Clone repository

screen -S allora-worker
git clone https://github.com/allora-network/allora-huggingface-walkthrough && cd allora-huggingface-walkthrough

4. Update Config file

cp config.example.json config.json
nano config.json

Replace the following:

  • addressRestoreMnemonic: Enter your mnemonic here. You can create one using the Keplr wallet.

  • Use your own nodeRpc or leave it as default.

I went with topics 7/8/9, but feel free to run any other topics if you prefer!

{
    "wallet": {
        "addressKeyName": "testkey",
        "addressRestoreMnemonic": "mnemonic 1",
        "alloraHomeDir": "",
        "gas": "auto",
        "gasAdjustment": 1.0,
        "nodeRpc": "https://allora-rpc.testnet.allora.network/",
        "maxRetries": 1,
        "delay": 1,
        "submitTx": true
    },
    "worker": [
        {
            "topicId": 7,
            "inferenceEntrypointName": "api-worker-reputer",
            "loopSeconds": 5,
            "parameters": {
                "InferenceEndpoint": "http://inference:8000/inference/{Token}",
                "Token": "ETH"
            }
        },
        {
            "topicId": 8,
            "inferenceEntrypointName": "api-worker-reputer",
            "loopSeconds": 5,
            "parameters": {
                "InferenceEndpoint": "http://inference:8000/inference/{Token}",
                "Token": "BNB"
            }
        },
        {
            "topicId": 9,
            "inferenceEntrypointName": "api-worker-reputer",
            "loopSeconds": 5,
            "parameters": {
                "InferenceEndpoint": "http://inference:8000/inference/{Token}",
                "Token": "ARB"
            }
        }
    ]
}

5. Update app.py

Open the app.py file, locate the following line, and replace <Your Coingecko API key> with your actual API key.

You can register for an API key at: Coingecko Developer Dashboard.

"x-cg-demo-api-key": "<Your Coingecko API key>"

6. Init model & Start your worker

sed -i 's/\r//' init.config && chmod +x init.config && ./init.config ; docker compose up -d --build && docker compose logs -f

7. Detach screen

Ctrl + A + D

8. To reopen worker screen

screen -r allora-worker

Bang Bang! All done! 🎉

Listen up, the job’s not done yet!

Allora Network will only reward you if and only if your inference stands out from the crowd. If it’s unique, you’re in the game. You can push your score even higher by improving your model; just tweak that app.py file.

If coding’s not your thing, hit up ChatGPT for help. But if you’re a Data Scientist or Machine Learning Engineer, well, this is your playground!

🎉 If you want to develop advanced and effective machine learning models to earn rewards from allora, feel free to DM me to get started. I'm here to help you!

9. Check your point

Other resources

This is a tool I developed to assist users running Workers for the Allora Network, aimed at improving their work results.

Last updated