Step-by-step Tutorial: Setting up a QKC Miner with AWS

No coding background needed

The release of QuarkChain Testnet 2.0, especially the opening of mining functions, has stimulated the enthusiasm of many community members to participate. The popularity has exceeded our expectation. In just few days, more than 1,000 nodes joined the testnet for mining, and the number of nodes is still increasing rapidly. However, at present, the participation method based on Docker is not very appropriate for those who have no programming background or experience in using Docker. This prevents many community members who are eager to try but have no technical background. Since we announced Testnet 2.0 mining event, we have received many questions and requests from community members with weak programming background, such as “How can I participate in mining by using computer with Windows system?” or “I’m not a programmer. How can I get started?” We feel the great enthusiasm and expectation from community members. In order to further reduce the threshold of participation, to enable more people to join in testnet mining, to understand QuarkChain’s high throughput, more flexible characteristics, and to participate in our mining events to win community points, we prepare a simpler, more adaptable, and easier guide for non-technical miners. This guide will step-by-step guide you to use the Amazon Web Services (AWS) to quickly deploy QuarkChain clusters and participate in mining event in a short time. No matter what kind of system and configuration you have, whether you have programming experience or not, as long as there is a computer that can be connected to the Internet, following the tutorial, it is easy to realize 24-hour all-weather mining without supervision.

