Staking in Nym — introducing mainnet mixmining

Nym
nymtech
Published in
13 min readApr 28, 2022

--

A decorative image showing the NYM token logo.

The Nym mainnet reward sharing scheme is about to be activated. In the Nym mixnet, mix nodes are rewarded for mixing packets, performing the work of protecting privacy. The shorthand for this is “mixmining” and this blogpost explains the mixmining reward scheme, namely bonding and delegating stake and earning rewards in the Nym mixnet.

  • In order to run a mix node you have to bond stake (native NYMs).
  • If you don’t want to run a node you can delegate stake (native NYMs) and earn a share of a node’s rewards.
  • Bonded + delegated stake = a mix node’s total reputation.
  • Reputation and uptime determines the rewards a node receives.

Now let’s get into the details…

The Nym mixnet is designed to have a certain size: big enough, ensuring that there is enough capacity to route all the user traffic, but not too big, which would waste resources without increasing privacy.

Every epoch (approximately 1hour) the network will pick a set of nodes and place them as active and standby node sets. This is the reward set, and all these nodes will receive rewards for that epoch. The active set will mix packets and therefore receive higher rewards for the epoch than the standbys, but the standby set will also receive rewards for making themselves available should there be a sudden spike in demand.

Here are the initial parameters of the reward scheme:

Total reward set: 720

Active set: 600

Standby set: 120

Node selection rate: nodes are resampled and reassigned to the mixnet every epoch (1 hour)

Reward rate from mixmining pool: max 2% of the reward pool (starting at 250M) is emitted every 720 hours (approximately a month) with 1/720 of the budget made available each hour (epoch) for rewards.

I want to run a Nym node — what does this mean for me?

(If you want to stake in Nym but don’t want to run a node, scroll down to the next section)

Running a node allows you to be part of the Nym infrastructure, provide privacy, and be rewarded for it. Once you have your native NYM tokens, you can set up a node by following the instructions in the docs.

You need to register your node or in other words bond some NYM tokens to it for it to be a candidate considered for the reward set in the mixnet. Once you set up and initialise your node, you can put up the bond via your CLI or your Nym wallet. The initial bond required to register a mix node is minimum 100 NYMs. If you bought option 2 in the NYM public sale or will be receiving NYM rewards for participating in the previous testnets, you will see both locked and unlocked tokens in your balance page.

The Nym wallet interface, showing a token vesting schedule.

You can use both locked (unvested) and unlocked (vested) tokens for staking, meaning that you can register a node even if your tokens are still locked in a vesting contract!

In the bond section of the wallet, simply select the token pool you want to use, balance or locked, to bond on your node.

A part of the Nym wallet interface showing where you can select which token pool (balance or locked tokens if you are on a vesting schedule) you would like to draw from as a bond for your node.

NOTE: The higher the amount of tokens that you bond as stake when registering your node, the higher the reward rate that you will receive!

In fact, the size of a node’s bond is one of the factors considered by the reward algorithm, which increases reward rates for nodes with more “skin in the game”. (This acts as a Sybil defense mechanism, encouraging people to bond their stake to a single node rather than many).

There are two additional important configuration parameters that affect your rewards: the operational cost and the profit margin. At present the default operational costs are set at approximately $40 per node, but in the future this will be configurable by operators. The cost should reflect your monthly expenditure for running the node (eg, hardware and bandwidth costs). The profit margin is the percentage of rewards that you take before sharing the rest to people who have delegated to your node. The default is set to 10%, and you can configure this via CLI or wallet.

Simply go to the network explorer and search for your node to see it’s stats.

Attracting delegators to your node — it’s important!

It is important to attract delegations to your node as that will increase your node’s total reputation and therefore its rewards. Our token economic simulations show that even if you don’t have a lot of tokens to begin with, you can earn significant rewards by running a mix node that attracts a lot of delegates (people staking on your node).

The total stake of a node (including both the operator’s bond and all the delegations) determines the node reputation. Reputation is capped at the stake saturation point, which is currently around one million NYM per mix node. (The stake saturation point is given by the amount of NYM that would be staked in each node when all the available (i.e., not in the mixmining reserve) token supply (750 million NYM) is equally distributed among 720 nodes). At this point, a node has maximum reputation and thus can get maximum rewards. Any additional stake will not increase rewards, so this means there is no point adding additional stake. (This serves as a ‘soft cap’ to mitigate against stake centralizing on a small amount of nodes).

As a mix node candidate, it is to your benefit to offer attractive parameters (cost and profit margin) for people delegating stake, so you get as close as possible to stake saturation and thus maximum reputation. You can attract delegates by having a low cost of operations and generous sharing of rewards, but you can also offer other appealing externalities, such as giving some proceeds to a good cause that may resonate with delegates.

  • When declaring your operational costs, it is in your best interest is to accurately report your real costs: if you overestimate your costs you will make your node less attractive to delegates as that eats into their reward shar. If you underestimate them, you miss out on cost compensation for running the node.
  • When declaring profit margin, a higher profit margin will allow you to take bigger reward share from delegates. But this will at the same time make your node less attractive to delegates and therefore less likely to receive delegated stake.

