How to mine Monero on Akash Network
How to mine Monero on The World’s First Decentralized Cloud Akash Network.
Prerequisites
- Ubuntu Linux with Docker installed
Get and build Monero miner - xmrig
sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
git clone https://github.com/xmrig/xmrig.git
cd xmrig
mkdir build
cd build
cmake ..
make -j$(nproc)
Check the build is there:
/git/xmrig/build$ ./xmrig --version
XMRig 6.14.1
built on Aug 25 2021 with GCC 9.3.0
features: 64-bit AES
libuv/1.34.2
OpenSSL/1.1.1f
hwloc/2.1.0
Containerize the xmrig
Now that you have just built the Monero miner, you need to put it into a container before running it on the Akash Network.
cd .. # change to xmrig top directory
cat > Dockerfile << 'EOF'
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y install libssl1.1 libhwloc15 msr-tools
COPY build/xmrig /usr/bin/
ENV ADDRESS=4Aw4WuWPUvjgiZA11EMJUjQciyR38VcY2WKvLqjwX1r8DAb2YB3UmC3aUHUg8A8PhudPyexVdGpqbjA5dswkPU5NAAMa2cw
ENV POOL=pool.minexmr.com:443
ENV MODE=light
CMD xmrig -o $POOL -u $ADDRESS -k --tls --rig-id ${AKASH_OWNER:-akashnet} --http-host 0.0.0.0 --http-port 8080 --randomx-mode $MODE
EOF
docker build -t andrey01/xmrig:latest .
docker push andrey01/xmrig:latest
Run the xmrig on Akash Network
$ cat monero.yml
---
version: "2.0"
services:
xmrig:
image: andrey01/xmrig:latest
expose:
- port: 8080
as: 80
proto: tcp
to:
- global: true
env:
- "ADDRESS=4Aw4WuWPUvjgiZA11EMJUjQciyR38VcY2WKvLqjwX1r8DAb2YB3UmC3aUHUg8A8PhudPyexVdGpqbjA5dswkPU5NAAMa2cw"
- "POOL=pool.minexmr.com:443"
- "MODE=light"
profiles:
compute:
xmrig:
resources:
cpu:
units: 4.0
memory:
size: 512Mi
storage:
size: 256Mi
placement:
akash:
pricing:
xmrig:
denom: uakt
amount: 100
deployment:
xmrig:
akash:
profile: xmrig
count: 1
Note that I've specified "MODE=light", that way you can mine with as low as 512Mi RAM (might be even lower, but not less than 256Mi). Mining will be slower, around 150 H/s.
If you set "MODE=fast" you will mine about x5 faster, around 850 H/s. But your deployment would need at least 8196Mi RAM.
You can read more here https://github.com/tevador/RandomX/blob/v1.1.9/README.md
Install Akash client
AKASH_NET="https://raw.githubusercontent.com/ovrclk/net/master/mainnet"
AKASH_VERSION="$(curl -s "$AKASH_NET/version.txt")"
curl https://raw.githubusercontent.com/ovrclk/akash/master/godownloader.sh | sh -s -- "v$AKASH_VERSION"
Create your Akash wallet
akash keys add default
export AKASH_ACCOUNT_ADDRESS=akash1h24fljt7p0nh82cq0za0uhsct3sfwsfu9w3c9h
Fund your Akash wallet
Make sure you have at least 5 AKT on your account (preferably a little more for signing the transactions):
export AKASH_NODE="$(curl -s "$AKASH_NET/rpc-nodes.txt" | shuf -n 1)"
akash \
--node "$AKASH_NODE" \
query bank balances "$AKASH_ACCOUNT_ADDRESS"
Denomination: 1 akt = 1000000 uakt (akt*10^6),
Deploy the Monero miner
export AKASH_CHAIN_ID="$(curl -s "$AKASH_NET/chain-id.txt")"
# you need to create cert only once.
akash tx cert create client --from default --chain-id $AKASH_CHAIN_ID --node $AKASH_NODE --gas-prices="0.025uakt" --gas="auto" --gas-adjustment=1.15
akash tx deployment create monero.yml --from default --node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --gas-prices="0.025uakt" --gas="auto" --gas-adjustment=1.15
Ignore the Error: RPC error -32603 - Internal error: timed out waiting for tx to be included in a block
error and note "dseq" in the output from the previous command.
Get the bids from the Akash Network
AKASH_DSEQ=2373334
AKASH_GSEQ=1
AKASH_OSEQ=1
akash query market bid list --owner=$AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ --state open
Calculate the price
512Mi RAM deployment cost $23 a month (xmrig's RandomX MODE=light, ~150 H/s with cpu: 4.0 on akash14c4ng96vdle6tae8r4hc2w4ujwrsh3x9tuudk0
provider)
$ echo '((17*((60/6)*60*24*30.436875))/10^6)' | bc -l
7.46 AKT per month (which is about $23)
8196Mi RAM deployment cost $40 a month (xmrig's RandomX MODE=fast, ~850 H/s with cpu: 4.0 on akash14c4ng96vdle6tae8r4hc2w4ujwrsh3x9tuudk0
provider)
$ echo '((30*((60/6)*60*24*30.436875))/10^6)' | bc -l
13 AKT per month (which is about $40 a month)
Set AKASH_PROVIDER
to whichever provider you choose.
AKASH_PROVIDER=akash14c4ng96vdle6tae8r4hc2w4ujwrsh3x9tuudk0
akash tx market lease create --chain-id $AKASH_CHAIN_ID --node $AKASH_NODE --owner $AKASH_ACCOUNT_ADDRESS --dseq $AKASH_DSEQ --gseq $AKASH_GSEQ --oseq $AKASH_OSEQ --provider $AKASH_PROVIDER --from default --gas-prices="0.025uakt" --gas="auto" --gas-adjustment=1.15
akash provider send-manifest monero.yml --node $AKASH_NODE --dseq $AKASH_DSEQ --provider $AKASH_PROVIDER --from default
akash provider lease-status --node $AKASH_NODE --dseq $AKASH_DSEQ --provider $AKASH_PROVIDER --from default
akash provider lease-status
will show your deployment's URI, e.g.: 9bq5l3nhthaej27ragc6sf44gs.ingress.provider-0.prod.ams1.akash.pub
See the logs
akash --node "$AKASH_NODE" provider lease-logs --dseq "$AKASH_DSEQ" --gseq "$AKASH_GSEQ" --oseq "$AKASH_OSEQ" --provider "$AKASH_PROVIDER" --from default --follow
To stop the Monero miner
akash tx deployment close --node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --dseq $AKASH_DSEQ --owner $AKASH_ACCOUNT_ADDRESS --from default --gas-prices="0.025uakt" --gas="auto" --gas-adjustment=1.15
Get the details of the deployment
You can see how much AKT's your deployment consumed
akash query deployment get --owner $AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ
Deposit 10 AKT to the deployment
Should you want to keep your deployment run longer, simply add more AKT to it
akash tx deployment deposit --from default --chain-id $AKASH_CHAIN_ID --node $AKASH_NODE 10000000uakt --dseq $AKASH_DSEQ --gas-prices="0.025uakt" --gas="auto" --gas-adjustment=1.15
Check your miner's status
Just enter your deployment URI at http://workers.xmrig.info/ and you will see the following:
Check your miner's stats in the MineXMR pool
Enter your Monero address to see the stats at https://minexmr.com/dashboard
That's all!
RandomX Optimization Guide
Profitability
It is not profitable at the current Monero's price, but it might be one day later.
You can see the mining calculator set for 850 H/s:
- https://www.cryptocompare.com/mining/calculator/xmr?HashingPower=850&HashingUnit=H%2Fs&PowerConsumption=0&CostPerkWh=0.0&MiningPoolFee=0
- https://monerobenchmarks.info/
Donations
Please donate me if you find this interesting/useful:
- Akash:
akash1h24fljt7p0nh82cq0za0uhsct3sfwsfu9w3c9h
- Monero:
4Aw4WuWPUvjgiZA11EMJUjQciyR38VcY2WKvLqjwX1r8DAb2YB3UmC3aUHUg8A8PhudPyexVdGpqbjA5dswkPU5NAAMa2cw