How to send properly zec using cli-wallet?

Hello,
What is the best method for sending zec?

zcash-cli sendtoaddress

Returns me “insufficient funds”. I need to select an account from which I want to send.

Will someone please give me a hint here?
Thanks!

Use zcash-cli z_sendmany see z_sendmany - Zcash 4.5.1-1 RPC Docs and there is more detail in the usage section of the docs: User Guide — Zcash Documentation 5.2.0 documentation

This allows you to send both shielded and transparent funds using the same command.

You could also use zcash-cli sendmany for only transparent addresses as per Bitcoin. Though I have never used zcash-cli sendtoaddress I’m guessing you could set the default account address using zcash-cli setaccount setaccount - Zcash 4.5.1-1 RPC Docs but all these account based calls have been deprecated so just stick with z_sendmany.

1 Like

I saw this command but I supposed it’s for more than 2 transactions.Anyway thank you for helping me out here. I guess that’s the right command. Somehow I have this error when trying to execute the command zcash-cli z_sendmany "$ZADDR" "[{\"amount\": 0.8, \"address\": \"$FRIEND\"}]"

"status": "failed",
"error": {
  "code": -4,
  "message": "Witness for note commitment is null"

I guess I should reindex (thats what i found in google, but i hope for better solution)

You might need to do that but for starters try starting zcashd with -rescan option when the node is already fully synced. This shouldn’t be too time consuming, assuming you don’t have loads of z addresses. I’m basing that on this comment: error on spending from imported z-addresses: "Witness for note commitment is null" · Issue #2524 · zcash/zcash · GitHub

If that fails, yes I’d then try a -reindex.

Well, -rescan didn’t work. Now I’m waiting for -reindex
I’ve stopped it once -reindex and now just started -zcashd, is that a problem? Should I start again -reindex?
p.s I tried once again to send zec and It showed me the same error (it is at 70% synced)

Patience… its not going to work until its synced.

1 Like

Well, I still can’t sync it.
I did -rescan, it went to 72% then it froze. I did restart and start it normally with zcashd, it was downloading a few blocks in hours. So i decided to -rescan it again. Now it is at 56% and stuck, downloading a few blocks in hours but the percentage doesn’t go up.
Any ideas?

The only sticky-sync problems I’ve had are on nodes with not enough memory… maybe that? How much do you have?

1 Like

6gb of Ram. I was thinking the same, but 6gb should be enough

several times -reindex`` -rescan, justn zcashd on two different computers, downloading the blockchain get stuck at 55%. They both have 8gb of RAM. Any ideas? I am running the cli wallet on ubuntu in vmware.The vwmare machine has 7.1gb of RAM

@jumparo I would just let it run, it’s probably hitting very big/full blocks at the 3xx,xxx block heights when some exchange decided to “sweep” literally thousands of transactions.

The sync isn’t just a simple download, it scans every blocks transactions. Also be sure to remove the -reindex or -rescan from your configuration file, it will take even longer next time you start if you start over again.

Edit, for clarification:

If your node is 100% synced and your balance is not correct then you should run -rescan to recheck your copy of the Blockchain.

If your local copy of the Blockchain is bad/ corrupted then the -reindex will start a new Blockchain download from block 1.

If you think it’s “stuck” you can always shut it down with ./src/zcash-cli stop and then restart it to reboot the node. But don’t stop/start it with the reindex/rescan options else it will just add more time to redo work that has already been done.

2 Likes

thank you for the well described reply! I learned something new :slight_smile:
cheers!