As a node operator, you may also capitalize on reputation in other mediums (e.g., nodes run by a well-recognized organization or an active member of the community may be more trusted to some delegates).

What affects mix node rewards the most?

The reward algorithm considers multiple factors to determine a node’s rewards. In the first instance, your node’s reputation is what affects rewards the most. High reputation nodes get selected to the reward set more frequently and are rewarded at higher rates whenever they are selected.

But having a good reputation is not enough! Your node’s performance is also critical to obtaining rewards. If a node is offline or not adequately routing packets, this will diminish the node’s rewards proportionally to the percentage of downtime. Bad performance may mean that delegates undelegate their stake from your node, as they may prefer supporting better performing nodes that distribute more rewards and contribute to a better privacy service.

Finally, the reward algorithm gives a premium to node operators with more “skin in the game”: Nodes that have high bonded stake (also capped at the saturation point) receive slightly better reward rates than nodes with low bond but high delegations. This is a Sybil resistance mechanism to incentivise node operators to put their tokens into one node instead of running many nodes.

Taking all this into account, how much you take home is thus determined by the combination of your node’s reputation, performance, amount of bond, cost of operations and declared profit margin.

How are rewards distributed?

Once rewards are allocated to a node, they are further divided among the node operator and the delegates supporting the node with their stake. First, the declared node cost is subtracted from the rewards and refunded to the operator, to prioritize the coverage of the network’s operational costs. The remaining node rewards (if any) are distributed among the operator and delegates proportionally to each holder’s stake on the node, taking into account that a percentage (determined by the node’s profit margin) of the delegate rewards are taken by the operator as fee.

Rewards are distributed to mix nodes and delegators every epoch. You don’t need to take any further action, these are simply being compounded and accounted for in the blockchain. Note that the rewards will not turn up in your wallet unless and until you actively withdraw them, which requires a small tx fee for the blockchain operation. You can query your current reward rate at any time.

What does it mean to be “selected” to the network?

The Nym mixnet is designed to have a certain size, ensuring that there is enough capacity to route all the user traffic, and also to not be too big, which would waste resources without increasing privacy.

As an initial parameter, 720 nodes are rewarded at any given time (this number can be increased via governance mechanisms when network usage grows to the point where more nodes are needed to handle all the traffic).

If there are more than 720 registered mix nodes, every epoch (hour) the algorithm will randomly select 720 nodes from all the candidates. Nodes are sampled proportionally to their reputation, meaning that high reputation nodes are selected more frequently for rewards than low reputation nodes. Note however that even low reputation nodes will still have some chances to participate in the mixnet and be rewarded! And by demonstrating good performance whenever selected, low-reputation nodes have opportunities to attract delegated stake to increase their reputation and consequently their future participation and rewards.

The reward set is further split into the active and standby sets. As initial parameters, 600 of those nodes are selected to be active while the other 120 nodes are kept in standby (these numbers can be adjusted on an hourly basis depending on network demand). Again, higher reputation nodes have higher probability of being selected to be active rather than in standby.

Both active and standby nodes are rewarded, but active nodes are rewarded at a higher rate, as they also have to perform more work routing user packets. Standby nodes are rewarded mainly to be ready to participate in the mixnet, allowing mixnet capacity to be increased from one epoch to the next whenever needed. If fewer than 720 node candidates are registered in the network, all of them are selected for rewards.

NOTE: the reward budget is however scaled down according to the number of nodes. For example, if there are a total of 360 candidates out of 720 required nodes, then just 50% of the reward budget is made available for distribution to those nodes.

Where do the rewards come from?

Nym has a mixmining pool reserve to bootstrap the network, rewarding nodes until there is widespread adoption and user fees. The reserve is initialized with 250 million NYM, with monthly pool emissions set at 2% of the reserve funds (2% of 250 million = 5 million NYM in the first month). If all 5 million emitted the first month are distributed to nodes, then the rewards made available for the second month would be 4.9 million NYM (2% of the remaining 245 million). Reward amounts thus gently decline over time with this emission schedule.

However, not all of the emitted pool rewards are necessarily distributed to nodes. For example, nodes that have low reputation or low performance only realize a fraction of their potential rewards, with the rest of the reward budget remaining unclaimed and being returned to a reserve, where it can be returned to the pool for future distribution or be used in other ways to sustain the system. This makes the mixmining reserve deplete at an even slower rate. If, for example, only 2 out of the 5 million available rewards are actually distributed to nodes in the first month (with the other 3 million remaining unclaimed and being fed back to the pool), then the rewards available in the second month would be 4.96 million NYM (2% of 248 million).

This algorithm for releasing funds makes the pool deplete slowly, lasting multiple years while rewards gradually decrease over time. In particular, more rewards are given out when large amounts of the NYM supply are staked on high-reputation nodes with excellent performance; while more rewards remain unclaimed when overall staking levels are low, when stake is spread too thin over too many low-reputation nodes, and when nodes have bad performance.

During the first few months the Nym mixnet will be free to use to facilitate testing, usage and development of integrated applications. Once usage fees are turned on, part of the fee income will be added to the mixmining emissions and distributed to mix nodes as rewards (the other part of the income from the usage fee is taken by the gateway serving the user). Over time, usage fees are expected to become the primary source of revenue.

I have NYM tokens but don’t want to run a node — how can I stake?

Anyone holding NYM tokens can delegate stake to a mix node via CLI or by using the Nym wallet and earn a share of their rewards (here is a video guide for delegating via the wallet). You can even delegate your NYM tokens even if they are locked in a vesting contract! In this way, you can earn rewards while your NYM tokens are still vesting.

NOTE: there is no minimum threshold, so you can benefit from delegation no matter the size of your NYM holdings.

When you delegate stake to a mix node you contribute to increasing the node’s reputation, which is determined by the node’s total stake (aggregation of the operator’s bond and the delegated stake). The higher the reputation of a node, the more frequently the node is selected for rewards, and the higher its reward rate.

Thus by selecting a node to support with your delegated stake, you are helping that node have more chances of being in the reward set and active set and thereby receiving more rewards. This is, of course, assuming that the node has adequate performance whenever it’s selected to be active in the mixnet. If the node is offline or unable to route packets, rewards are scaled down proportionally.

How should I select a node to delegate my stake to?

Performance, reputation, bond, cost and profit margin are the main parameters you should consider when choosing which node to delegate to. Go to the network explorer and to see a node’s parameters.

Performance — The node performance history is one of the important factors to take into account when selecting a node for stake delegation. Nodes should ideally have a score of 100% (this will also be visible in the mainnet explorer). Underperforming nodes not only provide a poor service to users by dropping packets, but also miss out on rewards and provide lower return rates to their delegates than nodes with better performance.

Reputation — The node’s reputation (bonded+delegated stake) is another important factor to consider when choosing a node to delegate to. The reputation determines how often the node will be selected to the reward set. Reward rates also increase with reputation. Therefore delegating to nodes that already have a good reputation will result in higher returns.

Note however that reputation maxes out at the stake saturation point, which is currently slightly above one million NYM. You should avoid staking on nodes that are (over-)saturated, as they are already maxed out in rewards, and instead delegate to nodes that are below saturation, so that the stake you delegate has an effect increasing the node’s reputation and rewards.

Bond — Mix nodes with larger bonds are rewarded at higher rates, as the reward algorithm provides a slightly higher reward rate to nodes with more “skin in the game” (i.e., own stake committed to operate in the network). This means more rewards shared with delegators.

Operational costs — The node cost is subtracted from the node rewards and refunded to the operator before any rewards are distributed to delegates, so more cost-effective nodes are able to share more rewards to delegates.

Profit margin (reward share) — Finally, the node’s operator takes a share of rewards determined as the node’s profit margin. Nodes with a lower profit margin mean more rewards are shared and distributed to delegates. Where as nodes with a high profit margin mean the node operator gets a bigger share of rewards, distributing less to delegates.

Rewards are not everything!

In addition to parameters that directly influence your share of rewards, you may also have other reasons to delegate to nodes. For example, you may want to support nodes run by operators that have demonstrated their interest and commitment to doing a good job by participating in testnets or contributing to community channels. Or you may want to support location diversification and decentralization by delegating to nodes in parts of the world where there are fewer registered node candidates, so that the network has nodes in all areas of the world. Or you may want to support a node because it is run by people or with an ethics and ethos that you support.

Keep in mind that node reputation can be rather dynamic, as stakeholders can move delegated stake from one node to another at any time, as well as un-delegate stake in order to do something else with the funds. Thus, imagine that you delegate to a high reputation node but shortly after the node starts to perform poorly and other delegates move their stake away, lowering the node’s reputation. After a while you may find that your delegated stake didn’t result in as many rewards as you expected at the time of delegation. On the other hand, you may delegate your stake to an “up and coming” node that does not yet have a high reputation but that is operated by an active member of the community. If the node shows good performance and is able to attract further delegated stake, the rewards you will receive for supporting that node will increase above what you could expect based on the node’s initial reputation level. This also means that you may want to revisit and adjust your delegation decisions every so often, to ensure you are supporting nodes that provide adequate rewards.

Rewards are accounted for on an hourly basis and assigned algorithmically to the node operator and delegates. While you don’t take action, rewards are simply being compounded and accounted for in the blockchain. To make them turn up in your wallet, you need to withdraw them, which requires a small tx fee for executing the blockchain operation.

More information will follow soon on the timeline for the reward sharing going live, results of initial token economic simulations and how to calculate APY!

https://nymtech.net/

@nymproject

--

--

Building the next generation of privacy infrastructure… Check our publication for more content: https://medium.com/nymtech