Sending funds away from an imported z-address private key
I hope you are all have a great day. This is going to be a quick post regarding the importing of the z-address private key and then the subsequent sending away of these funds.
We have noticed an exception that people are experiencing when they try to import their z-address private key from one wallet to another. This exception is "Witness for note commitment is null", and this is still an open issue upstream in zcash (issue can be found here.
After some testing and confirmation by Peastew on the Horizen Discord, we found that when you are importing a z-address private key from another wallet, if the txindex=1 flag is not set in the zen.conf on the wallet you are importing the z-address into, the rescan does not completely index all the transactions associated with the z-address resulting in the "Witness for note commitment is null" exception.
Having the txindex=1 set, from our testing outlined below, allows you to successfully send the funds from an imported z-address. The only downside, is if you are using the GUI wallet or any other full node wallet and you change the txindex flag in the zen.conf, then you will need to reindex your blockchain, database, chainstate.... or use a bootstrap from a super/secure node.
Our method for testing this was to use an old z-address I had from a defunct secure node and I imported this into another secure node with the txindex=1 flag set in the zen.conf.
I then sent the complete balance from this address to a t-address in Arizen.
After the balance in the Arizen wallet was confirmed I sent 0.022 zen to a t-address on the securenode I had imported the z-address to.
I then shielded 0.0219 zen back into the z-address I had imported into that wallet, and subsequently sent 0.01 zen from the imported z-address to the t-address in my Arizen wallet to confirm I could still send funds from the imported address.
I confirmed that the final balance in the z-address was 0.01180000 before exporting the private key.
I forwarded the private key for the z-address to Peastew who imported the key into a wallet where the txindex=1 was not set (txindex=0 is set by default). An interesting observation was made here after the rescan, was where the balance that was shown did not reflect the balance I had confirmed, in this wallet the balance was 0.1002000 zen and not the amount I had confirmed before sending the key.
At this point Peastew attempted to send the zen from the imported z-address which resulted in the expected exception:
Peastew then imported the z-address into a wallet that had the txindex=1 set and was able to successfully send the funds in that z-address out.
I would like to thank Peastew for assisting and confirming the results
I hope that this can help you to try an send the funds from an imported z-address, as always hit me up on Discord or in the comments below if you have any questions or queries.
Have a great weekend everyone.