testnet
GitHub

OKRW Minting Process

mechanism economics

The controlled, two-step mechanism for creating new OKRW tokens.

The OKRW minting process is a secure, on-chain workflow that allows a designated minter to create new aokrw tokens and send them to a recipient. It is designed to be transparent and auditable, relying on the underlying x/bank module for token lifecycle management while enforcing strict authorization checks within the x/okrw module itself.

Authorization

The entire process is gated by the minter_address parameter. Only a transaction signed by the private key corresponding to this address can successfully execute a MsgMint. If any other address attempts to send this message, the transaction will fail with an unauthorized error. This address is initially empty and must be set by a governance proposal, effectively giving the community control over the token supply.

Step 1: Minting to the Module Account

When an authorized MsgMint is processed, the x/okrw module does not directly create tokens in the recipient's account. Instead, it first invokes the MintCoins function from the x/bank keeper. This function creates the specified amount of aokrw and credits them to the x/okrw module's own account. This step officially increases the total supply of aokrw on the network.

Step 2: Transfer to Recipient

Immediately after the tokens are minted to the module account, the x/okrw module performs the second step: it calls the SendCoinsFromModuleToAccount function from the x/bank keeper. This function transfers the newly created tokens from the x/okrw module account to the recipient address specified in the original message. This two-step atomic operation ensures that tokens are never permanently held by the module account and that the supply increase is always matched by a corresponding distribution.

Event Emission

Upon successful completion of the mint and transfer, the module emits a mint event. This event contains three key attributes: minter, recipient, and amount. This on-chain event provides a verifiable and easily indexable record of all minting activities, allowing block explorers and other services to track the OKRW supply transparently.
Source: maroo
ESC
Type to search