Stella

Stella is a software written in Rust that finds prime k-tuplets (also called prime constellations). For now, it is just an inefficient prototype with very few features. It is currently provided as an experimental Rust Crate; we will assume that you are already familiar with this programming language.

One of it's goals is to become usable for Riecoin mining and possibly succeed rieMiner (Stella can be seen as a Rust port of rieMiner), and to break world records. Even if the Rust implementation were to remain less efficient, the improved code readability may help to try new optimizations that could then be implemented and ported back to rieMiner.

Another goal would be to help Riecoin and number crunching developers that are interested in understanding how the mining algorithm works. rieMiner is the merge and heavy refactor of previous Riecoin miners, and carries years of history, which can make the understanding of its code difficult, especially with the fact that documentation and explanations by previous developers are basically nonexistent. Stella is written from scratch and in a more modular way, which can greatly help the learning process for future developers.

Stella Crate Usage

Since this is a prototype software, a lot of the usage instructions is subject to change in the future.

The Stella interface relies on the Rug's Integer structure, so add the following to your Cargo.toml in order to use the Crate:

rug = "^1.19.0" stella = "0.0.1"

Optionally, you can use the following imports in your source files, we will assume that you did that below.

use rug::Integer; use stella::Stella;

Stella Instance

A Stella instance will handle the customizable search of Prime Constellations, create it with

let mut stella = Stella::new();

Parameters

Now, the instance must be configured via a struct called Params, using the set_params method. Here are the fields of this structure:

Here is an example of a configuration of the Stella instance,

stella.set_params(stella::Params { workers: 8, constellation_pattern: vec![0, 2, 6, 8, 12, 18, 20, 26], prime_table_limit: 10000000, primorial_number: 20, primorial_offset: 380284918609481, target: Integer::from(1) << 128, sieve_size: 10000000 });

Initialization

Once proper parameters have been set with set_params, the Stella instance must be initialized with

stella.init();

Starting Workers

Actual number crunching can now be started with

stella.start_workers();

This launches detached worker threads that will look for prime constellations as configured above. Since the workers are detached threads, a main thread must also be run by the library user. In order to view statistics and handle results found by the Stella instance, read the sections below.

Stats

Once the Stella instance is initialized, you can access some relevant statistics with the stats method. It contains the following fields:

Outputs

When a result of interest is found by the Stella instance (actual prime k-tuplet, long enough tuple, or pool share depending on the use case and configuration), it is internally pushed to a queue. Using the pop_output methode, you can retrieve an output from the queue and "consume" it. It is presented as an Output structure containing the following fields:

Example Program

An example program is provided in the GitHub repository and may be ran in the following way.

bash git clone https://github.com/Pttn/Stella.git cd Stella cargo build --release

You can inspect the main.rs source file to see a concrete example of the use of the Stella Crate.

Developers and License

This work is released under the MIT license.

Contributing

Feel free to make a pull request, and I will review it. By contributing to Stella, you accept to place your code under the MIT license.

Donations to the Riecoin Project are welcome:

Resources