Allora Module Accounts
What You'll Learn
- Understanding how Allora Chain manages tokens through Cosmos SDK module accounts
- Complete overview of actors who earn rewards and sources of token rewards
- Detailed explanation of module accounts and their roles in fund management
- How block execution order affects payment flows and reward distribution
Overview
The Allora Chain uses Cosmos SDK module accounts (opens in a new tab) to hold tokens belonging to various different actors on the network. This page describes the various places that module accounts hold funds are held, and the flow of money through the network.
Why Module Accounts Matter
System Architecture Benefits:
- Transparent fund management: Clear separation of different token pools and their purposes
- Automated operations: Smart contract-like behavior without custom smart contract complexity
- Audit capability: Easy tracking of token flows and balances across network functions
- Security isolation: Separate accounts prevent unauthorized access to different fund pools
Economic Transparency:
- Clear attribution: Every token has a clear owner and purpose within the system
- Predictable flows: Defined rules for how tokens move between different network participants
- Fair distribution: Algorithmic distribution of rewards based on network contribution
- Economic sustainability: Balanced incentive structure for long-term network health
Network Economics Overview
Actors that Earn Token Rewards
There are three actors in the Allora network that earn token rewards:
1. Cosmos Validators
- Service provided: For the service of running the cosmos blockchain powering Allora.
- Core function: Maintain blockchain consensus, validate transactions, and secure network
- Reward source: Block rewards, transaction fees, and inflation distribution
- Economic role: Foundation layer of network security and operation
2. Reputers
- Service provided: For providing ground truth to each topic, and maintaining a reputation system scoring the quality of worker outputs.
- Core function: Quality assurance, data verification, and worker performance evaluation
- Reward source: Share of network rewards based on accuracy and contribution quality
- Economic role: Ensure data integrity and maintain network reliability standards
3. Workers
- Service provided: For creating the actual AI/ML Inferences that the system provides for each topic.
- Core function: Generate predictions, run models, and provide inference data
- Reward source: Performance-based rewards for accurate and valuable predictions
- Economic role: Primary value creators delivering the core network service
Sources of Token Rewards
There are also three sources of tokens rewards, that pay the three actors who earn them:
1. Cosmos Network Transaction Fees
Transaction fees on Allora are optional, at least at the time of this writing. However Cosmos SDK does support an optional transaction fee to be paid by the creator of a transaction, paid in units of computational steps taken (like gas for those familiar with the EVM). If the creator of a transaction chooses to add a fee (say, for get a higher priority of being added to a block), that fee will be paid out as token rewards.
Fee Structure Benefits:
- Optional participation: Users can choose fee levels based on urgency and priority
- Computational fairness: Fees correlate with actual network resource consumption
- Economic incentives: Higher fees can provide faster transaction processing
- Network sustainability: Transaction fees contribute to validator and network operator rewards
2. Inference Request Fees
When making an inference request, the requestor (inference data consumer) will bid a price they are willing to pay for that request. In that bid, they must send that amount of tokens to the network. If and when an inference is fulfilled, the upshot network will pay out the fee collected for that request as rewards.
Request Fee Mechanism:
- Market-driven pricing: Consumers bid based on value and urgency of inference requests
- Escrow protection: Funds are held securely until inference delivery is confirmed
- Performance incentives: Higher quality inferences can command higher prices
- Direct value exchange: Clear connection between consumer payment and worker/reputer rewards
3. Token Inflationary Rewards
Allora has an inflationary token emissions schedule that halves on regular intervals, similar to Bitcoin. Newly minted tokens are paid out each block as rewards.
Inflation Schedule Benefits:
- Predictable supply: Known emission schedule provides economic certainty
- Network bootstrap: Initial higher inflation attracts early participants and secures network
- Long-term sustainability: Halving schedule ensures controlled long-term token supply
- Fair distribution: Block-by-block distribution ensures proportional reward allocation
Module Account Architecture
Module Accounts Used by Allora
The following represents the list of module accounts that are changed or important in the flow of funds across the Allora Appchain. We do not discuss the standard module accounts used in cosmos-sdk validator staking, as they are unmodified from the Cosmos SDK. Note that the actual string used for the module name is the name in (monospace) below:
Core Financial Modules
Mint (mint)
The Allora mint module account is the only account allowed to create new tokens. It creates new tokens during its BeginBlock according to the Allora inflation schedule and then immediately sends those token to the Fee Collector account.
Mint Module Functions:
- Token creation: Sole authority for creating new tokens on the network
- Inflation control: Implements predetermined inflation schedule and halving events
- Supply management: Maintains accurate total supply accounting
- Distribution initiation: Transfers newly minted tokens to fee collector for distribution
Fee Collector (fee_collector)
This module account collects all transaction fees on the network (this happens in the auth module during transaction execution).
Fee Collection Process:
- Transaction fee aggregation: Collects fees from all network transactions
- Inference payment processing: Receives payments from inference requests
- Distribution preparation: Accumulates funds for periodic reward distribution
- System integration: Works with auth module for seamless fee processing
Distribution (distribution)
The distribution module holds the tokens and does the balance accounting for cosmos validator staking. It takes funds from the fee collector account. Cosmos validators can withdraw their staked tokens and receive validator rewards from this module's RPC functions. The Allora codebase does not change this standard cosmos module, but we do frontrun it (described below).
Distribution Module Features:
- Validator reward management: Handles all validator staking rewards and withdrawals
- Standard Cosmos functionality: Unmodified implementation from Cosmos SDK
- Balance accounting: Maintains accurate records of validator stakes and rewards
- Withdrawal processing: Enables validators to claim rewards and unstake tokens
Allora-Specific Modules
Allora Rewards (allorarewards)
The Allora Rewards module account holds the tokens earned by reputers and workers for their services to the network. Reputers and workers share the collected transaction fees and inflationary rewards on the network with cosmos validators at a percentage rate set in the chain parameters. When rewards are paid out each block, the Allora Rewards module account pays the Allora Staking module, which then also increments the reputer or worker's stake appropriately.
Allora Rewards Functions:
- Worker/Reputer reward pool: Dedicated fund management for AI/ML participants
- Proportional distribution: Shares network rewards based on configured percentages
- Performance-based allocation: Distributes rewards based on contribution quality and accuracy
- Stake integration: Works with Allora Staking module for seamless reward compounding
Allora Staking (allorastaking)
Separate from the standard cosmos validator staking modules and workflow, Allora supports staking for our Reputer and Workers actor roles. The Allora Staking module account is our analog to the distribution module. It holds the tokens that stakers send to network when they deposit stake, and it also holds the rewards that stakers receive from transaction fees, newly minted token inflation, and inference request fees. When reputers or workers go to withdraw their stake, the rewards are automatically combined with their stake and automatically claimed.
Allora Staking Features:
- Specialized staking system: Custom staking implementation for workers and reputers
- Reward compounding: Automatic reinvestment of rewards into stake positions
- Integrated withdrawals: Combined stake and reward withdrawal in single transaction
- Role-specific logic: Tailored staking rules for different network participant types
Allora Requests (allorarequests)
The Allora Requests module account holds the tokens that are paid by Inference Consumers when they make an inference request. This module holds escrowed funds for subscriptions and only pays out when actual inferences are made upon that subscription. That means this module can hold funds for long periods of time before the transaction fees for a given subscription are actually paid out. It pays the Fee Collector account.
Request Module Functions:
- Escrow management: Secure holding of consumer payments until inference delivery
- Subscription support: Manages ongoing subscription-based inference requests
- Payment processing: Releases payments only upon successful inference completion
- Consumer protection: Ensures consumers only pay for delivered services
Block Execution and Payment Flow
Module Execution Order in a Block and the Impact on Payment Flows
In Cosmos SDK, before the transactions of a block are processed, modules are able to specify BeginBlock and EndBlock functions that run at the beginning and end of a block, respectively. Below you can see a snippet from Allora Chain's app.yaml file, which specifies the order that these functions should be run:
begin_blockers: [emissions, distribution, staking, mint]
end_blockers: [staking, emissions]Execution Order Strategy
The Cosmos SDK distribution module works by implementing a BeginBlock function that takes the money deposited in the Fee Collector account from the previous block. After that, the Mint module mints new tokens to the Fee Collector account. In the middle, transactions run, and pay their transaction fees, as well as inference request fees to the Fee Collector account.
The app.yaml places the Allora emissions module in front of the distribution module. This is where the percent_rewards_reputers_workers chain parameter takes some percentage of the Fee Collector's token balance, and sends it to the Allora Rewards module account. So basically, the Allora emissions module frontruns the distribution module to steal funds that it otherwise would have gotten, in order to take the percentage cut of rewards that belong to reputers and workers.
Chronological Payment Flow
New block starts. Call BeginBlock:
BeginBlock(emissions): allorarewards takes a percentage from fee_collector
BeginBlock(distribution): distribution takes all tokens left in fee_collector
BeginBlock(mint): mints new tokens to fee_collector
Block starts processing transactions
Auth module transfers transaction fees to fee_collector for each tx
Block about to end. Call EndBlock:
EndBlock(emissions): all inference requests are executed, their fees are paid to fee_collector
New block starts. Call BeginBlock...Flow Analysis
Strategic Execution Order:
- Priority allocation: Allora-specific rewards are allocated before standard Cosmos rewards
- Fair distribution: Ensures workers and reputers receive their designated share
- System integration: Seamless integration with standard Cosmos SDK modules
- Continuous operation: Cyclical process ensures consistent reward distribution
Economic Implications:
- Guaranteed allocation: Workers and reputers receive rewards before validator distribution
- Predictable percentages: Chain parameters define exact allocation percentages
- Network sustainability: Balanced reward distribution maintains all participant types
- Growth incentives: Proper incentives for network growth and quality improvement
Reward Distribution Mechanics
Rewards Epochs
Cosmos Validators can use the distribution module and staking module standard cosmos functions to manipulate their validator stake and claim their validator rewards.
For Reputer and Worker rewards, the epoch_length chain parameter controls how often the reputer and staker rewards are paid out. Every epoch_length epochs, the rewards calculation will run in the emissions EndBlock, which will cause the Allora Rewards module account to pay the Allora Staking module account directly. The Allora Staking module will then increase the staking balances of all actors who are paid rewards as part of this procedure. In this way Allora is able to autocompound stake positions.
Finally when a Reputer or Worker wishes to withdraw their stake, they do so, and the rewards are automatically combined with their stake and automatically claimed by the reputer or worker in one lump sum.
Epoch-Based Distribution Benefits
Automated Compounding:
- Reward reinvestment: Automatic compounding of rewards increases stake positions
- Gas efficiency: Batch processing reduces individual transaction costs
- Simplified management: Users don't need to manually claim and restake rewards
- Enhanced returns: Compounding effect increases long-term earnings potential
Withdrawal Efficiency:
- Unified process: Single transaction combines stake withdrawal and reward claiming
- Reduced complexity: Simplified user experience for fund management
- Cost optimization: Fewer transactions reduce overall network fees
- Immediate liquidity: Direct access to both stake and accumulated rewards
System Integration
Cross-Module Coordination
Module Interaction Benefits:
- Seamless operation: All modules work together without user intervention
- Consistent state: Synchronized updates across all relevant modules
- Economic coherence: Balanced incentives across all network participants
- Operational efficiency: Automated processes reduce manual management requirements
Network Health Indicators
Financial Health Metrics:
- Module balance tracking: Monitor fund levels across all module accounts
- Reward distribution ratios: Verify correct percentage allocations
- Stake growth patterns: Track network participation and engagement
- Economic sustainability: Ensure long-term viability of incentive structures
Prerequisites
- Blockchain fundamentals: Understanding of blockchain architecture and token economics
- Cosmos SDK knowledge: Familiarity with Cosmos SDK module system and architecture
- Economic principles: Basic understanding of incentive mechanisms and token distribution
- Technical literacy: Ability to interpret technical documentation and system specifications
Next Steps
- Explore chain parameters for detailed configuration settings
- Study emission mechanisms for inflation and reward calculations
- Learn about staking parameters for network participation rules
- Review consensus parameters for network operation details