PoA Module API Documentation
Overview
The Proof of Authority (PoA) permissioned consensus module provides a governance mechanism for managing validators in a Cosmos SDK blockchain. Unlike traditional Proof of Stake, PoA allows a designated admin to control validator set membership and voting power distribution. Package:cosmos.poa.v1
Go Import: github.com/cosmos/cosmos-sdk/enterprise/poa/types
Core Concepts
- Admin Control: A single admin address has exclusive authority to manage validators and module parameters
- Validator Management: Create validators, update voting power, and manage the active validator set
- Fee Distribution: Validators accumulate fees that can be withdrawn by their operators
- Dynamic Updates: Changes to the validator set are applied without stopping the chain
Data Types
Validator
Represents a validator in the PoA system.pub_key(Any): The validator’s consensus public key (typically/cosmos.crypto.ed25519.PubKey)power(int64): Voting power for this validator (use0to remove a validator)metadata(ValidatorMetadata): Additional validator informationallocated_fees(DecCoin[]): Accumulated fees allocated to this validator
ValidatorMetadata
Metadata information about a validator.moniker(string): Human-readable name for the validatordescription(string): Optional description of the validatoroperator_address(string): Cosmos SDK address that operates this validator
Params
Module parameters.admin(string): Cosmos SDK address with administrative privileges
ValidatorFees
Represents fee allocations for a validator operator.fees(DecCoin[]): List of coins representing allocated fees
Query API
The Query service provides read-only access to PoA module state.Params
Get module parameters. gRPC:cosmos.poa.v1.Query/Params
REST: GET /cosmos/poa/v1/params
Request:
Validator
Query a single validator by address. gRPC:cosmos.poa.v1.Query/Validator
REST: GET /cosmos/poa/v1/validator/{address}
Request:
addresscan be either a consensus address or operator address
Validators
List all validators in the system. gRPC:cosmos.poa.v1.Query/Validators
REST: GET /cosmos/poa/v1/validators
Request:
- Results are always returned in descending order by voting power
- Supports pagination for large validator sets
WithdrawableFees
Query fees available for withdrawal by a validator operator. gRPC:cosmos.poa.v1.Query/WithdrawableFees
REST: GET /cosmos/poa/v1/allocated_fees/{operator_address}
Request:
TotalPower
Get the total voting power across all validators. gRPC:cosmos.poa.v1.Query/TotalPower
REST: GET /cosmos/poa/v1/total_power
Request:
Transaction Messages (Msg Service)
The Msg service handles state-changing operations.UpdateParams
Update module parameters (admin only). gRPC:cosmos.poa.v1.Msg/UpdateParams
Message:
CreateValidator
Create a new validator with zero voting power (operator initiates, admin must activate). gRPC:cosmos.poa.v1.Msg/CreateValidator
Message:
- The validator will not participate in consensus until the admin updates its power to a non-zero value
- Public key must be a valid consensus public key (typically Ed25519)
UpdateValidators
Update validator set (admin only). This is the primary mechanism for managing validators. gRPC:cosmos.poa.v1.Msg/UpdateValidators
Message:
- Can update multiple validators in a single transaction
- Setting
power: 0removes a validator from the active set - Changes propagate to CometBFT consensus in the next block
- Missing fields in metadata are preserved from existing state
WithdrawFees
Withdraw accumulated fees to the operator’s account. gRPC:cosmos.poa.v1.Msg/WithdrawFees
Message:
- Transfers all accumulated fees to the operator’s account
- Fees are denominated in the chain’s native token(s)
RotateConsPubKey
Replace a validator’s consensus public key in place. gRPC:cosmos.poa.v1.Msg/RotateConsPubKey
Message:
- Re-keys the validator and migrates its accrued fees in the same block
- Power, metadata, and the operator address are unchanged
- No fee, no rate limit, and no rotation history, unlike
x/stakingrotation - The new key’s type must be in the chain’s consensus params, must not equal the current key, and must not belong to another validator
Common Use Cases
1. Query Current Admin
2. List All Active Validators
3. Add a New Validator
Step 1: Operator creates the validator:4. Change Validator Voting Power
5. Remove a Validator
6. Withdraw Validator Fees
7. Transfer Admin Rights
REST API Endpoints
All query endpoints are available via REST:
Example REST Query:
Error Handling
Common error scenarios:Unauthorized Admin Action
Error: Transaction rejected Cause: Non-admin attempted to call admin-only function Solution: Ensure transaction is signed by the admin accountInvalid Public Key
Error: Invalid validator public key Cause: Malformed or wrong type of public key Solution: Use Ed25519 public key in correct formatValidator Not Found
Error: Validator does not exist Cause: Querying non-existent validator Solution: Verify validator address/public keyInsufficient Fees
Error: No fees to withdraw Cause: Validator has no accumulated fees Solution: Wait for fees to accumulate from block rewardsIntegration Examples
JavaScript/TypeScript (CosmJS)
Python (cosmpy)
Go
Security Considerations
- Admin Key Security: The admin private key has complete control over the validator set. Use hardware wallets or secure key management systems.
- Validator Public Keys: Ensure validator public keys are correctly generated and stored securely.
- Power Distribution: Consider the security implications of power concentration. Avoid giving a single validator >67% of total power.
- Operator Separation: Use separate accounts for operator and admin roles to limit exposure.
- Fee Withdrawal: Operators should regularly withdraw fees to prevent accumulation in the module.
Appendix
Public Key Formats
Ed25519 public keys should be base64-encoded:Address Formats
- Operator Address: Standard Cosmos SDK bech32 address (e.g.,
cosmos1...) - Consensus Address: Can be derived from public key or use operator address for queries
Power Units
- Voting power is represented as
int64 - Total power affects block signing requirements (typically need >2/3 of total power for consensus)
- Zero power effectively removes a validator from the active set