0

Is it possible to have fixed validator rewards on each epoch in a NPoS consensus based substrate chain. This suggests that the rewards are based on inflation and stake rate, and I've not seen any implementations with fixed rewards either.

Is it possible to do that?

1 Answer 1

3

Totally possible. The reward paid our per era is provided to staking as type EraPayout, which can be anything that implements trait EraPayout. You can have an implementation for this trait that ignores all the inputs and provides a constant value at each era.

A substrate-idiomatic way of doing that would be:

// Assuming this balance type.
type Balance = u128;

pub struct FixedEraPayout<P: Get<Balance>>(sp_std::marker::PhantomData<P>);
impl<P: Get<Balance>> EraPayout<Balance> for FixedEraPayout<P> {
    fn era_payout(
            _total_staked: Balance,
            _total_issuance: Balance,
            _era_duration_millis: u64,
        ) -> (Balance, Balance) {
        (P::get(), 0)
    }
}

Then you can reuse e.g. FixedEraPayout<ConstU128<100_000>> in different runtimes.

2
  • Thanks. It's working perfectly fine. But, I'm still curious how does it relate to inflation and staking rate, mentioned here ?
    – Discardo
    Jan 30, 2023 at 5:43
  • That is the specific staking rate adopted by Polkadot, which can be implemented using this API. Substrate is end of the day more generic and beyond "just Polkadot".
    – kianenigma
    Feb 6, 2023 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.