Beam GPU Mining on an Amazon AWS EC2 Instance

Introduction

You want to mine the Beam cryptocurrency but:

  • you don’t own a mining rig,
  • your hardware isn’t good enough to mine anything substantial or
  • you just don’t know how to start?

No worries. I’ve done extensive research and compiled this article to help you setup your AWS GPU mining operation. If you follow this article thoroughly and take no shortcuts, you should be able to successfully mine Beam.

I suggest to first read the article as a whole, so you get an idea of how difficult it is for you. Make sure you understand each and every step. Once you feel certain enough you can do this, work your way through the single steps.

I’m trying to be as precise as possible in this article, however due to different reasons (language barrier, different levels of in-depth knowledge about the topic, …) it’s hard to target every reader to the same level of satisfaction.

If you have any comments, questions, something to add or to criticize, please drop me an e-mail or use the comment form below.

What's Needed for Beam GPU Mining?

To get started, you will need a few certain things. Make sure you have them available, so you can work your way through this tutorial without interruptions.

  • an Amazon AWS account, fully enabled and a working payment method
  • some basic GNU/Linux skills to setup the EC2 instance
  • the mining software (as we don’t have a GUI, we’ll need a CLI based miner)
  • patience to solo mine, as Beam doesn’t support pool mining, yet (January 4th, 2019)

Ready? Then let’s start by setting up the EC2 instance!

Setup of an AWS EC2 instance

First off, let’s have a look at the supported GPUs:

Tesla K40/K80
GeForce 700
GT-730
Tesla K40
Tesla K80
Tesla/Quadro M series
Quadro M6000
GeForce 900
GTX-970
GTX-980
GTX Titan X
GP100/Tesla P100 – DGX-1
GTX 1080
GTX 1070
GTX 1060
GTX 1050
GTX 1030
Titan Xp
Tesla P40
Tesla P4
Tesla V100
GTX 1180 (GV104)

It’s important we keep this list in mind because later, we’ll have to select a GPU from AWS. But first, let’s select an EC2 instance in our AWS account.

EC2 Setup

Now, visit console.aws.amazon.com. The AWS console is the central place for you to manage anything AWS related. They offer a ton of services for literally anything!

Expand the “Services” dropdown menu. Type “EC2” into the searchbox and select the first result, “EC2 Virtual Servers in the Cloud”:

GPU Mining Beam on AWS: 1. Select EC2
GPU Mining Beam on AWS: 1. Select EC2

Security Group

Your instance is basically ready, but let’s first setup a security group (for obvious reasons).

Leave everything as-is for now and navigate to “Network & Security -> Security Groups” in the left menu. Click the blue “Create Security Group” button. Set a name and description, and leave the preselected VPC to which the security group belongs.

We’ll also set a few rules under the “Inbound” tab:

  • TCP port 10000 (we’ll just use the values from the example)
  • UDP port 10000
  • and an SSH port: select “My IP” from the “Source” dropdown

Finally hit the “Create” button to activate the security settings. From now on, you’ll be able to SSH into the EC2 instance from your IP address. Well done!

GPU Mining Beam on AWS: 2. Configure Security Group
GPU Mining Beam on AWS: 2. Configure Security Group

Key Pairs

Next, we need to setup SSH key pairs, so we can connect to the instance safely. Navigate to “Network & Security -> Key Pairs” in the left menu. Now you have two options:

“Create Key Pair”: create new key

Enter a name (I used “Beam AWS Key”) for the key and hit “Create”. A download window will pop up – save the BeamAWSKey.pem (or whatever you named it) on your computer. You’ll need it soon to connect to the EC2 instance.

Note: if you want to use .pub keyfiles, you might wanna convert the .pem to .pub using

ssh-keygen -y -f BeamAWSKey.pem > BeamAWSKey.pub

“Import Key Pair” if you already own one

If you already own an SSH key, you can also use the “Import Key Pair” function. On a GNU/Linux system, it’s likely you already have one, and you can just import ~/.ssh/id_rsa.pub into AWS.

