The Stella PoW

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 k is a sequence of k prime numbers (n1,n2,...,nk), n1<n2<...<nk, such that the diameter nkβˆ’n1, is in some sense the least possible.

The important parameters are:

While looking for them, miners first generate candidates at a rate of c 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 1r to be a prime number, 1r2 to be a 2-tuples, etc. r is the ratio of the rate of found i to (i+1)-tuples for i∈{0;1;...;kβˆ’1} (a candidate whose n1 is not prime is a 0-tuple). It does not depend on the i but is proportional to the Difficulty, and may also change depending on the miner settings.

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

Solo mining

Process

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

Earnings estimation

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

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

rkc gives the average time to find a block in seconds, and a miner will have 50% chance to find a block within log⁑(2)rkc.

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 D increases, c will be lower and r 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:

Using them allows to normalize various metrics. For example, (DDβ€²)k+2.3crk gives a good estimation of the block rate for a reference difficulty D' using the candidates/s and ratio metrics at difficulty D. Or, (DDβ€²)2.3c estimates the candidates/s as if we were mining at difficulty D' from metrics for D.

The Riecoin Core's getnetworkminingpower command uses Dβ€²=600 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 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 k-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 currently widely implemented condition for a share is as follows:

The first condition forces miners to look for actual k-tuples. A miner will have to 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 c and r 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 s 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 P of a candidate to be a share.

A candidate must first have n1 and n2 that are prime numbers. This has 1r2 probability of occurring (see below for the ratio estimation). Then, we still need at least kβˆ’4 numbers to be prime among the remaining kβˆ’2 numbers n3 to nk. The probability of having exactly m additional prime numbers can be calculated by using the Binomial Distribution, P k βˆ’ 2 , m = ( k βˆ’ 2 m ) ( 1 r ) m ( 1 βˆ’ 1 r ) k βˆ’ 2 βˆ’ m . ( n k ) = n ! k ! ( n βˆ’ k ) ! is the Binomial Coefficient.

With this and basic probability rules, we can now calculate

P = 1 r 2 ( P k βˆ’ 2 , k βˆ’ 4 + P k βˆ’ 2 , k βˆ’ 3 + P k βˆ’ 2 , k βˆ’ 2 )

There is no way to get the ratio r, but you can estimate it with rβ‰ˆ0.0181116D.

Finally, we have c=sP 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 c and r 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

150 s P r k ( D 600 ) k + 2.3

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