WinZEC Tips, Tricks and Troubleshooting

WinZEC (formerly Zcash4Win) was the first port of the official Zcash client (known as zcashd) to Windows. As a result, it still powers a large proportion of the Zcash nodes on the network for those who wish to use shielded transactions on a Windows machine.

WinZEC is comprised of two major components, the Swing wallet GUI(the interface that you see when you open WinZEC) originally by vaklinov and the Windows port of zcashd by radix42. Essentially, WinZEC starts a zcashd instance when it is opened, and the Swing wallet connects to it via the RPC interface and makes the process of interacting with the zcashd client simpler and offers an alternative and easier to use interface than using the command line. However, there are some instances where you will want to customise your WinZEC experience or where the GUI is unable to recover from certain situations where manually communicating with the underlying zcashd instance is the better/only option.

In addition, users are typically somewhat reticent to upgrade for fear of losing funds. However, this is mainly unfounded if backups are taken and the process of where and how the data is stored is better understood which this article and series of screencasts hope to address.

Installing WinZEC

WinZEC can be downloaded from https://winzec.com/. At the time of writing the latest release is v1.1.2.

After downloading WinZEC, you can verify the SHA-256 checksum of the v1.1.2 release 12b7cb972f2a3b29b9e70e2104ff75ccbee52df25831cf990b85a5244eaf95e1 on Windows by using a utility such as this which should match the published checksum (see the video below for a demonstration of this).

Once downloaded and verified, you can open the installer and click through to complete the process. This will install the WinZEC application into C:\Program Files\winzec.

The first time the application is opened a number of tasks are run:

  • A data directory is created to store the wallet and blockchain data. By default, this is C:\Users\your-username\AppData\Roaming\Zcash (replace your-username with your username).
  • A sample configuration file is created with sensible defaults in zcash.conf in the same directory.
  • The verifying and proving keys are downloaded that are required to construct and validate the zero-knowledge proofs. The proving key is a large file (~900MB) so this process will take a while to complete and will be downloaded to C:\Users\your-username\AppData\Roaming\ZcashParams.

Note that Sapling has additional parameters required so if you want to run on testnet, you will need these extra parameters. See this file for more information and location of downloads.

Now, take a look at the contents of the C:\Users\your-username\AppData\Roaming\Zcash directory (note you may need to enable the checkbox to view Hidden Items in the file explorer to browse to this directory). The files of most interest to us are:

  • zcash.conf — the configuration file for zcashd.
  • wallet.dat — your wallet file.
  • debug.log — a debug log useful for diagnosing errors.

The remainder of the directory contains the blockchain data, which at present on mainnet is about 20 GB at the time of writing. It is possible, while not fully supported by WinZEC, to change the location of this data directory by configuring zcash.confwhich is outlined later in the article.

Installing WinZEC | https://vimeo.com/293472582

Upgrading WinZEC

Upgrading WinZEC is not only very simple but also necessary. Versions of zcashd are deprecated after just 16 weeks so are no longer guaranteed to work correctly, and updates are required to follow any Zcash network upgrades such as the upcoming Sapling upgrade.

To update WinZEC, you simply have to uninstall the program and then reinstall the new one. The critical thing here is that the data directory is not touched. It’s always a good idea to have a backup but isn’t strictly necessary as your wallet will remain untouched following the upgrade. I demonstrate this in the following video which simply uninstalls WinZEC and reinstalls it again.

Upgrading WinZEC | https://vimeo.com/293468792

Backing Up

WinZEC provides a number of methods to backup your private keys:

  • Making a copy of the wallet.dat file.
  • Exporting a file containing all private keys for t and z-addresses.
  • Exporting a single private key for a t or z-address.

The simplest way of backing up WinZEC is just to make a copy of the wallet.dat file in the C:\Users\your-username\AppData\Roaming\Zcash directory. To restore the wallet, you replace any existing wallet.dat file with this backed-up version. You can also make a copy of the file directly from within WinZEC using the Wallet->Backup menu option which saves the exported file to the user’s home directory.

While simple, the downside of this option is that the only way of importing your private keys is through WinZEC (or any software running zcashd) whereas exporting private keys directly allows you to import to any service that allows private keys to be imported.

WinZEC allows you to export a file containing the private keys for all t and z-addresses via the Wallet->Export private keysmenu item. This uses the z_exportwallet zcashd command, which according to its help file:

Exports all wallet keys, for taddr and zaddr, in a human-readable format. Overwriting an existing file is not permitted.

You can import this file using the Wallet->Import private keys menu item or simply extract a single private key from the file directly and import to any compatible service.

