Stella

From Riecoin

This page will explain the Riecoin’s PoW from a cryptocurrency/economic point of view and is meant for Riecoin miners, developers, and pool operators. It will explain useful tools like how to compute earning estimations or mining power, either for integrating the Riecoin's PoW or just to learn more about Riecoin mining. An example of application of this page is this mining calculator. If you look for the more mathematical aspect of Riecoin mining, read this page. If you are rather looking for low level things like how the PoW results are encoded, read this page.

Stella refers to the PoW type like we say that Bitcoin is Sha256, or Litecoin is Scrypt. In the case of Riecoin, it does not actually refer to the actual algorithm used by miners, but rather to what they are trying to find, prime constellations. Old implementations may also have referred Stella as "PrimesR".

Riecoin PoW

As a reminder, a prime constellation of length is a sequence of prime numbers , , such that the diameter , is in some sense the least possible.

The important parameters are:

  • The constellation length : 7 (5 in Testnet) starting from the second hard fork (6 before, 4 in Testnet);
  • The Difficulty , which correspond to the size of the prime numbers, which is about .

While looking for them, miners first generate candidates at a rate of candidates/s. Then they check if the candidates are prime constellations. In practice, it can be stated that every of these candidates have a probability to be a prime number, to be a 2-tuples, etc. is the ratio of the rate or found to -tuples for (a candidate whose is not prime is a 0-tuple). It does not depend on the but is proportional to the Difficulty, and may also change depending on the miner settings.

In other words, the occurrences of -tuples can be modeled as a Poisson Process of intensity .

Solo mining

Process

The mining process in solo mining is straightforward. A miner will generate the candidates, that check if is prime. If not, the miner discards the candidate and checks the next one, else it continues and check if , and so on. If the is prime for all the , a prime constellation was found and a block can be submitted to the Riecoin network.

Earnings estimation

Computing the earnings only requires and , which can be obtained easily: count the number of candidates and prime numbers (in the sense how many times was prime) found during some time and do elementary arithmetics.

gives a good estimation of the block rate (in blocks/second), so will give the average blocks found every day. Multiplying this by the block reward (currently 25 RIC) will yield the earnings in RIC/day.

gives the average time to find a block in seconds, and a miner will have 50% chance to find a block within .

Normalization

One issue with just having a block rate is that it cannot be used if the difficulty varies. For the same mining power, if increases, will be lower and higher, and there will be less blocks found (but because there is more mining power in the network, the network's average time between blocks will remain the same).

To handle this, these two assumptions can be used:

  • is proportional to , which is close to the reality;
  • is proportional to . In reality, the power is something around 2.2-2.6, increasing when is higher, but it is not easy to derive a precise formula for this so we are just taking 2.3, which also corresponds to current difficulties.

Using them allows to normalize various metrics. For example, gives a good estimation of the block rate for the reference difficulty. Or, estimates the candidates/s if we were mining at difficulty .

The Riecoin Core's getnetworkminingpower command uses to provide a normalized number that corresponds to how many times the current network's mining power is larger than the power needed to find a block of difficulty 600 every 150 s.

Pooled mining

Shares

In pooled mining, the point is to avoid very long periods between blocks for a miner by making them find and submit shares instead. The conditions to meet for a share are much weaker versions of the ones for a block, so finding shares is much easier, but one of them will eventually also be a block. Pools then reward miners based on the submitted shares.

Usually, the conditions for a share are the same as the ones for a block, but with a lower difficulty. This clearly cannot be done for Stella. Instead of lowering the difficulty and submitting shares with smaller prime numbers, an idea would be reduce the tuple length. However, looking for shorter tuples is easier than looking for full -tuples and submit shorter tuples (the sieving process is shorter and there are less numbers to test), making mining more profitable for those who just want to find shares, which is not an acceptable solution.

The current condition for a share is as follow:

  • Among the numbers , must be prime;
  • The first two numbers must be prime.

The first condition forces miners to look for actual -tuples. With this system, a miner will test the different numbers until either enough are prime or the current candidate cannot longer be a share. There is one issue, it can happen to check numbers in hopes that it is a share, despite knowing that the candidate will never be a part of a block, reducing pooled mining's general performance. The second condition renders the impact of this issue negligible.

The share prime count is the number of prime numbers, but is equal to 0 if the second condition is not true.

Earnings estimation

At the miner's side, the process is such that and can be obtained in the same way as in solo mining, so calculating the earnings can be done as explained above.

At a pool's side, only the share rate metric can be known (let be the rate in shares/s), and some combinatorics is required if the operator wishes to show the earning estimations to miners. To do so, the first step is to derive the probability of a candidate to be a share.

A candidate must first have and prime numbers. This has probability of occurring (see below for the ratio estimation). Then, we still need at least numbers to be prime among the remaining numbers to . The probability of having exactly additional prime numbers can be calculated by using the Binomial Distribution, . is the Binomial Coefficient.

With this and basic probability rules, we can now calculate

  • For 7-tuples (Mainnet after the second fork): ;
  • For 5-tuples (Testnet after the second fork): .

There is no way to get the ratio , but you can estimate it with .

Finally, we have and the earnings can be calculated like above.

Note that the share rate is probably relatively low, so the accuracy of the earnings estimation will also be low.

Normalization

Again, it is the same as solo mining at the miner's side. For the pool's side, you can calculate and like explained and apply the tricks exposed in the solo mining section.

Pools should use a normalized metric in order to compare their mining power in an other way than just looking at the distribution of the latest 1000 Riecoin blocks or so. A suggested option is to compute the mining power as a factor of the power needed to find a block at difficulty 600 every 150 s, which can be approximated with

Dividing this value by the Riecoin Core's getnetworkminingpower result will approximate the pool's contribution to the entire Riecoin network mining power.