Skip to content

Instantly share code, notes, and snippets.

@alonmuroch
Created January 11, 2021 08:18
Show Gist options
  • Save alonmuroch/c2dc5eaa32943273de26f8b2c016cfcd to your computer and use it in GitHub Desktop.
Save alonmuroch/c2dc5eaa32943273de26f8b2c016cfcd to your computer and use it in GitHub Desktop.
get_base_reward
def get_base_reward(state: BeaconState, index: ValidatorIndex) -> Gwei:
total_balance = get_total_active_balance(state)
effective_balance = state.validators[index].effective_balance
return Gwei(effective_balance * BASE_REWARD_FACTOR // integer_squareroot(total_balance) // BASE_REWARDS_PER_EPOCH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment