Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on spending from imported z-addresses: "Witness for note commitment is null" #2524

Open
food4fort opened this Issue Jul 11, 2017 · 27 comments

Comments

@food4fort
Copy link

food4fort commented Jul 11, 2017

Describe the issue

Error when using z_sendmany. Cannot get ZEC to send from Z-addr to T-addr.
@mineZcash asked me to submit an issue. I may be doing something silly, but I've followed the instructions at https://github.com/zcash/zcash/wiki/1.0-User-Guide precisely.

Can you reliably reproduce the issue? Yes

If so, please list the steps to reproduce below:

user@machine:~/zcash$ ./src/zcash-cli z_sendmany "$ZADDR" "[{\"amount\": 0.01, \"address\": \"$TADDR\"}]"

Where $ZADDR is a valid Z-addr that I own, containing 0.1 ZEC
And $TADDR is a valid destination T-addr

Expected behaviour

Send ZEC to T-addr and send change to Z-addr.

Actual behaviour + errors

user@machine:~/zcash$ ./src/zcash-cli z_getoperationresult
[
{
"id": "opid-4f5b107c-e2f9-4baa-ad26-6766a09569bd",
"status": "failed",
"creation_time": 1499786139,
"error": {
"code": -4,
"message": "Witness for note commitment is null"
},
"method": "z_sendmany",
"params": {
"fromaddress": "zc***YJ",
"amounts": [
{
"amount": 0.01,
"address": "t1caB4gcjYdrdBmvPUKFWNqbZ5DBBgTmERZ"
}
],
"minconf": 1,
"fee": 0.0001
}
}
]

The version of Zcash you were using:

Zcash Daemon version v1.0.10-1

user@machine:~/zcash$ ./src/zcash-cli getinfo
{
"version": 1001051,
"protocolversion": 170002,
"walletversion": 60000,
"balance": 0.05785966,
"blocks": 147298,
"timeoffset": 0,
"connections": 1,
"proxy": "",
"difficulty": 4447273.891751582,
"testnet": false,
"keypoololdest": 1495558030,
"keypoolsize": 104,
"paytxfee": 0.00000000,
"relayfee": 0.00000100,
"errors": ""
}

Machine specs:

  • Ubuntu 16.04.2 LTS
  • CPU: 4x AMD Athlon II X4 630
  • RAM: 4GB
  • Disk size: 256GB
  • Disk Type (HD/SDD): SSD
  • Linux kernel version (uname -a): 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Compiler version (gcc -version): gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Any extra information that might be useful in the debugging process.

Before updating to v1.0.10-1, there was a different error. Something about "anchor null". Update has changed the error, but an error none-the-less.
Same errors are replicated when using Zcash Swing Wallet on Ubuntu

Do you have a back up of ~/.zcash directory and/or take a VM snapshot?

Not currently.

@bitcartel

This comment has been minimized.

Copy link
Contributor

bitcartel commented Jul 12, 2017

@food4fort I think you'll have to shut down, back up, and then relaunch with 'zcashd -reindex' and wait for the node to finish reindexing and syncing. Then try again and see if the error still occurs.

@radix42

This comment has been minimized.

Copy link
Contributor

radix42 commented Jul 12, 2017

if that zaddr has exactly 0.01 ZEC in it, you can't send that much because of the transaction fee (which defaults to 0.0001 ZEC). So you send at most 0.0099 ZEC.

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 12, 2017

@bitcartel Thanks will try

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 12, 2017

@radix42 It has 0.1 and I'm sending 0.01

@radix42

This comment has been minimized.

Copy link
Contributor

radix42 commented Jul 12, 2017

oh haha what's a decimal point among friends....hm yeah that is not good

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 12, 2017

@radix42 ;-) I'm re-indexing now as @bitcartel suggested. Didn't realise this means re-syncing the entire blockchain, but it does, and I'll report back once done.

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 12, 2017

Have re-indexed (resynced entire blockchain), and am still getting same error
error code: -4, "Witness for note commitment is null"
Have no issues sending from T-addr in same wallet to the same destination T-addr. So it must be some issue with the Z-addr or how I am invoking it. Z-addr definitely has balance of 0.1 ZEC
@bitcartel : thanks for your advice. Any other thoughts? Thanks

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 12, 2017

Could it be a memory limit problem??

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 12, 2017

OK wait. This is the same issue as #2486. I am working in a wallet I imported to Ubuntu from zcash4mac because zcash4mac was chugging on my laptop. Please feel free to merge this. I note that this has already been allocated for a potential fix in 10.0.11 by @daira

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 12, 2017

Just to confirm, this is not an issue with z_sendmany, it's an issue with an imported Z-address.
I have created a new Z-address on the same wallet, and with this Z-addr, z_sendmany behaves as expected. The error is only reproduced when trying to send from a z-addr I imported from a previous wallet. Cheers.

@bitcartel

This comment has been minimized.

Copy link
Contributor

bitcartel commented Jul 13, 2017

@food4fort On the new wallet, did you first import the key and then shut down and launch with reindex?

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 13, 2017

