For some proof of stake blockchain systems, there is a penalty if the node goes down during staking. Will there be some sort of penalty if an ETH 2.0 staking node went down? And if there isn't how does it stop stakers from power up and down their node to mess with the network?
2 Answers
Yes there are penalties for being offline. In "normal" (non-activity leak) circumstances, a validator loses approximately 15.8% of their stake per year they are offline. That's ~1.4% for being offline for a month or ~0.3% for being offline for a week.
Specifically, validators that fail to create attestations will suffer penalties. When the network is failing to finalize (as mentioned by @lauri-peltonen) those penalties are much more severe. These severe penalties are also refered to as the "inactivity leak" which is intended to quickly eject (by means of reducing balance) offline validators so the online validators can form a majority and resume finalization.
The calculation of penalties in Eth2 is not straight-forward; along with the inactivity-leak, the penalties also take into account the balance of the validator and the total balance of all validators. To arrive at the 15.8% number I used the following script that I derived from v0.11.1 of the canonical Eth2 specification:
DEPOSIT_AMOUNT = 32 * 10**9
VALIDATOR_COUNT = 16384
BASE_REWARD_FACTOR = 64
BASE_REWARDS_PER_EPOCH = 4
SECONDS_PER_SLOT = 12
SLOTS_PER_EPOCH = 32
SECONDS_PER_YEAR = 31557600
EPOCHS_PER_YEAR = SECONDS_PER_YEAR // (SECONDS_PER_SLOT * SLOTS_PER_EPOCH)
def integer_squareroot(n):
"""
Return the largest integer ``x`` such that ``x**2 <= n``.
"""
x = n
y = (x + 1) // 2
while y < x:
x = y
y = (x + n // x) // 2
return x
def get_base_reward(total_balance, effective_balance):
return effective_balance * BASE_REWARD_FACTOR // integer_squareroot(total_balance) // BASE_REWARDS_PER_EPOCH
total_balance = DEPOSIT_AMOUNT * VALIDATOR_COUNT
validator_balance = DEPOSIT_AMOUNT
for _ in range(EPOCHS_PER_YEAR):
penalty = get_base_reward(total_balance, validator_balance) * 3
validator_balance -= penalty
total_balance -= penalty
total_penalty = DEPOSIT_AMOUNT - validator_balance
print("Final balance: {}".format(validator_balance))
print("Total penalty: {}".format(total_penalty))
print("Reduction %: {}".format(100 * total_penalty / DEPOSIT_AMOUNT))
The output of this script is:
Final balance: 26935963853
Total penalty: 5064036147
Reduction %: 15.825112959375
This is a very rough approximation (some factors like hysteresis are ignored) and the 15.8% number is very subjective. In the real-world it's likely that the total_balance
will increase as existing validators earn rewards and new validators join. Conversely, it's possible that the total balance will decrease and penalties will increase due to an inactivity-leak.
Whilst you can't trust this 15.8% p/a penalty to be constant, you can hopefully get an idea about the magnitude of the offline penalty.
Note: these values were previously off by a factor of 3, they have been updated now. My apologies.
-
Wondered a while how you can know so much about this until checked your profile :) Great to have you answering such questions here! Commented Apr 2, 2020 at 5:20
-
My pleasure! It's a great way to solidify my understanding of things I haven't visited in a while :) Commented Apr 2, 2020 at 5:43
-
What's a simple explanation without all the tech lingo? If I stake 32 ETH, so I would lose 5.5% of the 32 ETH if I'm offline for even 1-10 seconds? Commented Apr 2, 2020 at 16:32
-
An offline validator loses 5.5% per year they are offline. If you're offline for 1-10 seconds, chances are you won't miss anything and you won't lose anything. But, if you're offline for a month you're likely to lose ~0.4% of your stake. If you're offline for a week, you lose ~0.1%. Commented Apr 2, 2020 at 23:15
-
I just updated the numbers since I was off by a factor of 3. Thanks to Danny Ryan for review. Patoshi, I updated the first paragraph to answer your question Commented Apr 2, 2020 at 23:54
Yes there is a penalty for being offline. A quote from article at https://ethos.dev/beacon-chain/ :
Basically, if there have been more than four epochs since finality, all validators suffer an inactivity penalty that increases quadratically until a checkpoint is finalized
You can check earlier in the article what an "epoch" means.