Skip to content

Setting up a QKC Miner in 5 Minutes with AWS

Jie You edited this page Nov 29, 2018 · 1 revision

What you will need?

A personal computer with some sort of SSH terminal

https://www.youtube.com/watch?v=rfYZR6opTVg

An account at AWS

https://www.youtube.com/watch?v=uJssXPyMf0s

Installation of AWS

Step 1: Select an EC2 instance

Step 2: Choose a QuarkChain AWS image

We provided a public AMI in US West (Oregon) Region QuarkChain Sample AMI - ami-0bc201609b49cc40f using this setup.

Step 3: Choose an instance type

Step 4: Setup port forwarding

You need to set up the port forwarding to enable our new p2p mode, which allows traffic to the port in security group settings. Both TCP and UDP for port 39291 need to be open.

Step 5: Review instance launch

Step 6: Create a new key pair for your account

Step 7: Launch the EC2 instance

Step 8: Connect to the running AWS machine

Step 9: Connect to your instance

To connect to your instance, you need to run a terminal in your personal computer. Then connect to your instance using the SSH.

chmod 400 $KEYPAIR
ssh -i  $KEYPAIR ubuntu@ec2-$PUBLIC_IP.amazonaws.com

Step 10: Run a cluster

cd pyquarkchain
pypy3 quarkchain/cluster/cluster.py --devp2p_enable --coinbaseaddress=$COINBASEADDRESS --cluster_config configuration.json

NOTE the coinbase address is your Quarkchain wallet address. If you do not have one, please create one from our online testnet wallet.

Step 11: Run an external miner

Open a new terminal and connect to the instance same as Step 10. Then start mining using the following command,

pypy3 quarkchain/tools/external_miner.py --worker $NUMBERS_OF_WORKDER --shard $SHARD_ID --host localhost --config configuration.json

Command Line Flags

Command line flags are defined in external_miner.py. Some interesting ones regarding mining:

  • --worker (default 1) defines the number of worker threads. Utilize as many CPU cores as possible.

  • --shard defines specify shards to mine. Use R to indicate root chain and 0 ~ 7 to indicate sharded chain id. More specifically, shards 0 ~ 3 are Ethash, 4 ~ 5 are Double Sha256, and 6 ~7 are Qkchash. Since each worker thread is an independent process, you may want to make the number of specified shards equal to the number of worker threads.

  • --config defines the path to config JSON file, same as the config running cluster

You can select one shard or multiple shards to mine according to your machines. One example command line of two worker threads working with shard 0 and 1 is,

pypy3 quarkchain/tools/external_miner.py --worker 2 --shard 0 1 --host localhost --config configuration.json

Step 12: Monitor the mining results