How to Mine Zcash Part 3

header8

Posted by: Gibson Ashpool June 25, 2016 © mineZcash.com

Updated For Main-net 12/16/2016! 

Welcome to Part 3 of the how to mine Zcash tutorial. In Part 1 and Part 2 we covered how to install Ubuntu Linux for running Zcash and began working with some basic functionality and updated our Ubuntu install. I’m going to assume you have followed those two guides closely before beginning this Part 3.

I will be working directly off of the Zcash Sprout 1.0 Guide for this tutorial and adding my own hints and tips along the way. The Zcash Sprout guide is a great resource for those who are familiar with Linux but many of the terms can be confusing for someone with no prior Linux experience. If something in this tutorial seems wrong or possibly out of date always double check the codes here with the Zcash Sprout versions.

So lets get to it!

Downloading

First thing you will have to do is open your Terminal (explained in part 2) and begin installing what are known as dependencies that Zcash requires your Linux system to have before Zcash will run. Think of a dependency as a building block for Zcash to run on.

We begin with entering:

You will notice that “sudo” command again which will allow you to install the packages as a superuser.

Once those dependencies have completed installing we can fetch the Zcash repository:

Now once that has completed if you go into your files directory you will notice a new folder called zcash with several files inside. These files will serve as the instruction set for running the rest of our installation.

To get to these files with the Terminal we need to learn a little more about how to navigate inside the Terminal: The command “cd” is used to “change directories” in the Terminal and will allow you to begin running commands via the Terminal from inside a directory. Up until now we have been working in the Home directory so our command line looks like this:

VirtualBox_Ubuntu Commandline1

but to get into our zcash folder/directory we need to type cd zcash then our command line will look like this:

VirtualBox_Ubuntu Commandline2 

This is a critical difference because if you are trying to run the rest of the commands below from the wrong directory you will get an error like “no such file or directory” You can Navigate into any directory this way and we can Navigate back up a level by typing cd .. lastly we can always Navigate back to the Home directory by entering cd ~

Ok, now that you understand a little about navigating in-to and out-of directories in the Terminal we need to be inside the zcash directory and enter this command:

This will fetch the public alpha proving and verifying keys and place them into a new folder called .zcash-params. These keys are about 950MB so they will take a while to download.

Compiling

Once those parameters have downloaded then we are ready to begin compiling. Check your VM’s settings to be sure you give the VM at least 8GB of RAM for the compilation. If you did not give your VM 8GB it may fail to compile!  (running Zcash does not require 8GB but compiling does) To start Compiling enter:

(Don’t forget that you needed to be in the zcash directory to run!) This build will take a while to run and will compile the dependencies and build zcashd. Zcashd is the primary program that runs Zcash. One that has successfully completed, Congratulations! You have just finished installing Zcash!

Testing before Running

Now we can Test to see if everything was installed correctly by using a few utilities that are included with Zcash. I recommend at least running the first test:

You can also check the build with a RPC test but it will take much longer:

Running

Before we can run Zcash we have to create a new directory and place a configuration file with some parameters in it. To do this first open your Home directory by clicking the files icon on the Launcher. Inside your home directory you see several files like pictures, documents, etc, and of course the important zcash folder. But you also need to see the Hidden Files in this directory. Use CTRL+H to show the hidden files in any directory. You will notice that Linux treats any file starting with a period “.” at the beginning of its name as a hidden folder.

Zcash looks for configurations in a hidden folder called .zcash so we can make one by Right-Clicking and create a New Folder, Now name that folder .zcash . Next we open up that .zcash folder and create a document inside of it; Right-Click again to create New Document–>Empty Document.

This document will be your primary configuration file for Zcash so we need to enter this information into the document:

Click on Save and then name that file you just created zcash.conf Now you have a configuration file for Zcash. This zcash.conf file you just made is very important since tells Zcash several things like your username, password, the node to connect to, if you are on a testnet , etc..

Or if you want to just create the zcash.conf file and a random password automatically via command line use this:

NOTE: above code is for more advanced users, run from the home directory and will overwrite any contents of the zcash.conf folder.

Now that we have a configuration file we can start Zcash:

And you should see a message saying zcash server starting;  You are Now Running Zcash! This Zcash server has to be running for you to give it any commands like receiving, transferring, protecting, spending coins, etc… but with the current configuration file we are not actually mining yet.

Start Mining

I have purposely separated the Running section from the Mining section even though they are actually the same thing. The difference is that you need set up the configuration file differently to also be mining while the server is running. I wanted to show you how to stop and start the server so you can change configurations as needed and there may be times (since we are only on a testnet) that you will want to try different configurations with Zcash without the miner hogging up all of your computers resources.

When you have the server running you can use these to commands to stop and to re-start it:

Keep in mind that after issuing either of these commands it will take some time for the processes to start/stop, be patient.

Once you have stopped the server, go back into the zcash.conf file and add one more line of text:

When you restart Zcash with the updated configuration file in place you will be officially Mining Zcash! You will notice that your CPU will begin pegging as it begins solving to find blocks on the testnet!

Additionally there are few other commands that you can add to the zcash.conf file to ensure you are mining at top performance:

The genproclimit command will set the number of cores you have mining, so change the number to your CPU’s number of cores. And be sure to add the Tromp solver command because it is much faster than the default solver.

Whoo Hoo!! You Made it! You are now a Zcash Miner!

To check your mining progress you can use the command:

You may not see anything immediately; give your computer time to connect to the network. You can also check on your transactions and balance with these commands:

Any coins listed as generated are the the coins you’ve mined and you can spend. Any coins labeled as category: immature are coins you have mined but are awaiting 100 confirmations from the network before they can be spent.

Now that you have a basic understanding of how Zcash and Linux works you can head over and follow the 1.0 Sprout Guide to spend/receive your Zcash. There is great new Open Source Wallet with which I will be adding a Part 4 to this guide to make it easier for you to spend/recieve and protect your Zcash.

 


If you liked this guide please show me some love by sharing with your friends on twitter, facebook, reddit by linking here.

Or make a BTC donation

15VZNqUazPKoK8rJMFb5XUzuB4o6Ww6xD3

This site is only a one man operation and any good press helps keep it alive.

Please stop by the Zcash Forums if you get stuck.

Questions or Comments? Please contact me: feedback (at) mineZcash.com