If you don’t, just open a terminal window and type ssh-keygen to create a key. Enter:

  • a name (beam-aws)
  • a passphrase which will secure the key (this is optional, but recommended)
  • type in the passphrase again to verify it and
  • hit return.

This is my preferred way because I can just use the keyfiles my system uses anyway, thus not having to deal with the .pem files.

Your AWS window should look something like this:

GPU Mining Beam on AWS: 3. Generate / Import Key Files
GPU Mining Beam on AWS: 3. Generate / Import Key Files

EC2 Instance (As Cheap As Possible)

In order to save some money, we will set bids on the market. This will allow us to keep costs low and only have our instance running when the market has some available for the price we’re willing to pay.

Navigate to “Instances -> Spot Requests” in the left menu and click “Request Spot Instances”. You’ll have to set a few options to get the right kind of instance.

Instance Settings:

  • AMI: Ubuntu Server 16.04 LTS (HVM), SSD Volume Type (I prefer Ubuntu 16.04 over 18.04 because the latter is newer and still has a few compatibility issues we want to avoid). NVIDIA has an image on the AWS market place, search for “Amazon Linux AMI with NVIDIA TESLA GPU Driver”. It might have all drivers already installed, which should save us a bunch of trouble, later.
    As we’re solo mining anyway, we can just run a plain Ubuntu, install the dependencies and the Node (with built-in CPU & GPU miner) from the beam.mw downloads page.
  • Instance Type: We need the Nvidia GPU instances (p2, g2, g3, g3s). For now, let’s start with the p2.xlarge instance type (when everything works well, we can use a bigger one). It makes sense to check how much you save, compared to the market (the last column):
GPU Mining Beam on AWS: 4. EC2 Instance Type
GPU Mining Beam on AWS: 4. EC2 Instance Type

Your instance settings should look similar to this (excuse the German language; I haven’t found a way to set the AWS UI to English):

GPU Mining Beam on AWS: 5. EC2 Instance Settings
GPU Mining Beam on AWS: 5. EC2 Instance Settings

Also make sure to:

  • select your previously created Security Group in the Advanced Settings (again, sorry for the language…)
  • and, scrolling down a bit to the fleet options, uncheck “Apply recommendations” and remove all suggested instance types which aren’t p2.xlarge (or whatever you selected)
  • plus, check “Lowest price” in the “Fleet allocation strategy” pane.
GPU Mining Beam on AWS: 6. Advanced Settings
GPU Mining Beam on AWS: 6. Advanced Settings

On the bottom, you’ll get an overview over your configuration, also showing you the costs you can expect. You might wanna use the “download JSON-Configuration” button on the bottom left to… well, I guess that’s self explanatory. 🙂

GPU Mining Beam on AWS: 7. Fleet Details
GPU Mining Beam on AWS: 7. Fleet Details

That's it!

You’ve finished configuring your EC2 p2.xlarge instance. Click the “Launch” button on the bottom right, and it should approve with a success message.

Hooray! In the next window, after clicking away the success message, you’ll get a list with details of your EC2 instance. Refresh the “Instances” tab every now and then to see if your request was fulfilled.

Note: if you just bought an EC2 instance, without going through the “request spot instance” procedure, you should get a notification that your launch was successful:

GPU Mining Beam on AWS: 8. Launch successful
GPU Mining Beam on AWS: 8. Launch successful

Click “View Instances“. Here’ you will get an overview over the details of your instance. Copy the IP address, which you’ll find next to “IPv4 Public IP”:

GPU Mining Beam on AWS: 9. Instance Details: IPv4 Address
GPU Mining Beam on AWS: 9. Instance Details: IPv4 Address

Now you can SSH into your machine using the following command


ssh -i ~/.ssh/BeamAWSKey ubuntu@54.172.173.27

where “~/.ssh/BeamAWSKey” is the location and the name of the key you created and saved earlier. If everything went well, you should log in to your new EC2 instance:

GPU Mining Beam on AWS: 10. Login via SSH
GPU Mining Beam on AWS: 10. Login via SSH

Download Beam Miner

