Deploy Allora Appchain

We discuss the settlement layer for the Allora Network and how to deploy it

What is the Appchain?

The Allora Appchain is a Cosmos SDK appchain that serves as the settlement layer for the Allora Network. It serves to coordinate all incentives for all actors:

  • The weights between reputers and workers, as well as a reference to the logic used to update those weights, are stored on-chain.
  • Rewards payable from inflation are calculated based on those weights at some global cadence on-chain.
  • Consumers pay for inferences to be collected and for all the above calculations to run. These funds get allocated to workers and reputers, respectively.

The appchain also coordinates actions between protocol actors.

  • The appchain triggers requests to workers and reputers to collect inferences and run weight-adjustment logic, respectively, as per each topic's respective inference and weight-adjustment cadence.
  • The appchain collects a recent history of inferences in batches to later be scored by weight-adjustment.

Why and How might one interact with the Allora Appchain?

Different actors interact with the Allora Appchain for different reasons. They do so via a standard client connection (such as CosmJS) or the Appchain CLI.

  • Data scientists interact with the Appchain to register their worker nodes and to withdraw rewards accrued for their inferences. These rewards are paid by both consumers and inflation based on their relative weight.
  • Developers interact with the Appchain to create topics, fund topics, and perhaps also to read recent inferences.
  • Validators run the Appchain and receive standard inflationary rewards for running Cosmos SDK appchains and a cut of the funds from consumers. They will also register themselves on the Appchain so that they can be eligible for rewards.

Dependencies

  • Create a set of keys and initialize genesis. See example in appchain/init.sh.
  • Provide a valid $AI_PROVIDER_NODE and $AI_PROVIDER_NODE_FUNCTION_ID env var.

Deploy with docker-compose

There is a appchain/docker-compose.yml provided that sets up one head node and one worker node.

Run

Once this is set up, run docker compose -f appchain/docker-compose.yml up

Deploy in k8s with helm chart

Upshot team uses a universal-helm chart to deploy applications into kubernetes clusters.
There is a index-provider/values.yaml provided that sets up one head node and one worker node.

Dependencies

  • You need to have configured kubeconfig file on the computer to connect to the cluster and deploy the node.

Deploy with the Helm Chart

  1. Add upshot Helm chart repo:
helm repo add upshot https://upshot-tech.github.io/helm-charts

  1. Install helm chart with the given values file:
helm install \
  index-provider \
  upshot/universal-helm \
  -f appchain/values.yaml

Edit Chain Parameters

The public mainnet uses standard cosmos governance modules to vote on global network parameters (such as reward epoch time in blocks, for example). For testnets and devnets, however, you can use the following allorad CLI command to set the global parameters of the blockchain (if you are whitelisted to do so. The parameters below are just example values):

allorad tx emissions update-params  "$VALIDATOR_KEY_FOR_TX_SEND" '{"version":["v0.0.4"], "epoch_length":[5], "emissions_per_epoch":["1000"], "min_topic_unmet_demand":["100"], "max_topics_per_block":[1000], "min_request_unmet_demand":["1"], "max_allowable_missing_inference_percent":[10], "required_minimum_stake":["1"], "remove_stake_delay_window":[172800], "min_fastest_allowed_cadence":[60], "max_inference_request_validity":[36000], "max_slowest_allowed_cadence":[36000]}'