Riecoin Protocol

This page provides general information and explanations about the Riecoin protocol.

Bitcoin base

Riecoin is based on Bitcoin, in particular Riecoin Core is a fork of Bitcoin Core. For now, most of the Bitcoin protocol is left unchanged, so you can in general use existing Bitcoin documentations or tutorials to learn about the Riecoin protocol, there are plenty of them. Of course, you need to take care of things like the modified chain parameters or the different PoW.

Riecoin general parameters

Here are general chain parameters, notably values defined in the Riecoin Core's chainparams.cpp source file, as well as some other constants.

Block header

A Riecoin block header has the following structure (in total, 896 bits, or 112 bytes):

Proof of Work

The Riecoin Proof of Work (PoW) features the central change from Bitcoin. Instead of looking for hashes, Riecoin miners are looking for prime constellations.

To be a good proof of work, solutions should be much harder to find than verify. If the proof of work were just to find a prime number of length n, checking whether a number is actually prime is not much easier, so this would not be a good PoW. Validating blocks and their transactions would be almost as hard as finding them.

A way to make finding much harder than verifying is to not just look for prime numbers, but prime constellations. A prime constellation of length k is a sequence of k prime numbers (n1,n2,...,nk), n1<n2<...<nk, such that the diameter nkn1, is in some sense the least possible[2]. Like we say that Bitcoin has a Sha256 PoW, the Riecoin PoW is called Stella.

Increasing the length makes finding constellations much harder, while verifying that the k numbers are indeed prime will not be much more difficult, so we would ideally want to use the largest k we can. However, a too large k would make mining too hard and force to find much smaller prime numbers, which is something that would also make GPU mining easy. k=6 was initially chosen, because the known algorithms at this time were too slow for k=7. Starting from the second hard fork, k became 7.

Read this page to learn about the PoW implementation in detail. You might also take a look at the explanation of the mining algorithm, and the Stella page.

Difficulty adjustment algorithm

This is another important change from Bitcoin. The Bitcoin's difficulty adjustment algorithm (DAA) is often considered as one that is particularly vulnerable to attacks from malicious miners. While we believe that the true problem is to gather enough miners such that nobody could access to a significant part of the mining power (making the choice of the DAA irrelevant; after all, Bitcoin never had any problem despite its DAA), an improved DAA may help to lower the risk of attacks while still few people are mining Riecoins and grant other advantages like a better reactivity to mining power changes.

The Riecoin DAA was initially the same as Bitcoin's except a faster adjustment every 288 blocks (about 12 h in Riecoin) instead of 2016 (14 days in Bitcoin). Starting from the second fork, a DAA based on ASERT[3] is used instead. You can learn about the Riecoin DAA implementation here.

Notes and References

  1. The T prefix is an analogy with the Bitcoin prefixes, as it has 1 for P2PKH and 3 for P2SH, and T is the second letter after R.
  2. A more precise definition can be found here: Wolfram MathWorld: Prime Constellation
  3. Actually, an approximated ASERT, sometimes called EMA. This document explains and analyzes ASERT. ASERT/EMA is recommended by a reference person in the domain.