Minter
Abstract
The minter
module manages controlled token emissions in a Cosmos-SDK based blockchain. It defines a configurable set of minters, each responsible for emitting a certain amount of tokens over a specified period or according to a given emission model. This allows for detailed control over the inflation schedule and the total supply growth over time.
Contents
Concepts
The minter
module is designed to manage the token emission (inflation) process. The emission process is defined as a set of consecutive or parallel minters, each with its own configuration. There are multiple minting configurations supported:
NoMinting: Emits no tokens.
LinearMinting: Emits a fixed amount of tokens linearly over a specified period.
ExponentialStepMinting: Emits tokens in "steps." Each step lasts a certain duration and mints a given amount of tokens. After each step, the amount for the next step is multiplied by a configured factor, typically used to gradually reduce emissions over time.
At a high level:
The entire emission schedule is composed of one or more minters chained together.
Each minter may have an optional end time. The last minter can be infinite or have special rules (e.g., no end time for perpetual emission).
Complex scenarios can be defined, such as a few years of linear emission followed by a perpetual no-minting phase, or a halving mechanism using exponential step minting.
Params
minter
module parameters include:
MintDenom: The denomination of the token being minted.
StartTime: The time when emission (minting) begins.
Minters: A list of
Minter
objects, each defining:SequenceId: The identifier/order of this minter.
EndTime (optional): The time when this minter stops minting. The last minter may omit this for unlimited emission or for specific types like NoMinting.
Config: The minting configuration, one of:
NoMinting
LinearMinting (with an
amount
parameter)ExponentialStepMinting (with
amount
,step_duration
, andamount_multiplier
parameters)
State
The module stores:
MinterState: Tracks the current emission progress of the active minter, including:
Current
SequenceId
AmountMinted
: How many tokens have been minted by the current minter so far.RemainderToMint
: Unminted remainder from previous blocks.RemainderFromPreviousMinter
: Any leftover from a previous minter that should carry over.LastMintBlockTime
: The block time of the last mint operation.
StateHistory: A history of completed minters` final states for audit and analysis.
Messages
The minter
module supports messages for administration and adjustments:
MsgBurn: Allows a user to burn a specified amount of their tokens, permanently removing them from total supply.
MsgUpdateParams: Allows authority (e.g., governance) to update the module parameters (mint denom, start time, minters configuration).
MsgUpdateMintersParams: Allows authority to specifically update the minters` configuration without changing the denom.
Events
The minter
module emits events during the minting process and message handling:
EventMint: Emitted at the beginning of a block if tokens are minted. Attributes include:
bonded_ratio
: The staking bonded ratio (if relevant).inflation
: The current inflation level.amount
: How many tokens were minted this block.
When burning tokens:
burn and coin_spent events are emitted indicating the burner and the amount.
Queries
The minter
module provides queries to inspect its state:
Params: Returns the current module parameters.
Inflation: Returns the current inflation rate.
State: Returns the current
MinterState
and itsStateHistory
.
Genesis and Validation
At genesis:
minter
parameters and the initialMinterState
are set.The module validates that:
The
MintDenom
is not empty.The minters are defined correctly, ordered by
SequenceId
, and follow the rules (e.g., the last minter should not haveEndTime
, linear minters must have anEndTime
, etc.).The initial
MinterState.SequenceId
is present among the defined minters.
If all validations pass, the initial state is set, and the module is ready to mint according to the schedule.
Client
CLI
The CLI allows querying state and parameters, as well as sending MsgBurn
transactions. For example:
Query Params:
Query State:
Query Inflation:
Burn Tokens:
gRPC and REST
The module also exposes gRPC endpoints for the queries listed above. The Msg
services can also be invoked through gRPC or REST endpoints depending on the chain`s configuration.
Examples
Linear Minting for 1 Year, then No Minting:
Minter 1 (SequenceId=1): LinearMinting of 100 million tokens from start_time to start_time+1year.
Minter 2 (SequenceId=2): NoMinting from there on.
Exponential Step Minting (Halving every 4 years):
Minter (SequenceId=1): ExponentialStepMinting starting with 40 million tokens in the first 4-year step, halving every subsequent 4-year period indefinitely.
These configurations allow for custom-tailored emission schedules, enabling controlled inflation and supply dynamics for the chain`s native token.
License
This module is based on Chain4Energy project, licensed under the Apache License 2.0. Appropriate attribution and inclusion of the license notice may be required. For details, please refer to the project`s license files and the Apache License 2.0 text.
Last updated