Introducing Harmony’s Effective Proof-of-Stake (EPoS)

Rongjian Lan
Aug 10, 2019 · 8 min read
Image for post
Image for post

(*EPoS is already launched on Harmony Mainnet! Please follow this guide to participate.)

In May this year, we published Harmony’s initial design of a bidding-based staking mechanism. Since then, we’ve received feedback and suggestions from different parties, including staking-as-a-service companies, individual validators, and also Vitalik. We’ve taken seriously the feedback such as the potential operational burden of repeated bidding and the strong requirement of validating for 7 epochs (7 days). There are also unanswered questions such as how to support delegation and how to compound block rewards in a sharding-based blockchain. With this article, we discuss the design thinking of PoS systems and introduce a new staking mechanism called Effective Proof-of-Stake (EPoS). EPoS is designed to solve all of these issues while still maintaining the decentralization aspect of the blockchain.

How to Elect Validators

Most of the current PoS blockchains have a concept of committee which is a group of validators (a.k.a. block producers, endorsers etc.) who have the right to produce and validate blocks. Usually, the committee has a limited number of seats (e.g. 21 for EOS and 100 for Cosmos). The question of validator election is basically — how to decide who gets the seats in the committee? This is theoretically the same question of how to distribute limited resources in real world economy. In our economy, the way to distribute limited resources can be, but not limited to, 1) by pricing or bidding, meaning whoever pays the highest price will get it; 2) by social criteria, such as title and reputation; 3) by time, as in the time spent in the line for a limited edition product; 4) or by random selection, as in a lottery.

In fact, the way to select the validators in the committee is being solved by similar solutions. Let’s take a look at some of the common approaches in PoS blockchains:

The ways to elect validators are not limited to the above and other factors such as the token age (time), as in Peercoin, were also used before.

Generally, we believe using staked tokens as criteria is the most efficient and economically secure way for validator election, as the stakes closely ties the validators incentives with the well-being of the blockchain itself. We decided to go with the first option for its simplicity and effectiveness. Option 2 gives fair chance to all stakers, but the issue is that for a good amount of time the potential validators are just idling there, waiting to be selected, which comes at a considerable opportunity cost for potential validators.

How to Distribute Block Rewards

Generally, a PoS blockchain issues token rewards for every block that validators sign to incentivize their participation in the consensus. In most of the existing PoS blockchains, the validators will earn block rewards in proportion to the amount of stake they put in. This kind of design has the problem of “the rich get richer” which usually leads to stake centralization. For example, as of this writing, the top 10 validators in Cosmos holds more than 50% of the total staked tokens.

One of the alternatives which mitigates this problem is to give equal rewards to all validators regardless of their stakes — this is what we proposed in our initial staking design (a similar idea was also described in Polkadot’s staking model). Giving equal rewards will push for an even distribution of stakes among validators as big stakers will have less return compared to small stakers. Nonetheless, entities with a lot of stake can still act as multiple small stakers by dividing their stakes. So the problem of “the rich get richer” is not fully solved, but only alleviated in some sense.

In addition to the design considerations discussed above, other practical factors are also critical in creating a staking economy that is friendly to validators. Block rewards compounding is an important method for validators to maximize their return. In this regard, the design of equal block reward is prohibitive for compounding as re-staking the reward won’t produce more return. Moreover, the support for delegation has been a standard requirement for PoS blockchains as it allows normal token holders to stake without running as validators. Our original bidding-based design doesn’t lend itself well to delegation as bidding is an uncertain action which may lead to biased or insufficient usage of the delegator’s tokens.

On top of that, a specific design constraint in Harmony’s sharded blockchain is that for each shard it needs to contain a relatively large number of validators with equal or similar stake (for more detail, please refer to our whitepaper). Otherwise, a validator with large amount of stake can easily overtake a single shard (a.k.a. 1% attack).

With all the above, our design goals are the following

  • Avoid uneven stake distribution among validators
  • Support delegation without ambiguity
  • Allow easy compounding of block rewards