(For general questions related to mining, please read:https://medium.com/quarkchain-official/quarkchain-bi-weekly-ama-summary-12-01-2018-4dd77d21166b)

Why AWS?

Amazon Web Services (AWS) is a secure cloud service platform that allows users to create multiple cloud servers at the same time. Each cloud server is called an instance, and can be configured as a server host that meets some specifications. Depending on the price, users can choose different computing power, network connection and storage capacity, and the operating system to be installed on each server. AWS’ settlement is very simple — users only pay for the time when the generated server exists, in other words, deleting instance will not cause any cost. Four-core c5.xlarge basic configuration can meet the needs of running nodes and mining at the same time. The price is 0.170 USD/per hour. However, due to the popularity of the Testnet 2.0 mining, the mining difficulty is increasing. Thus, we recommend that, a higher configuration of the EC2 instance will be more helpful to obtain more stable mining reward .

This tutorial is based on the AWS, which is one of the most popular cloud platforms. First of all, AWS has a graphical operation interface, which is simple and easy to use, and is very suitable for non-technical members to get started. Secondly, we provide AWS AMI for non-technical members, and all the requirements needed to run the full cluster and external miners are installed for you in advance. Finally, AWS services can be “paid per use”. That is to say, when the user does not want to mine any more, one just terminates the Instance in the AWS, and the balance in the user’s AWS account will not decrease. By running through our mining tools, users have opportunities to generate new blocks to obtain our mining rewards.

2. What you will need？

Personal laptop (Have access to Internet). An account at AWS. If you don’t have one, you can use the following link to apply a new account: https://aws.amazon.com

To learn more about how to setup an account: (https://www.youtube.com/watch?v=uJssXPyMf0s)

3. Installation of AWS

Step 1: Select the Region and EC2 Services.

First, login to your account. At the upper right navigation bar, select the region of US West (Orgen) since provided a public AMI in this region.

Next, click “Services” at the upper left navigation bar and click “EC2”.

Step 2: Choose a QuarkChain AWS image.

First, click “Launch Instance” button at the EC2 dashboard:

The public AMI we provided has a prefix named “QuarkChain Sample AMI Testnet 2.x.x”. You can find it by the following two steps:

Select “Community AMIs” at the left navigation bar. At the search column, search for “QuarkChain” (either uppercase, or lowercase).

You will get the result like the following picture, and then click the “Select” button at the right (Please notice that the real name might be differed with the screenshot we provided.):

Step 3: Choose an instance type.

At this step, you are asked to select an instance. We recommend to select an instance at least with 4 CPUs, 8Gib Memory, and a higher network performance is preferred. In this tutorial, we select c5.xlarge as an example. At real mining process, you might need to adjust the instance type accordingly, depends on the mining difficulties.

Step 4: Setup port forwarding.

After you choose the instance type, click the “6. Configure Security Group” at the top directly. You will need to setup the port forwarding to enable our new p2p mode, which allows traffic to the port in security group settings.

Click “Add Rule” button twice, both TCP and UDP for port 38291 need to be open, so change the type and other settings as:

1st rule: Type: Custom TPC Rule, Port Range: 38291, Source: Anywhere

2st rule: Type: Custom UDP Rule, Port Range: 38291, Source: Anywhere

The screenshot is as follows:

Step 5: Review the instance and create a new key pair for your account.

At this step:

Review the instance and click the “Launch” button. A popup will show up, select “Create a new key pair” at the dropdownlist, and at the “Key pair name” column, input a name. Click the “Download Key Pair” button. Please do remember to download the key pair to your local directory (You will need the path to the directory later. To make it simple, save it to your Desktop is recommended). Click the “Launch Instances” button.

Screenshot attached as follows:

Step 6: Launch the EC2 instance.

Good job! Now you successfully launch the EC2 instance!

Step 7: Connect to the running AWS machine.

Click the “View Instances” button show in the previous screenshot, and then you will be redirected to the Instance page. You can find the instance you just created here, and it might take a little time to make the “Instance State” change from “pending” to “running”. See following:

Step 8: Connect to your instance.

To connect to your instance, you need to run a terminal in your personal computer.

Open Terminal. If you use Macbook, the terminal located at Applications — Utilities — Terminal. Or, you can use the “Spotlight Search” and type “terminal” to open it. At the terminal, first navigate to your directory that saves the key pair file. If you saved it at your Desktop earlier, then here you can simply run “cd Desktop”. Screenshot as follows:

3. Now connect to your instance. Go back to the AWS EC2 Management Console, select the instance, and then click the “Connect” button next to “Launch Instance” at the top, and then there will be a popup dialog like this:

You will find the attached information in the popup:

chmod 400 $KeyPair

ssh -i $KeyPair root@ec2-$PUBLIC_IP.us-west-2.compute.amazonaws.com

4. Replace the “root” to “ubuntu”. So the command line will look like this after change:

chmod 400 $KeyPair

ssh -i $KeyPair ubuntu@ec2-$PUBLIC_IP.us-west-2.compute.amazonaws.com

5. Copy and paster these two command lines to the Terminal:

Now at the terminal, last line would be similar with the above screenshot. You’re now connected to the instance!

Step 9: Start the quick miner tools.

The quick miner tools are designed for the non-technical miners. Just run the bash file and follow the guidance. Then the tools can help them initialize the cluster and external miners.

First navigate to the pyquarkchain directory:

cd pyquarkchain

When you want to start the quick miner, just use the following command lines:

bash quarkchain/tools/quick_miner_tool.sh

It will ask you to provide your coinbase address. If you already have one, then input your address here; if you haven’t had one yet, use the Enter key and the tool will automatically create one for you. Please save the private key and the address for your record:

Step 10: Wait for the Synchronizing block.

You will need to wait 20 seconds till the cluster starts to synchronize the blocks. You can see from the screenshot that the “Syncing” is True, and the LocalRootHeight is catching up the CurrentRootHeight:

When the cluster has done sync task for the highest root block, the synchronizer finishes. Enter “Y” when shows the following question:

Then you will see something like this, which means the mining process is working! You’re all set now!

Step 11: Check your mining rewards.

You can go to our web UI: http://testnet2.quarkchain.io/leaderboard to check your mining rewards.

Step 12: Stop mining and terminate the instance.

When you want to stop it, just run:

bash quarkchain/tools/quick_miner_stopper.sh

Finally, you might want to stop or terminate your instance if you don’t want to mine anymore.

If you have any questions, please join our Telegram: https://t.me/quarkchainio to ask questions! Enjoy mining at QuarkChain Testnet 2.0!

ps: The final interpretation right of this activity belongs to QuarkChain Foundation LTD.

FYI

Website

https://www.quarkchain.io

Discord

discord.me/quarkchain

Telegram

https://t.me/quarkchainio

Twitter

https://twitter.com/Quark_Chain

Medium

https://medium.com/quarkchain-official

Reddit

https://www.reddit.com/r/quarkchainio/

Facebook

https://www.facebook.com/quarkchainofficial/