Blockchain explorations: The Riecoin Miner Arms Race

I've continued to stay interested in alt-currencies, and, recently, a new one caught my eye:  Riecoin.  Named after Riemann, the proof-of-work in this currency is finding dense clusters of primes starting at a number n, where there are six primes "in a row":  n, n+4, n+6, n+10, n+12, and n+16.   To solve a block, you do some hashing of the block contents just as in Bitcoin, and use it to generate a "target" number.  The proof-of-work is then to find a prime chain within a certain numerical distance above the target number.

I plan on a more technical post about the process of optimizing the search for these (you can see some discussion of it on the Riecoin bitcointalk thread if you really want).  It's quite fun, but at this point, it still boils down to relatively straightforward prime sieving for huge numbers (1200-1300 bits).

There's one very important thing to understand about such sequences, though, before going further:  They only appear at certain positions relative to multiples of lots of primes.  For example, using the "primorial" 210  (2*3*5*7), a match can only occur at position 97.  You can take this up to larger primorials if you want to.  Using this search strategy can drastically speed a miner.

Instead, I wanted to look at the evolution of the mining ecosystem for a very young coin.  It was born only a month ago, and the first cut miner was slow.  The "difficulty" started out at about 304, as you can see, for example, in Block 1.  This block was solved by a miner who found the prime number

as the start of a chain of six.   For block 1, the prime was found at an "offset" of 0x2858cf21 relative to the target.  I'm leaving it in hex so that you can see by examination that it's a 32 bit number.  I point that out, because this is one of the best clues about how a miner is behaving:  The first-released cpuminer could only find 32 bit offsets, nothing larger, and was very unoptimized.  The built-in miner in riecoind could find larger offsets, but other than having a slightly larger sieve, was also pretty unoptimized, and so one would not expect many nonces larger than about 2^33.  Block 3, for example, was just over 2^32.  These miners did not use the optimized search strategy outlined above.

And then we get to Block 2472, which has a 256 bit offset: 646a2681a436961a307924b066f7e6366f9a31c3c5b6bc932ea8e496d5eda5db

You can see a cluster of blocks that are mined using this miner in the upper left of the diagram.  And then it disappears.  A miner developer testing things out?

The next thing that's obvious is the huge difficulty spike as a consequence of the release of ypool's optimized xptMiner for Riecoin from jh00.  The green line shoots up to the 1200-1400 range, where it remains today.  This was the first public miner to use a larger primorial -- 2310 + 97.  This miner searches relatively the same space as the initial miner, but can get to larger offsets.

And then we can see the entry (or modification) of additional generations of miners using ever-larger primorials.  My own tests show up at the right of the diagram, mostly in the log2(offset)=195 and 220 range.  But this leaves at least six or so different miners running, with only a few of them released publicly.  A bit of digging shows some examples:

18349 - normal block, found on ypool by fadala

18336 - hellomotow2 

18268 - supercomputer


18325 and 18263- firkraag


18340 - me

18354 - ???
And so we end with block 18354, solo mined by an unknown miner.  Which may or may not be the same one that sprang into existence on Feb 14.  I'm sure someone could follow the blockchain to correlate the payouts if interested, but for now, it'll be a fun mystery.

But what's most interesting about this is the evolution of a new coin.  In the beginning, there was only one miner.  Advanced developers started entering with private miners, and a smart pool operator with primecoin mining expertise released a pool miner and created the first (and still roughly only) pool for the coin.  The pool and private optimized miners instantly captured nearly 100% of the blocks being generated, and then continued optimizations occurred - some public and some private, with miners gradually moving to larger primorials as they improved their optimization strategies to be able to take advantage of them.

In the long run, of course, the open source releases will catch up -- I plan on releasing mine in a month or so, no strings attached (but it's icky to build), but for now, the playing field is fascinating to watch.  I guesstimate a 2-4x gap between the speed of the private and public miners right now, though I'd wager that with the information this post, people will be able to straightforwardly improve the public miner by 30%.

Someone want to take credit for mining Block 2472?  Whomever the author was, s/he was way ahead of the game.

Next post will talk a bit about sieving and searching, if time permits.

Popular posts from this blog

Stealing Google's Coding Practices for Academia

22 Months of Voice-Based Assistants

Reflecting on CS Graduate Admissions