Error: Error parsing JSON on zcash-cli.exe z_sendmany command

Hi!

Win10+zcashd 5.2.0 and Zecwallet Fullnode 1.8.3 for windows installed.

I try to send money by zcash-cli.exe z_sendmany command like as:

zcash-cli.exe z_sendmany “from_t_address” ‘[{“address”: “to_t_adress”, “amount”: 2.12947999}]’

where “from_t_address” is my t_address and “to_t_address” is t_address destination of zec money. Notte: I respect blank char like show in documentation.

And i got this error message:
error: Error parsing JSON:'[{address:

Then I write the command whitout blank chars:

zcash-cli.exe z_sendmany “from_t_address” ‘[{“address”:“to_t_adress”,“amount”:2.12947999}]’

and the error change in:
error: Error parsing JSON:‘[{address:to_t_address,amount:2.12947999}]’

Cna you help me please?

Thanks, Ale

I get the same result with single quotes around my json string. Give it a try with double quotes, escaping the quotes within - i.e. "[{\"address\":\"to_t_adress\",\"amount\":2.12947999}]"

1 Like

Remember that it needs to also have the privacy policy, and looks like you do need to single-quote the array

Examples:

zcash-cli z_sendmany “t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd” ‘[{“address”: “ztfaW34Gj9FrnGUEf833ywDVL62NWXBM81u6EQnM6VR45eYnXhwztecW1SjxA7JrmAXKJhxhj3vDNEpVCQoSvVoSpmbhtjf”, “amount”: 5.0}]’ 10 0.00001 “AllowRevealedSenders”

1 Like

Hi @BrunchTime ,

I run zcash-cli.exe comand as you suggest me, like:

zcash-cli.exe z_sendmany “t_from_address” “[{"address":"t_to_address","amount":2.12947999}]”

And I received from zcash-cli.exe a opid-number like:

opid-ff99cd595-NNNN-NNNN-NNXN-NNNNXNNNXXXX

where N is numeric and X is alphabetic

Bye, Ale

2 Likes

I suspect the problem here was “magic quotes”. Look at the difference between these two commands:

(EDIT: Wow, even this forum’s editor is replacing the standard double quotes in the second referenced section with the fancy ones. Look at the original posts to see them.)

The former uses fancy quotation marks that some text editors insert:

>>> '“'.encode('utf8')
b'\xe2\x80\x9c'
>>> '”'.encode('utf8')
b'\xe2\x80\x9d'

The latter uses the standard ASCII quotation marks:

>>> '"'.encode('utf8')
b'"'
>>> hex(ord('"'))
'0x22'

Only the standard ASCII quotation mark character is valid JSON.

3 Likes

I notice now that the above opid-ff99cd595-NNNN-NNNN-NNXN-NNNNXNNNXXXX transaction was never carried out and the funds were never transferred.

What’s going on?

Is something wrong?

Thanks, Ale

Yes that means the tx was not broadcasted. You can use zcash-cli z_getoperationresult ‘[“operationid”, … ]’
to get some more info if the node hasnt restarted since.

1 Like

I have to specify as privacypolicy option = “AllowFullyTransparent”, so the correct command is:

zcash-cli.exe z_sendmany “t_from_address” “[{\“address\”:\“t_to_address\”,\“amount\”:2.12947999}]” 10 0.00001 “AllowFullyTransparent”

because I used both t_address.

Then If I want to verify operation result I need to run this command:

zcash-cli.exe z_getoperationresult “[\“opid-number\”]”

with status “success” !

Thanks, Ale

2 Likes

I now notice that the requested transaction of 0.00553074 Zec was successful but I had an additional unwanted debit of 0.01425926 which was credited to unknown t1NyfYcS5k2qKP5iDZ3Z9wNnmMdmKMgFjgU , so I had a total charge of 0.0198 ZEC ?!?!?! Why?

Seeking explanations, thanks.

1 Like

Yep, this is necessary because the z_sendmany API is asynchronous, and some of the checks can’t be done in the initial synchronous phase.

Given how evenly those two numbers add up when including the 1000 zatoshi fee:

0.00553074 + 0.01425926 + 0.00001000 = 0.01980000

I would expect that t1NyfYcS5k2qKP5iDZ3Z9wNnmMdmKMgFjgU is a change address in your wallet. You should be able to see it in the output of zcash-cli listaddresses, in the array at ['transparent']['changeAddresses'] under one of the sources.

3 Likes

Yes! I confirm that “t1NyfYcS5k2qKP5iDZ3Z9wNnmMdmKMgFjgU” is a change address in my wallet.

Thanks, Ale

2 Likes