How I built a Cryptocurrency Miner Using Raspberry Pi to Mine RavenCoin (RVN)
A step-by-step guide to building a CryptoCurrency Miner using Raspberry Pi4 (a 5W single board computer) for Fun, Experimental, and learning purposes.
You can use it to mine the coin of your choice Mineable (Monero, Ethereum, Ethereum Classic, Ravencoin) or Unmineable coins (SHIBA INU, PancakeSwap, Solana, DogeCoin, etc.)
Step by Step Guide to Mine Shiba Inu SHIB Cryptocurrency using your Windows Computer in a few minutes is here
With that said if you’re going to use your Raspberry Pi to mine any Crypto Coins don’t expect to get rich doing so since the processing power is very limited.
Below is the Snapshot of the Miner Created using Raspberry Pi, It can work headless too, HDMI Monitor is just used for displaying the current status.
We will be running a Mining Software XMRig to Mine RavenCoin using RandomX Mining algorithm on Raspberry Pi4 using Unmineable service pool and RavenCoin Wallet address to Deposit the coins.
Mined coins will be reflected in real-time on the unMineable, will be deposited to RavenCoin Wallet once the min payment threshold is reached.
Components/Services used to Mine in Real-Time
Raspberry Pi4 Model B (2GB RAM, 1.5GHz CPU, and 32GB Memory Card for Storage), the Operating System is Raspberry Pi OS Lite (32-bit).
Ravencoin (RVN) Wallet Address — Coin to be Mined
Ravencoin is a peer-to-peer blockchain, handling the efficient creation and transfer of assets from one party to another. We will need an RVN wallet address to Deposit the mined RVN coin.
RandomX — Algorithm for CPU Mining
RandomX is a proof-of-work (PoW) algorithm that is optimized for general-purpose CPUs. RandomX uses random code execution (hence the name) together with several memory-hard techniques to minimize the efficiency advantage of specialized hardware.
RandomX can operate in two main modes with different memory requirements:
- Fast mode — requires 2080 MiB of shared memory.
- Light mode — requires only 256 MiB of shared memory, but runs significantly slower
Both modes are interchangeable as they give the same results. The fast mode is suitable for “mining”, while the light mode is expected to be used only for proof verification. You can read further about RandomX algo on GitHub
XMRig — CPU Miner using RandomX Algorithm
Official binaries are available for Windows, Linux, macOS, and FreeBSD.
unMineable — Mining Pool
unMineable a service/mining pool that allows you to mine using your CPU or GPU in exchange for various coins. It is an innovative real-time exchanging process, based on actual mineable coins:
- ETH (Ethereum) for our Ethash pool
- ETC (Ethereum Classic) for our Etchash pool
- XMR (Monero) for our RandomX pool
- RVN (Ravencoin) for our KawPow pool
So you allocate your CPU resources to pool mine the Mineable coins such as RVN, XMR, ETC, ETH and get rewarded in your desired coins such as SHIB, Doge, CAKE, CHZ, etc. An entire list of coins can be found here
The underlying exchanging process runs in the background, converting an actual mineable coin reward to the coin you choose. The conversion is processed on each reward, so you can think of it as an almost real-time exchange, to make it more like if you were actually mining the non-mineable coin.
Steps to Start Mining
Step1: Making Sure Raspberry Pi is up to date
Once Raspberry Pi is started, Execute the following commands from the terminal to ensure that Pi is up to date.
sudo apt update
sudo apt-get update
sudo apt-get update - allow-releaseinfo-change#Clean up free space in the local repository for retrieved package
sudo apt-get clean
Step2: Install 64-bit Raspian Container
XMRig only runs on 64-bit so we’ll be using a 64-bit container called raspbian-nspawn-64.
We can get started installing raspbian-nspawn-64 using the following command, Once installed, reboot Pi
sudo apt-get install -y raspbian-nspawn-64
Note: You can skip this step and instead install Raspberry Pi 64 Bit OS, Step by Step Guide to Install Raspberry Pi 64 Bit OS “Bullseye” is here
Step3: Install XMRig
Execute the following command to switch to the 64-bit shell, you can enter exit to switch back to a 32-bit Pi shell.
Execute below in the 64-bit shell to get the up to date package information from the configured sources
sudo apt-get update
sudo apt-get update - allow-releaseinfo-change
Now, To install XMRig, First, we will need to install the dependencies.
sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev##Once completed, Execute the following commands to build xmriggit clone https://github.com/xmrig/xmrig.git
Once build you should be able to see xmrig in the build folder as in the snapshot below
Step4: Start Mining
Now Pi is ready for Mining! Execute the following command to Mine the RVN Coin using unMineable Pool
Syntax: sudo xmrigbuildpath/xmrig -o poolURL -u COIN:WalletAddress -p workername#referralcodeExample: sudo /home/pi/xmrig/build/xmrig -o rx-asia.unmineable.com:3333 -u RVN:RFZ34F9eCpWwKp2eT6bR3VwwFwaBhoyvkb -p aryanRVNPI#dah5-hbmy
xmrigbuildpath/xmrig — xmrig software path we build in Step3 in the build folder. For me the path is /home/pi/xmrig/build/xmrig
poolURL — After the -o you can see the Pool URL, in this case, all you have to do depending on your location is to use one of the following URLs (select the one closest to your location).
- USA: rx-us.unmineable.com:3333
- Europe: rx-eu.unmineable.com:3333
- Asia: rx-asia.unmineable.com:3333
I have selected the pool URL as rx-asia.unmineable.com:3333
COIN:WalletAddress — Coin that needs to be Mined, followed by the Coin’s Wallet address.
Thus the usage is RVN:RFZ34F9eCpWwKp2eT6bR3VwwFwaBhoyvkb
workername#referralcode — After -p you will notice the worker name and referral code.
- Worker name: Name that you provide to identify your worker node, It helps in the case of multiple nodes, my worker name is aryanRVNPI
- Referral code: Code to lower the mining fees from 1% to 0.75% You can use the referral code dah5-hbmy
Thus, I executed the following command and started the Mining in Raspberry Pi 4
sudo /home/pi/xmrig/build/xmrig -o rx-asia.unmineable.com:3333 -u RVN:RFZ34F9eCpWwKp2eT6bR3VwwFwaBhoyvkb -p aryanRVNPI#dah5-hbmy
The screenshot is of Mining in Pi, Since my Pi is 2GB Ram thus the Mining is using the Slow Mode of RandomX Algorithm
Screenshot from Unmineable for the RVN coins Stats mined, Here you can notice the worker name aryanRVNPI.
On Unmineable, Remember to use a valid address for each coin, for example you want to get paid in XMR, use the monero wallet address, In our case we used the RVN coin wallet address to get paid in RavenCoin.
Will mining hurt my Raspberry PI in any way?
No, this process shouldn’t hurt or damage your RaspbeeryPi in any way as long as the temperature is kept under control.
It is recommended though to monitor the temperature of your processor using the below command and use Fan to reduce the temperature.
Mining without Fan, Temperature is reaching to 81–82 Degree
Mining using Pi with an External Fan is under control at about 51–52 Degree.
Congrats, you have mined your First Crypto coin using Raspberry Pi without needing any specialized hardware and you are a Crypto miner now!
You can check the temperature of PI to keep it under control, Further, experiment to overclock the PI to increase the mining hash rate.