Preventing Centralization with Effective Proof-of-Stake

We introduce Effective Proof-of-Stake, an efficient staking mechanism that avoids stake centralization while still supporting stake compounding and delegation.

Validator Election

As mentioned above, we will adopt the mechanism that elect the highest ranked validators based on stake as the committee. Specifically, for every epoch (~ 1 day), the top 1600 stakers will obtain the 1600 seats (4 shards * 400 seats) and become the validators across the shards. Once the epoch changes, the new rank of stakes will determine the validators for the next epoch.

Block Rewards based on Effective Stake

We’ve shared above that neither pro-rata rewards nor equal rewards is an optimal and fair choice for our design goals (specifically the even distribution of stakes and the ability to compound stake and returns). In EPoS, the validators will be rewarded in proportion to their effective stake, which is defined in the formula below. We use median_stake to denote the amount of stake at median in the ranked list of top 1600 stakers, and actual_stake is the actual stake hold by the validator.

Image for post
Image for post

Here, c is a protocol parameter (for example, c = 0.15). The effective stake of a validator is basically its actual stake bounded by the upper limit of (1 + c) * median_stake and the lower limit of (1 — c) * median_stake.

Besides the block reward, the voting power of each validator in the consensus is also determined proportionally by the validator’s effective stake.

Image for post
Image for post
Validator’s Effective Stake and the Curve of Actual Stake

With the introduction of effective stake, the higher ranked validators are actually economically punished to stake too much in a single validator and the lower-ranked validators are enjoying extra reward for their stake. The effective stake is acting as an equalizer that pushes for a more evenly distributed stake among validators, thus avoiding stake centralization.

For compounding, the validators in the yellow area are economically incentivized to spin up new validator machines to “compound” their rewards. In terms of staking pool, this design is forcing the staking pools to decentralize themselves and avoid single point of failure. The nodes in the blue and green area can directly compound by re-staking their reward in the same validator.

In terms of delegation, token holders can freely choose one of more validators to delegate their tokens based on their commission rate, uptime and their position in the rank. The block rewards will be distributed to delegators pro-rata after the commission fee set by the validator is deducted. For delegators, It’s economically more rewarding to delegate to the validators in the green area as the return to stake ratio is higher, thus avoiding the stake centralization too.

With these design features, we can achieve our goals of supporting delegation, compounding stake while preserving decentralization.

Slashing Mechanism

In addition to the block rewards used to incentivize good behavior, the slashing mechanism is equally important as it can deter misbehavior and potential attacks. In EPoS, we will employ the following slashing rules.

Double Signing

  • Minimum 2% slashing on the stake. The slashing increases linearly as the number of validators being slashed at the same time (e.g. 33% slashing if 1/3 of the validators double signing)
  • Note: the staking mechanism’s push for big stakers to decentralize themselves comes in handy with the slashing rule. If the big staker initiates attack with all of their nodes together, more slashing will be applied on their stake.

Unavailability

  • At the end of each epoch, the validators with uptime of no more than 2/3 (66.66%) will have their status set to “Inactive” and be ruled out from the new election. No slashing is applied to unavailable validators.
  • For those inactive validators who wants to rejoin the election, they should manually set their status to “Active” by sending an EditValidator transaction.

At last

Staking mechanisms and incentive models are core components of PoS blockchains. To some degree, they are as important as the blockchain protocol. The information about staking mechanism and incentive models of current PoS blockchains are scattered in many places and it’s hard to have a clear picture of how these systems compare. In that regard, we compiled a comparison chart of PoS designs among a few major projects. You can also find more details about Harmony’s staking workflow there.

For potential validators who wants to test out EPoS before it’s released in mainnet, welcome to join Pangaea — an incentivized game on Harmony network. The result from Pangaea will provide more evidence that will help further fine tune the design of EPoS and make it ready for the mainnet.

Harmony

To scale trust for billions of people and create a…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store