An introduction to Monero (XMR) mining

Hey guys!
This tutorial is for those who wish to mine the cryptocurrency Monero (XMR). Monero is a cryptocurrency similar to Bitcoin (BTC), with one technical difference: BTC uses SHA256-D for its hash algorithm, Monero uses Cryptonight. Cryptonight is intended to be an ASIC and FPGA resistant hashing algorithm, which runs fine on consumer grade hardware. This enables any device to be a Monero miner and have no worries of high end hardware leaving no chance for smaller miners to work (EDIT: Year 2019. Monero isn't worth mining for most low end hardware, and CoinHive is shutting down :/).


Note: The profitability of mining must be considered if you're looking for economic profit (the main cost being that of your electricity) but can be ignored if you're just doing it at leisure (especially because miners can work while you work on other tasks).

You can use any hardware for mining: from a high end gaming rig, to a small ARM computer like the Raspberry Pi. The things you'll need are:
  1. A Monero wallet to store your mined coins. You can go for a full node wallet (where the entire blockchain ~41GB [as of 27 August] is downloaded to your computer) or a mobile online wallet (OK for small amounts, not safe for large amounts).
  2. A Monero miner. If you've opted for using a full node, the download includes a Monero miner inbuilt. Other miners include xmr-stak (CPU, NVidia and AMD), ccminer-cryptonight (for Nvidia CUDA mining), etc. (There is a web based miner from CoinHive, details on that at the end)
  3. A Monero mining pool. There is a list over at MoneroPools.com. Try to suppport the smaller pools, it helps the decentralization :)
Now, for the setup:
  1. Check the configuration options of the miner you wish to run. There are three configuration options you'll need to set: Pool URL, Username and Password.
  2. Find the Pool URL and port of the pool you wish to join. These are usually found in the Getting started guides. For example, if your pool had a URL of "miningpool.example.com" and a port of 3333, set the Pool URL configuration option to "miningpool.example.com:3333".
    Note: Your miner may need a protocol too, find the protocol prefix that corresponds to the Stratum protocol with pool mining. Also, note that the port you choose will determine the difficulty of mining, choose a port which corresponds to your hardware spec.
  3. Set your username to your Monero Wallet address.
  4. Set your password to an identifier for your device. It may seem counterintuitive but most pools use the password to identify the miner in a dashboard.
  5. Set any configuration options for optimum performance. Check your miner's help page.
  6. Start the miner. If all goes well, you should see messages like "Result accepted by the pool". If not, recheck your configuration.
  7. Open the pool's dashboard link and enter your wallet address to get statistics for your miners.
And you're done! While mining in a pool gives small returns (~0.0001XMR) and have thresholds and fees, it is consistent and guaranteed (if the pool is trustworthy).

Note that mining is a computationally heavy process that can generate quite a bit of heat. Make sure your systems are cooled properly. As an example, my laptop reaches 75 degrees Celsius with 2 cores mining.

For the Raspberry Pi

The above mentioned miners do not compile on the ARMv6/7/8 processor of the Raspberry Pi. The only miner that works on my Raspberry Pi 3 is CPUMiner-Multi from tpruvot (link is a fork). You have to manually compile it for your board.
A few notes:
  1. When runing ./configure, use -march=armv(6/7/8)-a (replace with the corresponding architecture, Pi Zero/1: v6, Pi 2: v7, Pi 3: v8) instead of -march=native. Also, add -mfpu=neon.
  2. Be warned that since mining is CPU intensive, the Pi may not be a good miner, and can heat up (to 80 degrees Celsius in my case)
  3. Try to find pools which allow for low block difficulties. XMRPool starts off at 1000 for low end hardware and drops to 100 for my Pi (in exchange for lesser payout, as it is a small pool)

For Content Makers

If you have a website, blog, video channel, etc, you can add a browser based miner to your page to allow users to support you without any ads or popups. They donate CPU power for a few hashes, from which you get paid. It will be of little inconvenience to users, too. As an example, I have a miner in the sidebar of my blog which willing users can run if they wish to support me. It runs only when the reader has accepted to run the miner. Do note, never run the miner without the knowledge of your viewers. More details on CoinHive. CoinHive is now shutting down :/


Cheers!
Technohacker

Comments

Popular Posts