@bitcartel Not originally, no :( But I imported the wallet weeks ago. I did reindex yesterday, and it still seems to be broken.

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 13, 2017

@radix42 @bitcartel OK, confirmed. I brought my old (Mac) wallet up to date with the blockchain. Using that, I can send from the z-address that I was having trouble with on my new wallet. In conclusion, there is an issue with transferring z-addresses that were created by a previous wallet. In this case, it was a z-addr created using zcash4mac, and imported into an Ubuntu installation of zcash client (using Swing Wallet GUI). There must be some property of a z-addr that is unique to the wallet, or is not transferred correctly with an export/import. I can't remember now if I used a wallet export (I think so), or just exported/imported the keys.

@str4d

This comment has been minimized.

Copy link
Contributor

str4d commented Jul 13, 2017

This issue is to do with the way note witnesses are cached in the wallet. These can be deterministically recreated from the block chain and the spending key, and so there is no potential for loss of funds.

I spent a lot of time before release working to get this right, and some time after release fixing bugs with it, but clearly there is at least one remaining. Importing z-keys in is the problematic case, because note witnesses can only be correctly updated going forwards, so adding a z-key almost always requires rescanning the entire block chain. Likely there is some interaction problem remaining with the delayed rescan (by specifying "no" for the first few keys) that we'll have to chase down.

@food4fort

This comment has been minimized.

Copy link
Author

food4fort commented Jul 13, 2017

OK thanks @str4d . Have resurrected funds by going back to the original wallet, so not an issue for me now. And unlikely to move my wallet any time soon. Cheers, Tom

@nathan-at-least

This comment has been minimized.

Copy link
Contributor

nathan-at-least commented Jul 24, 2017

I've seen a problem that may be related. Trying to recall the behavior (I may be misremembering steps):

  1. `zcash-cli validateaddress "$MY_TADDR" - this shows the address is not owned by the current wallet.
  2. zcash-cli importprivkey "$MY_T_KEY" "" true - the label is empty string and I pass true for the rescan parameter. The debug.log mentions rescanning (and it takes a while). After that completes:
  3. `zcash-cli validateaddress "$MY_TADDR" - this still shows the address is not owned.
  4. Stop the node, restart it with the -rescan, and now zcash-cli validateaddress "$MY_TADDR" shows that the wallet does own the address.

If I'm correct about this sequence, then there's something different about the "live rescan" of importprivkey and a "restart rescan", and there's some consistency bug.

This may or may not be related to this ticket's issue.

@ioptio ioptio changed the title z_sendmany errors when sending from Z-addr to T-addr error on spending from imported z-addresses: "Witness for note commitment is null" Jul 25, 2017

@str4d str4d added this to 1.0.14: Spending Fixes in Release planning Nov 10, 2017

@daira

This comment has been minimized.

Copy link
Contributor

daira commented Nov 23, 2017

Probably related to #1936 (as pointed out by Zen folks, thanks).

@daira daira added bug wallet labels Nov 23, 2017

@daira daira added this to the 1.0.14 milestone Nov 23, 2017

@daira

This comment has been minimized.

@ioptio ioptio moved this from Collect Information to Blocked in User Support Nov 27, 2017

@str4d str4d removed this from the 1.0.14 milestone Dec 21, 2017

@Tomas-M

This comment has been minimized.

Copy link
Contributor

Tomas-M commented Feb 4, 2018

Since this was removed from 1.0.14 milestone, are there any plans to include it in 1.0.15? Or what is the status if this?

Is there a workaround for people like me who have funds locked in, unable to spend due to this bug?
I tried to erase entire blockchain and index, and resync from scratch, but I still get Witness for note commitment is null. I also tried both -reindex and -rescan arguments while starting zcashd, no help.

The problem happens to me on a shielded address which was imported using private key.

Thank you

@Tomas-M

This comment has been minimized.

Copy link
Contributor

Tomas-M commented Feb 4, 2018

Note to add, the priv key was imported with "rescan=yes" setting in the RPC call for import

@lindanlee lindanlee moved this from Blocked to Discussion in User Support Feb 5, 2018

@aleqx

This comment has been minimized.

Copy link

aleqx commented Feb 6, 2018

Darn, I've been hit by this as well. Same scenario: imported a Z privkey in an empty wallet of a newly created node ...

@theVstro

This comment has been minimized.

Copy link

theVstro commented Feb 6, 2018

@Tomas-M

This comment has been minimized.

Copy link
Contributor

Tomas-M commented Feb 6, 2018

This is interesting, did you try to omit one of the folders, to see which one makes the difference?

@aleqx

This comment has been minimized.

Copy link

aleqx commented Feb 6, 2018

FWIW: i’ve been able to workaround this by seeding the new node with the
blocks/chainstate/database folders. Bring up the new node with those
folders in place first, a new wallet is created, then import the Z address.
HTH

That is exactly what I did on two new nodes. On one it worked fine, on the other I got this error. I note that the blockchain data was built with txindex=0 (i.e. there was no txindex=1 in the .conf file in either of the 3 nodes).

@klaxalk

This comment has been minimized.

Copy link

klaxalk commented Feb 11, 2018

Hi, I second the issue. I started a node on a new comuter, imported keys before it synced using "z_importwallet".

@aleqx

This comment has been minimized.

Copy link

aleqx commented Sep 15, 2018

Just been hit by this on Zen. My problem is that I no longer have the original wallet, so I can't go there to spend the funds. I read here from @str4d that

witnesses [...] can be deterministically recreated from the block chain and the spending key, and so there is no potential for loss of funds."

Right ... how exactly?

@Aquilae32

This comment has been minimized.

Copy link

Aquilae32 commented Dec 7, 2018

This discussion goes beyond my level of knowledge. I want to point out that adding -rescan to the command line when launching zcashd was the solution for me; -reindex (which leads to downloading the whole chain of blocks) was not enough. I'm using Ubuntu 18.04.01 with the original Zcash wallet, but I've made Ubuntu version updates in the past. Since Coinbase added Zcash to its list of supported cryptocurrencies, I wanted to be able to do this transfer operation from one wallet to another.

@mms710 mms710 added this to Needs Prioritization in Zcashd Team Jan 3, 2019

@mms710 mms710 moved this from Needs Prioritization to Sprint Backlog in Zcashd Team Jan 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.