Recovering ZEC from an old uncompressed WIF private key using zcashd

For the last week I have been desperately trying to recover some old ZEC that I had in a transparent address with a private key starting with “5”, no wallets would allow this format of private key.

All of them would return “Invalid private key”.

I wanted to share this to help others with the same problem, and hopefully also avoid all the stress I went through.

My main problem was that I had an old Zcash private key that was uncompressed WIF format.

The key started with:

5

Modern Zcash wallets I tried would not accept it. Even official/recommended wallet apps either rejected it or treated it as invalid.

The key itself was not bad. The issue was that many modern wallets no longer accept/import old uncompressed WIF transparent private keys.

The solution was to install and use zcashd(full node which is about 270GB at the time of writing this), / zcash-cli directly.

Below is the full procedure, i used windows powershell, but this will will work on a AWS EC2 instance, install debian and then zcashd. This is a guide for Windows.

  1. Install Ubuntu / WSL if using Windows

I did this on Windows using Ubuntu in WSL.

Open PowerShell as Administrator and run:

wsl --install -d Ubuntu

Then open Ubuntu from the Start Menu.

If WSL and Ubuntu are already installed, just open Ubuntu.

  1. Update Ubuntu

Inside Ubuntu, run:

sudo apt update
sudo apt upgrade -y

Install the basic tools needed for the Zcash package repository:

sudo apt-get update && sudo apt-get install apt-transport-https wget gnupg2 -y
3. Add the official Zcash apt repository

Add the Zcash signing key:

wget -qO - https://apt.z.cash/zcash.asc | sudo gpg --dearmor -o /usr/share/keyrings/zcash.gpg

Add the Zcash repository:

echo “deb [arch=amd64 signed-by=/usr/share/keyrings/zcash.gpg] https://apt.z.cash/ bookworm main” | sudo tee /etc/apt/sources.list.d/zcash.list

Update apt:

sudo apt-get update
4. Install zcashd and zcash-cli
sudo apt-get install zcash -y

Check that it installed:

zcashd --version
zcash-cli --version

  1. Fetch the Zcash parameters

Run:

zcash-fetch-params

This can take a while.

  1. Create the Zcash config file

Create the Zcash data/config directory:

mkdir -p ~/.zcash

Open the config file:

nano ~/.zcash/zcash.conf

Paste this:

server=1
rpcuser=zecuser
rpcpassword=MAKE_YOUR_PASSWORD_HERE

listen=1
maxconnections=32
dbcache=1000
addnode=mainnet.z.cash

i-am-aware-zcashd-will-be-replaced-by-zebrad-and-zallet-in-2025=1

Important: change the RPC password to something long and private.

Save the file:

CTRL + O
ENTER
CTRL + X

The last line is needed because zcashd shows a warning about being replaced by zebrad and zallet.

  1. Start zcashd

Start the node:

zcashd -daemon
8. Check sync progress

Use:

zcash-cli getblockchaininfo

For a cleaner progress display, install jq:

sudo apt install jq -y

Then run:

zcash-cli getblockchaininfo | jq ‘{blocks,headers,behind:(.headers-.blocks),percent:(.verificationprogress*100),initial_block_download_complete}’

You want the node to fully sync.

Ideally you want:

initial_block_download_complete: true

or the blocks and headers numbers to be very close.

  1. Import the old uncompressed WIF private key

My old private key started with 5, which means it was an uncompressed WIF private key.

Import it with:

zcash-cli importprivkey “YOUR_OLD_PRIVATE_KEY_HERE” “main-key” false

Explanation:

“YOUR_OLD_PRIVATE_KEY_HERE”

is your old WIF private key.

“main-key”

is just a label.

false

means do not rescan immediately.

  1. Rescan the blockchain

After importing the key, rescan so the wallet can find the old funds.

Stop zcashd:

zcash-cli stop

Wait a little, then start it again with rescan:

zcashd -daemon -rescan

Let the rescan finish.

You can check progress again with:

zcash-cli getblockchaininfo | jq ‘{blocks,headers,behind:(.headers-.blocks),percent:(.verificationprogress*100),initial_block_download_complete}’

  1. Check wallet balance

After the rescan finishes, check the wallet:

zcash-cli getwalletinfo

Check total balance:

zcash-cli z_gettotalbalance

For transparent funds, you can also use:

zcash-cli getbalance

  1. Send the funds to the new address

Once the imported balance appears, send the ZEC to a new address you control.

Example:

zcash-cli sendtoaddress “NEW_ZCASH_T_ADDRESS_HERE” 0.01

After sending, check the transaction:

zcash-cli listtransactions “*” 10
13. Stop zcashd safely

When finished:

zcash-cli stop

Wait until it shuts down cleanly before closing Ubuntu or shutting down the computer.

If recovering funds, the safest path is:

Install zcashd.
Let it fully sync.
Import the old WIF key locally.
Rescan.
Confirm the balance.
Send the funds to a fresh address you control.

The old private key was valid, but modern wallets would not import it because it was an old uncompressed WIF key starting with 5.

Using zcashd and zcash-cli directly solved it.

The key steps were:

zcash-cli importprivkey “YOUR_OLD_PRIVATE_KEY_HERE” “main-key” false
zcash-cli stop
zcashd -daemon -rescan
zcash-cli getbalance
zcash-cli sendtoaddress “NEW_ZCASH_T_ADDRESS_HERE” AMOUNT

Hopefully this helps someone else who thinks their old ZEC is lost because wallet apps reject their old private key.

4 Likes

Right, but you could have used zkool…

Here’s an uncompressed key (it’s secret key #1)
5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf

Import it into zkool

Check the address, balance and tx history:


It matches what the website reports

3 Likes

Yes, I have to mention that Hanh was quick to patch zkool to accept uncompressed WIF private keys after I brought up the issue, thank you Hanh. But because im not too familiar with Github I didn’t feel comfortable. So I went the old fashion route. I do confirm that zkool now supports this type of WIF private key import.

1 Like