Finally, to export the private key of a single address simply select the address in question and either right click and choose the option to show the private key or use the Wallet->Show private key menu for either t or z-addresses. You may then import a single private key into WinZEC using the Import one private key menu item which can take a while to complete, so just let it run until it completes.

Remember to keep any backup files safe as they contain the keys to all your funds! Protect these files by encrypting them or storing on an offline device.

Also, note that as when using transparent addresses change flows to a new address ensure that you have the private keys to the change addresses or simply use the wallet backup options available.

Backing up WinZEC | https://vimeo.com/293826721

Customising WinZEC

WinZEC may be modified by editing the zcash.conf file, and it will always look for this file in the directory C:\Users\your-username\AppData\Roaming\Zcash. Upon the first run, it will create this file with some sensible defaults such as connecting to the mainnet network and generating a random RPC password.

If you open this file in a text editor such as Notepad, you may view and edit the file contents. There are a vast number of potential configuration options for zcashd as detailed in the documentation and I’ll outline a few of the more common here.

To use WinZEC on the testnet (note the requirement for additional Sapling parameters earlier) simply change the corresponding lines to:

addnode=testnet.z.cash
testnet=1

To start mining with your CPU (only advisable to generate some testnet TAZ coins) add the following lines where numthreads is the number of cores on your PC to use (or -1 to use all available cores):

gen=1
genproclimit=1
equihashsolver=tromp

To enable the experimental feature payment disclosure:

experimentalfeatures=1
paymentdisclosure=1
debug=paymentdisclosure
txindex=1

Some changes, such as that above, will cause an error in restarting WinZEC if the settings are incompatible with the current blockchain data stored on disk. In those instances, it may be required to restart zcashd from the command line specifying additional runtime options. See the troubleshooting section and video below for a full explanation.

Troubleshooting WinZEC

Sometimes, things just don’t work as we expect. Additionally, some configuration changes are incompatible with existing blockchain data and require the blockchain to be reindexed. Or you might want to explore the usage of zcashd itself and not rely on the helpful, but limited, Swing wallet interface.

A common issue is seeing the daemon is taking longer than expected to start message and WinZEC failing to load. To diagnose the problem, which is usually caused by zcashd failing to start properly view the debug.log file which is housed in the C:\Users\your-username\AppData\Roaming\Zcash directory. In this file, the latest lines are at the bottom of the file, and when troubleshooting providing the last few lines of this file will often provide valuable information for debugging purposes. If this file gets too large, simply delete it, and it’ll be recreated. See the video below for a demonstration of using this file to diagnose a startup error.

Another common issue is missing wallet transactions, which is where the balance displayed in WinZEC does not match what is on the blockchain. Firstly, ensure that the blockchain is fully synchronised, but if the problem persists a wallet rescan may be required. To do so open a terminal at C:\Program Files\winzec\app (see the video below to demonstrate this) then start zcashd manually with the command zcashd.exe -rescan.

If the blockchain data becomes corrupt, you change the txindex option, or you’ve tried everything else, and nothing is working you may try reindexing the blockchain. Note that this re-downloads the blockchain from scratch so you’ll need to be patient with this. Again, open a terminal at C:\Program Files\winzec\app and manually start zcashd with zcashd.exe -reindex. Once zcashd is running, you may open WinZEC, and it will use the existing zcashd instance rather than starting a new one.

If you wish to host your data directory in a different location, for example on a different drive due to the size of the blockchain, then you may set the datadir option in zcash.conf file. In this example, I’m using a folder called zcash-data located on a separate hard disk.

datadir=D:\zcash-data

Note that while this works, WinZEC will always display the default data location and wallet location when it is, in fact, it is using this new directory. So be very careful to ensure you are backing up the correct wallet.dat file which will live inside this new data directory. If you have an existing installation and wallet then simply move this folder to the new location except for zcash.conf which must be in the C:\Users\your-username\AppData\Roaming\Zcash directory.

Troubleshooting WinZEC | https://vimeo.com/293973783

Alternative Windows clients

If you ever want to use a later build of zcashd as features are regularly being added and bugs fixed, and WinZEC is updated far less frequently, you can simply swap out these versions of zcashd.exe and zcash-cli.exe in the C:\Program Files\winzec\app directory with newer versions and WinZEC will then use this version. Official Windows builds of zcashd are close, so keep an eye on the documentation.

In addition, there are alternatives to WinZEC that bundle slightly modified versions of the Swing wallet with Windows ports of the zcashd client such as this and this, the development of which was funded by the ZenCash team (now Horizen). These all work in the same manner and the choice of which to use simply comes down to support, the frequency of updates and any additional features that they may have added to the Swing wallet interface.