DEV Community

🐁
🐁

Posted on • Updated on

Mining Monero using Github Actions ⛏️

Update: so it seems that if you try to mine Monero using Github Actions, Github will suspend your account:

To preface this article: don't do this.

This article is for educational purposes only.

A few months ago, my software manager sent me a reddit post about people using Continuous Integration to mine Monero.

The case for using CI to mine Monero exists because the mining algorithm used for mining Monero (randomX) decreases the profitabilty gap between using a GPU & using a CPU to mine.

Thus, it made it somewhat profitable to mine XMR with a CPU (this is where CI comes into the mix).

RandomX took ASIC miners out of the equation, supposedly decentralizing Monero further as institutional miners who had the capital to afford ASICs were disincentivised to purchase ASICs to mine Monero, and were forced to choose either CPU or GPU mining.

To support Monero's case: this lowered the amount of obvious attack points which regulatory bodies could target if they wanted to take down the mining network.

It would be a lot easier to target several massive mining companies, by threatening them with legal notice, than to target several hundreds of thousands of owners of CPUs.

As a detriment, illegal botnets started mining XMR on unconsenting victims' CPUs, and streaming websites started mining XMR via a JS script.

Now, if someone was to go about trying to mine XMR with Github Actions, this is how they might do it:

First, make a new Github repo, then add a Github Actions workflow.

For the basics of this, follow this official guide

In the main.yml file:

name: xmr miner 🦹‍♂️

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Installs xmrig
        run: |
          sudo apt update
          sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
          git clone https://github.com/xmrig/xmrig.git
          mkdir xmrig/build && cd xmrig/build
          cmake ..

      - name: Runs xmrig
        run: |
          ./xmrig -o pool.minexmr.com:443 -u {yourXMRAddress} -k --tls --rig-id workflow


Enter fullscreen mode Exit fullscreen mode

Replace {yourXMRAddress} with a target XMR address.

To trigger this workflow, commit something random to your repo.

Discussion (0)