Skip to content

Conversation

@illuzen
Copy link
Contributor

@illuzen illuzen commented Dec 18, 2025

  • 21m max coins
  • 50% mining rewards go to treasury
  • heuristic: emit tokens = (max_supply - current_supply) / constant

this heuristic results in a close approximation of an exponential curve. The constant is chosen so that, with no burns, the token supply will be 99% emitted in about 45 years.

TryInto::<u128>::try_into(current_supply),
TryInto::<u128>::try_into(tx_fees),
) {
let unit = 1_000_000_000_000u128;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we store the decimals somewhere? So we could grab them from there instead of hard code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use UNIT actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately there's no easy way to access it, it's in a different crate, I think it's better to redefine it here instead of creating a dependency, especially since it's only used for logging.

Copy link
Collaborator

@n13 n13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers should be normalized, ie just multiply by UNIT so they're all absolute values of QUAN.

Copy link
Collaborator

@czareko czareko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All magic numbers should go to the pallet configuration; besides that, it looks good.
Maybe 45 years is a bit too long?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements an exponentially decaying token emission schedule for mining rewards, replacing the previous fixed block reward system.

  • Introduces a dynamic emission formula: reward = (max_supply - current_supply) / emission_divisor that approximates exponential decay
  • Sets a 21 million token maximum supply with 50% of mining rewards allocated to the treasury
  • Adjusts genesis configuration to allocate 30% of max supply (6.3M tokens) to the treasury at launch

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
runtime/src/genesis_config_presets.rs Updates genesis balances to allocate 100,000 tokens per endowed account and 6.3M tokens to treasury (30% of max supply)
runtime/src/configs/mod.rs Configures mining rewards pallet with MaxSupply (21M), EmissionDivisor (26.28M), and TreasuryPortion (50%) parameters
pallets/mining-rewards/src/lib.rs Implements dynamic reward calculation based on remaining supply, splits rewards between treasury and miners, adds detailed logging
pallets/mining-rewards/src/mock.rs Updates test configuration with new emission parameters (scaled for test simplicity) and removes fixed reward constants
pallets/mining-rewards/src/tests.rs Refactors all tests to calculate expected rewards dynamically rather than using hardcoded values
pallets/mining-rewards/simulate_emissions.py Adds Python simulation script to model the emission schedule over time and analyze curve characteristics

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@illuzen
Copy link
Contributor Author

illuzen commented Dec 19, 2025

Maybe 45 years is a bit too long?

Maybe, but I also was trying to keep the initial inflation below 10%, it's currently 7%. I have a spreadsheet I can show you.

Copy link
Collaborator

@n13 n13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now

@illuzen illuzen merged commit 5ea391b into main Dec 19, 2025
4 checks passed
illuzen added a commit that referenced this pull request Dec 22, 2025
* exponentially decaying token rewards

* script to simulate emissions

* clean up constants and switch python script to rust test

* log if we hit max supply somehow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants