# Regional Multipliers for MainNet

The goal of regional Multipliers is to offset the natural geographic centralizing force of cMix. In general, the system compensates nodes based on how many rounds they run. However, a significant impediment to this speed is latency caused by how far away nodes are. This causes nodes farther from the "center of mass" of the network to run slower and be at a disadvantage. This is a problem because an underlying security requirement for cMix is the geographic and jurisdictional distribution of nodes. The geo multiplier is designed to offset these latency factors to make operating in these regions competitive.

This page will describe a mechanism to evaluate Geo Multipliers using historical data from the network. This is an imperfect system—regions without sufficient nodes can produce results that are properly not really descriptive of their general performance, and regions with no nodes at all will have to have their values guessed at.

But, an even bigger challenge is that the correct multiplier is a function of how many nodes a region has. When designing the network, we made it so that every node in a region experienced the highest multiplier of any node in the team. This is to ensure there never is a case where node operators are incentivized not to participate in a round. As a result, the correct multiplier for a given region is a function of the number of nodes in that region.

This means that multipliers will need to be updated on a regular basis as the network grows and shrinks. As seen below, the math for multipliers is relatively regular, so it may be possible to integrate it on-chain at some point and automatically calculate it every era.

This solution also requires adjusting how multipliers are handled. Initially, all nodes in a team inherited the same multipliers. This resulted in some very odd multipliers, so we are adjusting the algorithm to give all nodes the average of their own multiplier and the highest in the team.

This page contains scripts and data access to allow anyone to evaluate multipliers at their leisure.

## Current Multipliers

The current multipliers are as follows:

Bin ID | Bin | Multiplier |
---|---|---|

0 | NorthAmerica | 0.992 |

1 | SouthAndCentralAmerica | 1.273 |

2 | WesternEurope | 0.845 |

3 | CentralEurope | 0.875 |

4 | EasternEurope | 0.980 |

5 | MiddleEast | 1.100 |

6 | NorthernAfrica | 1.100 |

7 | SouthernAfrica | 1.292 |

8 | Russia | 0.979 |

9 | EasternAsia | 1.284 |

10 | WesternAsia | 1.146 |

11 | Oceania | 1.337 |

They were last set on 07/14/2022.

### Editing Multipliers

Geo Multipliers can be modified by governance via a general referendum or via 2/3rds of the council setting on-chain cMix values. You can read more about this on the Governance page.

## Multipliers Math

When calculating the multipliers, we started with the raw numbers, how many points each node got in every era, excluding the multiplier. We want everything to be fair, and we want each node runner to be incentivized to team with every other node. So, our goal is to ensure full participation gets you full “points” in the network.

Before we continue, some definitions:

- M
_{i}– The multiplier for all nodes in Bin i. - A
_{i}– The adjusted point value for Bin*i*. - P
_{i}– The probability that at least one node from bin i is included in a team, and a node from any bin < i is not included.

The calculation is seeded by real network data. Over the last week, we got the average points earned for cMix operations in an era per node. This was then “normalized” to produce the adjusted point value for the bin, known as A_{i}.

The goal of this system is to create Multipliers such that future As will all be 1.

Bins are ordered minimum to maximum by A. When calculating points, every node’s multiplier is the average of their multiplier and the highest in the team (also the lowest i).

Because the region with the lowest average, Bin 0, overwrites all others, Bin 0’s multiplier can be calculated as:

*M*

_{0}+

*M*

_{0})

*A*

_{0}/2 =

*M*

_{0}

*A*

_{0}

Our goal is to ensure that the multipliers and adjustments for all nodes in all teams are also the maximum of 1 on average. Since M_{n} is the multiplier for the n^{th} ordered bin and A_{n} is the normalized average for the n^{th} ordered bin. This can be easily solved:

*M*

_{0}= 1/

*A*

_{0}

The next multiplier for Bin 1 can be calculated as the probability a node from Bin 1 is selected with a node from Bin 0 (which uses the *M*_{0} bin multiplier) and the probability that a node from Bin 1 is not teamed with a node from Bin 0 (which uses the *M*_{1} team multiplier):

*M*

_{0}+

*M*

_{1})/2

*A*

_{1}

*P*

_{0}+ (

*M*

_{1}+

*M*

_{1})/2

*A*

_{1}(1 −

*P*

_{0})

We can do the same calculation for Bin 2:

*M*

_{0}+

*M*

_{2})/2

*A*

_{2}

*P*

_{0}+ (

*M*

_{1}+

*M*

_{2})/2

*A*

_{2}

*P*

_{1}+ (

*M*

_{2}+

*M*

_{2})/2

*A*

_{2}(1 −

*P*

_{0}−

*P*

_{1})

*M*

_{0}

*A*

_{2}

*P*

_{0}+

*M*

_{2}

*A*

_{2}

*P*

_{0}+

*M*

_{1}

*A*

_{2}

*P*

_{1}+

*M*

_{2}

*A*

_{2}

*P*

_{1}+ 2

*M*

_{2}

*A*

_{2}(1 −

*P*

_{0}−

*P*

_{1})

*A*

_{2}=

*M*

_{0}

*P*

_{0}+

*M*

_{1}

*P*

_{1}+

*M*

_{2}(

*P*

_{0}+

*P*

_{1}+ 2(1 −

*P*

_{0}−

*P*

_{1}))

*A*

_{2}−

*M*

_{0}

*P*

_{0}−

*M*

_{1}

*P*

_{1}=

*M*

_{2}(

*P*

_{0}+

*P*

_{1}+ 2 − 2

*P*

_{0}− 2

*P*

_{1})

*A*

_{2}− (

*M*

_{0}

*P*

_{0}−

*M*

_{1}

*P*

_{1})/2 − (

*P*

_{0}+

*P*

_{1}) =

*M*

_{2}

*P*

_{0}

We can generalize this using summations for any team multiplier Bin n:

*A*

_{n}−

*M*

_{i}

*P*

_{i}/2 −

*P*

_{i}=

*M*

_{n}

In addition to the recursive definition, the probabilities are tricky to get right. Each selection of a team of 5 nodes consists of a random draw, without replacement, from the total of nodes in the network. This sort of selection is described by a hypergeometric distribution. Most frequently, this distribution is applied to a simple case of counting objects (nodes in our case) with a binary feature (for example, in the BFT consensus realm: byzantine/honest nodes). However, in cMix, we have split the nodes into 12 bins, which turns the problem into a multidimensional one, meaning that we need to calculate a multivariate hypergeometric distribution. Luckily, due to the nature of how multipliers work, when we select a node from say, Bin 2, we don’t care if any other node in the team is of a bin with a higher multiplier. This means that all the probabilities that we need to compute are similar: we want to have a team with at least one node from bin i, without any nodes from all bins < i. We include a spreadsheet in our resources below which show how to do this in detail.

### Error

This solution has some errors due to the fact that discrepancies in A values are largely caused by variations in how long rounds take, which impacts selection probabilities. This solution, as described by our simulation, is correct to within 3%. Future work can deconstruct the causes of point variations to model them better and reduce this error.

## Running the Multiplier Calculator

First download the multiplier_calculator.py Python script from the multiplier-calculator repository.

Next, download the wallet country list wcm_2col.csv from the same repository.

Run the script using the command below. Make sure that

`--wallet-country-supplement`

point to the correct files.The lower and upper bounds are examples. Specify your own bounds in format`YYYY-MM-DD hh:mm`

(24-hour clock)

## Resources

- MainNet Geographic Bins spreadsheet
- Scheduling Algorithm go source code
- Multipliers calculation spreadsheet
- Bin Simulation Calculations Python script
- Testing Regional Multipliers for MainNet blog post
- Large Democracy Proposal programmatically generate a preimage for Regional Multiplier proposals