1. Overview

It is time to start mining. Before you do so, we strongly recommend that you read and understand the guide found here.

What you will need to do

Install XEL Miner

In order to start mining you will need to install XEL Miner. This tool interacts with the XELINE command center, and serves the purpose of solving uploaded work tasks, also known as POW (Proof of Work). By doing so, you will be rewarded with XEL tokens for providing your CPU and GPU computational resources.

2. Installing XEL Miner

Despite what the name might suggest, XEL Miner is more than just a miner. It is a fully fledged ePL to C conversion and compilation tool that helps you to convert ePL programs into C, to compile them into executable machine code, and natively execute ePL programs on your local machine.

Windows

Run XEL Miner from sources

Cloning and build

You will need to install git and clone the repository

git clone --depth 1 https://github.com/xel-software/xel-miner

cd xel-miner

If you don't want to use OpenCL

cmake .

make install

If you want to use OpenCL

cmake . -USE_OPENCL

make install

Launch

Using CPU

./xel_miner -t <num_threads> -P <secret_phrase> -D

Using GPU

./xel_miner -t <num_threads> -P <secret_phrase> -D --opencl

Use ./xel_miner -h to see a full list of options.

Run XEL Miner from docker installer

Requirements

You will need to install git and clone the repository

git clone https://github.com/xel-software/xel-installer-docker

or

You will need to download this project and extract it

Launch

You can start the XEL Miner using

$ bash xel-miner.sh start

MacOS

Run XEL Miner from sources

Requirements

You will need to install homebrew ( if not already installed )

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then proceed with the installation

brew install gmp make cmake openssl

ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/openssl

Cloning and build

You will need to install git and clone the repository

git clone --depth 1 https://github.com/xel-software/xel-miner

cd xel-miner

If you don't want to use OpenCL

cmake .

make install

If you want to use OpenCL

cmake . -USE_OPENCL

make install

Launch

Using CPU

./xel_miner -t <num_threads> -P <secret_phrase> -D

Using GPU

./xel_miner -t <num_threads> -P <secret_phrase> -D --opencl

Use ./xel_miner -h to see a full list of options.

Run XEL Miner from docker installer

Requirements

You will need to install git and clone the repository

git clone https://github.com/xel-software/xel-installer-docker

or

You will need to download this project and extract it

Launch

You can start the XEL Miner using

$ bash xel-miner.sh start

Linux

Run XEL Miner from sources

Requirements

apt-get update

apt-get install -y cmake libcurl4-openssl-dev libudev-dev screen libtool pkg-config libjansson-dev libssl-dev

Cloning and build

You will need to install git and clone the repository

git clone --depth 1 https://github.com/xel-software/xel-miner

cd xel-miner

If you don't want to use OpenCL

cmake .

make install

If you want to use OpenCL

cmake . -USE_OPENCL

make install

Launch

Using CPU

./xel_miner -t <num_threads> -P <secret_phrase> -D

Using GPU

./xel_miner -t <num_threads> -P <secret_phrase> -D --opencl

Use ./xel_miner -h to see a full list of options.

Run XEL Miner from docker installer

Requirements

You will need to install git and clone the repository

git clone https://github.com/xel-software/xel-installer-docker

or

You will need to download this project and extract it

Launch

You can start the XEL Miner using

$ bash xel-miner.sh start

3. Launching XEL Miner

Now that you have installed XEL Miner, it’s time to start using it. Before launching the miner, its a good start to familiarize yourself with the help information

Windows

Using XEL Miner

Reviewing the help information

Once you are in the directory where your xel_miner executable is, take a look at the help

xel_miner.exe --help

MacOS and Linux

Using XEL Miner

Reviewing the help information

Once you are in the directory where your xel_miner executable is, take a look at the help

./xel_miner --help

In the remainder of this tutorial, we will just cover the Linux and MacOS variant but the Windows one should be always analogous to that. After you have launched that command you will see the help

 
** XEL Compute Engine **
Miner Version: 0.9.6
ElasticPL Version: 0.9.4
Usage: xel_miner [OPTIONS]
Options:
-c, --config          Use JSON-formated configuration file
    --deadswitch   Hardkill the instance after x seconds
-D, --debug                 Display debug output
    --debug-epl             Display EPL source code
