Skip to main content

A CLI tool for creating Allora Chain Worker Nodes

Project description

Building a Worker Node with the allocmd CLI

Docker! Python! Apache License

The allocmd is a CLI tool that handles seamless creation of Allora external resources built to integrate with Allora chain. With this tool, you do not need to write the worker or reputer node or even a validator from scratch, the CLI tool will help you bootstrap all the needed components to get resource working.

The following are the list of stuff that can don with this tool at the moment

  1. Generating worker node files
  2. Genrating reputer node files
  3. Generating validator node files
  4. Funding of edgenet account addresses

for all the files generation commands, the tool will help in generation of the needed files and their respective docker files and you can spin them up as usual docker containers with docker-compose

Install allocmd CLI

You will begin with installing the tool on your machine.

pip install allocmd

you should use version 1.0.0 for Allora Chain v1 and version 2.0.0 for Allora Chain v2. Run allocmd --help to get general help or allocmd [command] --help to get help relating to a particular command.

Initializing resources

Initialize the worker/reputer for development

Note that all commands here will pass for both worker or reputer node

The next step is initializing the CLI to bootstrap all the needed components to get your worker or reputer running. The following command will handle the initialization process. It will create all the files in the appropriate directories and generate identities for your node to be used for local development.

allocmd generate worker --name <preffered name> --topic <topic id> --env dev

Before running this command you will have to pick the topic Id you wish to generate inference for after which you can run this command with the topic Id. The command will auto-create some files, the most important of which is the dev-docker-compose.yamlfile which is an already complete docker-compose that you can run immediately to see your worker/reputer and head nodes running perfectly on your local machine. You can edit the files as you wish. for instance the main.py is meant for you to call your inference server, hence you will have to edit the sample code with actual URLs and logic as you prefer.

When you run the docker-compose (docker-compose -f dev-docker-compose.yaml up --build), maybe after you have written and tested your logic in main.py, you then should be seeing the logs from the nodes, and you should be able to make a request to your head node and see it get a response from the worker/reputer node. Note that in production, you won't be the one to make the inference request, as the Allora chain will do this at the cadence provided by the topic creator.

You can test your node by running the following curl command:

curl --location 'http://localhost:6000/api/v1/functions/execute' --header 'Accept: application/json, text/plain, */*' --header 'Content-Type: application/json;charset=UTF-8' --data '{
    "function_id": "bafybeigpiwl3o73zvvl6dxdqu7zqcub5mhg65jiky2xqb4rdhfmikswzqm",
    "method": "allora-inference-function.wasm",
    "parameters": null,
    "topic": "<TOPIC_ID>",
    "config": {
        "env_vars": [
            {                              
                "name": "BLS_REQUEST_PATH",
                "value": "/api"
            },
            {                              
                "name": "ALLORA_ARG_PARAMS",
                "value": "<argument>"
            }
        ],
        "number_of_nodes": -1,
        "timeout" : 2
    }
}' | jq

The <TOPIC_ID> needs to be an existing topic on the chain. The <argument> is what the topic is expecting to receive to perform the inference (as an indication to test, you can use the DefaultArg value from the topic on-chain, e.g. for ETH prediction topic, it should be "ETH").

Initialize the worker/reputer for production

Your worker/reputer node is now ready to be deployed, the main.py has been modified, all env variables passed, and the worker/reputer node is running locally and you are now ready to deploy your worker/reputer to run in the production environment. The following command will handle the generation of the prod-docker-compose.yaml file which contains all the keys and parameters needed for your worker/reputer to function perfectly in production.

allocmd generate worker --env prod

By running this command, prod-docker-compose.yaml will be generated with appropriate keys and parameters. You can now run the docker-compose file or deploy the whole codebase in your preferred cloud instance. At this stage, your worker should be responding to inference request from the Allora Chain.

Initialize validator production

allocmd generate validator --name <validator-name> --network <edgenet>

The above command can generate validator files and you can then use docker-compose to deploy

Fund account address

allocmd fund <address> 

The above command takes address and fund the account with Allora Faucet

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

allocmd-2.0.10.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

allocmd-2.0.10-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file allocmd-2.0.10.tar.gz.

File metadata

  • Download URL: allocmd-2.0.10.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for allocmd-2.0.10.tar.gz
Algorithm Hash digest
SHA256 16642bfc61bca2b9c87f3f2f06f34fad24d1bdba9797b2260053532f0f311368
MD5 bf1b8cd00b302f427d7f2535a296d673
BLAKE2b-256 6c8ecdf25823743393d7d3f2735562daf223a472ca92b2e49d13fcbfb97da806

See more details on using hashes here.

File details

Details for the file allocmd-2.0.10-py3-none-any.whl.

File metadata

  • Download URL: allocmd-2.0.10-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for allocmd-2.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ed791d82a6d635df9694743b2eaad93b74e09313838c30704cde4a332c1d8782
MD5 322bc96a37d1752fc5e3fc52c447319b
BLAKE2b-256 1da8c0e2073d96d032a3cf33cd78c57e36ef454d5a49038781d904d1dcbb674a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page