We’ve successfully created our EC2 instance. Now it’s time to download the Beam miner (onto our EC2 instance), configure it and start hashing.

When you connect to the instance, you’re in your user’s home directory (/home/ubuntu). This is a good place to store files, so let’s move to the Beam downloads website and search for the CUDA miner (this one is mainly for NVIDIA, the OpenCL is a bit more general purpose). Copy the link to the cuda-miner.tar.gz to your clipboard, go to your terminal window and type:

wget https://builds.beam.mw/mainnet/2019.01.03/Release/linux/cuda-miner.tar.gz

The URI might differ, depending on what release is current. The download should start and finish within a few seconds.

Now, let’s:

  • extract the archive,
  • remove the archive and
  • check if it worked:
tar -pxzf cuda-miner.tar.gz
rm cuda-miner.tar.gz
ls -hials

The last command shows the content of the current working directory. It should contain a few default files, as well as a directory “beam-cuda-miner”.

GPU Mining Beam on AWS: 11. Extract the CUDA Miner
GPU Mining Beam on AWS: 11. Extract the CUDA Miner

That’s it, for now. We have successfully downloaded the CUDA miner. Next, let’s get the node up and running, so we can finally mine some Beam!

How To Configure Your Node

Go to the Beam downloads page, again. This time, copy the link to the GNU/Linux Node into your clipboard. Next, head over to your terminal window (your EC2 instance) and type

wget https://builds.beam.mw/mainnet/2019.01.03/Release/linux/beam-node-1.0.3976.tar.gz

Again, the version number might differ, depending on what the current release is. Once the download is complete, extract the downloaded file using.

tar -pxzf beam-node-1.0.3976.tar.gz

A new binary beam-node and a file beam-node.cfg should be in your home directory:

GPU Mining Beam on AWS: 12. Extract Node
GPU Mining Beam on AWS: 12. Extract Node

Leave the configuration file as is (the node runs perfectly fine with the default configuration). As you’re gonna need another window on your EC2 instance and you don’t want to log in again, let’s first start a screen session. Type screen and hit return. screen allows you to “emulate” windows on a shell.
Now start the node with the following command:

./beam-node

It should give you some output to confirm the node is running:

ubuntu@ip-172-31-88-119:~$ ./beam-node
I 2019-01-09.19:02:29.498 Rules signature: ed91a717313c6eb0
I 2019-01-09.19:02:29.498 starting a node on 10000 port...
I 2019-01-09.19:02:29.506 Node ID=007854b2c0f62468
I 2019-01-09.19:02:29.506 Initial Tip: 0-0000000000000000
I 2019-01-09.19:02:29.506 Requesting block 0-0000000000000000

That’s it – the node is running! Now let’s configure the CUDA miner.

Make sure to check again later, today (January 9th, 2019). I’ll finish this part tonight.

Start Mining

We’re finally there. We:

  • launched an EC2 instance
  • downloaded & extracted the Beam CUDA miner
  • downloaded the Beam node binary and started the node

Using Screen

So, all that’s left is: start mining! You remember: we just started a screen session (screen is a terminal multiplexer), and the node is running in the first “window”. Let’s create another “window” by holding down Ctrl followed by a c. Ctrl a is kind of a hotkey for screen, so it knows it should do something, which is specified by the next keystroke (while still holding down Ctrl). The c stands for “create”, so it creates another window. You can navigate your windows using Ctrl a n (next window) and Ctrl a p (previous window).

The Mining Command

A command to start the CUDA miner would look something like this:

./beam-cuda-miner --server <host>:<port> --key <api key>  --devices <devicelist> 

Fill in the according details to start mining Beam.

  • server: set the IP of your node (as it runs locally, 127.0.0.1:10000 is fine)
  • key: the API keys can be fetched here. This file currently only contains one key (aaaa1234)
  • devices: you can ignore this command if you intend to mine on all devices on your system (otherwise run ./beam-cuda-miner --list-devices to get a list of devices you can use for this parameter)

So, the complete command should look something like this:

./beam-cuda-miner --server 127.0.0.1:10000 --key aaaa1234

Run it and the miner should start hashing! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *