Monero logo

Introduction

During a casual coffee break with fellow developers, our conversation took an interesting turn. Someone posed an intriguing question: Why not mine Monero on an AWS machine? This sparked a spirited debate among us, fueled by caffeine and curiosity. The discussion inspired me to conduct a hands-on experiment to explore the feasibility and implications of mining Monero on AWS infrastructure. Here’s what I discovered.

Hold my beer

What is Monero?

Monero (XMR) is a decentralized cryptocurrency that emphasizes privacy, security, and untraceability. Launched in April 2014, it is an open-source project that operates on a public ledger, meaning anyone can participate in the network. Unlike many other cryptocurrencies, Monero’s key focus is on enhancing privacy through advanced cryptographic techniques.

Monero utilizes a Proof of Work (PoW) consensus mechanism. This means that network participants, called miners, validate transactions and add them to the blockchain by solving complex mathematical problems.

Monero is designed to be CPU-friendly, unlike other cryptocurrencies that often require specialized hardware (ASICs) for efficient mining. Monero’s PoW algorithm, called RandomX, is optimized for general-purpose CPUs, making it accessible to a broader range of participants. This design choice helps maintain decentralization, as it allows more individuals to mine Monero using standard computer hardware without the need for expensive, specialized mining rigs.

Warning

Mining any cryptocurrency using AWS is against their policy They can ban your account for mining cryptocurrency on your account.

While the idea of leveraging AWS’s powerful infrastructure for cryptocurrency mining might seem enticing, it is important to be aware of the platform’s strict policies regarding such activities.

AWS explicitly prohibits the mining of cryptocurrencies on their services. This policy is designed to ensure fair use of resources and maintain the integrity and performance of their cloud infrastructure. Mining cryptocurrencies can be resource-intensive and may lead to excessive consumption of compute power, storage, and networking capabilities, potentially affecting other users on the platform.

If AWS detects that you are using their services for cryptocurrency mining, they reserve the right to take immediate action. This can include:

Suspension or Termination of Your Account: AWS can suspend or permanently terminate your account without prior notice.
Loss of Data: Any data stored on the suspended or terminated account could be lost, as AWS may delete it to free up resources.
Financial Penalties: You might incur financial penalties or be required to pay for any excessive resource usage caused by the mining activities.

AWS machine

I bought an AWS t2.medium machine. It costs:

$0.0464 per hour
$1.1136 per day
$33.4080 per month

Mining

I created a Monero wallet in some random mobile application. I connected to mining pool minexmr.com. It was a random choice, just googled it.

[WARNING] Use only trusted software to store and manage your crypto tokens. I did it that way as a part of the experiment.

On the server I run:

ssh -i EC2_standard_instances_access.pem ubuntu@IP
wget https://downloads.getmonero.org/gui/linux64
wget https://github.com/xmrig/xmrig/releases/download/v6.12.1/xmrig-6.12.1-focal-x64.tar.gz
tar -xf xmrig-6.12.1-focal-x64.tar.gz
./xmrig -o pool.minexmr.com:4444 -u 45yNPEpo1B77frcwKz9K3bbV4BLJJpchKBRAwVza6S9WPU4kJnBzsVS1zSpLU5Brdf7g3GDVVBVCP144HhAHUf1S85Pe7g4 > output.log 2>&1 &

By this, I can see my hash rate on the page of a mining pool.

Monero performance test

You can see that at the beginning AWS gave me some boost to the instance, so the hash rate was pretty high. Later it was around 250 hash/second.

Results

I use online calculators to estimate the result:

  Monero mined per day: 0.00004334 XMR
  Mining Revenue (based on 1 Monero = $150):
    per day: $0.01
    per month: $0.30
  Daily electricity costs (based on some online calculator): $1.08

Possible optimization

I am fully aware that my experiment was not optimal, what I could do is:

  • use CPU optimized machines,
  • use spot instances,
  • use a cheaper server provider (eg. Hetzner),
  • maybe do not use cloud, but bare metal machine
  • maybe run it in a country where electricity cost is really small.

There are many optimization ideas, but I leave it for another coffee dispute.

Summary

I made an small performance test of mining Monero on AWS machine. I risked my account to be deleted, but got unvaluable result: knowledge how efficient it can be. By spending $33 on AWS you can earn $0.30, which means 1% of the spent money. It was not enought to buy a coffee, so I delete the wallet and lost the crypto forever.