-d, --delaysleep	     	  Sleep x seconds after submitting POW: useful for burstless debugging
-i, --ignoremask			  Debug only: ignore 0=nothing, 1=PoW, 2=Bty, 3=Both
-h, --help                 Display this help text and exit
-m, --mining PREF[:ID]      Mining preference for choosing work
                                profit       (Default) Estimate most profitable based on POW Reward / WCET
                                wcet         Fewest cycles required by work item
                                workid		 Specify work ID
    --no-color              Don't display colored output
    --opencl	              Run VM using compiled OpenCL code
    --opencl-gthreads    Max Num of Global Threads (256 - 10240, default: 1024)
    --opencl-vwidth 	  Vector width of local work size (1 - 256, default: calculated)
-o, --url=URL               URL of mining server
-p, --pass        Password for mining server
-P, --phrase    Secret Passphrase for XEL account
    --protocol              Display dump of protocol-level activities
-q, --quiet                 Display minimal output
-r, --retries            Number of times to retry if a network call fails
                            (Default: Retry indefinitely)
-R, --retry-pause        Time to pause between retries (Default: 10 sec)
-s, --scan-time          Max time to scan work before requesting new work (Default: 60 sec)
        --test-miner      Run the Miner using JSON formatted work in
    --test-vm         Run the Parser / Compiler using the XEL ePL source code in
    --test-avoidcache   	  Do not save metadata
    --test-block 	  Block-id for test run
    --test-cont-bounty      Search for bounties within test-vm environment
    --test-cont-pow         Search for proof-of-work within test-vm environment
    --test-work 	  Work-id for test run
    --test-limit-storage 			Only allow storage sizes up to
    --test-multiplicator <32-byte-hex>	Multiplicator for testrun: must be exactly 32 hex chars
    --test-publickey <32-byte-hex>		Publickey for testrun: must be exactly 32 hex chars
    --test-stdin		                    Read storage values from stdin
    --test-target <16-byte-hex>		    Target for test run: must be exactly 16 hex chars
    --test-wcet-main 		Do not ignore WCET limits of main function in Test-Vm run
    --test-wcet-verify 	Do not ignore WCET limits of verify function in Test-Vm run
-t, --threads            Number of miner threads (Default: Number of CPUs)
-u, --user        Username for mining server
-T, --timeout            Timeout for rpc calls (Default: 30 sec)
    --validate              Validate logic in 'main' & 'verify' functions
    --verify-only           Use verify instead of main
-v, --version               Display version information and exit
-X  --no-renice             Do not lower the priority of miner threads
Options while mining ----------------------------------------------------------

s +                 Display mining summary
d +                 Toggle Debug mode
q +                 Toggle Quite mode
                                    

We will not cover all options in this tutorial, only those which are required to get your miner ready to work on tasks on the XEL Blockchain. First of all, we want to take a look at the threads configuration parameter

t, --threads Number of miner threads (Default: Number of CPUs)

This parameter allows you to configure how many threads you want xel_miner to run on. The more threads you use, the faster xel_miner will find solutions. However, if you set this number too high your system may become unresponsive. The next parameter we want to look at is the url configuration:

-o, --url=URL URL of mining server

This allows you to point the miner to either a remote node or a local node. Either way is fine, but keep in mind that remote URLs do leak your private key to the server at the moment. If you do not trust the remote node, stick to a local one instead. The URL is always given in the form of http://hostname:port where hostname is the IP or FQDN of the host, and port is either 17876 for the mainnet or 16876 for the testnet.

The third important parameter is the passphrase flag:

-P, --phrase Secret Passphrase for XEL account

This is absolutely essential.
This is the passphrase to the account which will both pay the transactions fees for submitting work results and receive the rewards in exchange. if your passphrase has a space in it, make sure to put double quotes around it.
It is absolutely essential that you have some initial funds inside this account, otherwise you will not be able to submit any solutions.
For testing purposes you can just use your 12 word Xeline mnemonic code (enclosed in double quotes) since it’s very easy to get some XEL from the faucet to get started.

Now, for this tutorial, we want to launch a miner running just one thread, mining via our local node on the testnet. Hence, we start it like this:

./xel_miner -t 1 -o http://localhost:16876 -P

At this point, your miner is already solving proof-of-work packages and submitting bounties - solutions to algorithms for which it has found solutions.

4. Support

If you encounter any difficulty while submitting your task to the blockchain you can always read more information on the official XEL wiki or seek assistance from our community.

Code copied!