Getting address utxos - methods not available?

Hi,

I’m working on a small project to build a Zec transaction based on utxos values. But I"m having an odd issue where it looks like the 2 likely methods to support this don’t seem to be available.

For example, on a dedicated zec node, post request to:
{
“id”:1,
“jsonrpc”:“2.0”,
“method”:“listunspent”,
“params”:[
{“addresses”:[“t1at7nVNsv6taLRrNRvnQdtfLNRDfsGc3Ak”]}
]
}

results in response:
{
“result”: null,
“error”: {
“code”: -32601,
“message”: “Method not found”
},
“id”: 1
}

But from documentation listunspent - Zcash 5.5.0 RPC Docs this looks like a valid request. Also trying with ‘getaddressutxos’ gives a slightly different error.

I can do the following request too, which works fine:
{
“id”:1,
“jsonrpc”:“2.0”,
“method”:“getaddressbalance”,
“params”:[
{“addresses”:[“t1QQwk8HmahouTtsUrNsrmjSHctYh2MuqCz”]}
]
}

So question really is, is ‘listunspent’ method the correct method for this, if so, am I using it correctly? If not, can you point me in the right direction for which method I should be using.

For reference/comparison, I notice on https://getblock.io/ which offers zec node services, that these methods are also marked as ‘method not available’. (probably not relevant. )

Thank you in advance.

Noel

1 Like

It’s not available on the get block io public node service because it is a wallet function and you cannot store funds on a public node.
The method otherwise does work on the latest 5.6.0-rc1. You need to add the min conf and max conf parameters (1 9999999) to call with address arguments as well as the addresses being inside of another array. For building a transaction you will need to know unspent notes at least which will tell you the balances as well in their amounts

1 Like

‘{“jsonrpc”: “1.0”, “id”:“curltest”, “method”: “listunspent”, “params”: [
6, 9999999
"["t1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg","t1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP"]
"
] }’

If you run listunspent with no parameters and it still says method not found then whatever you using does not utilize it, no use

1 Like

Thank you for your reply. I think your right that the node ‘we’ are using doesn’t utilize (or hasn’t enabled it) rather than there being anything fundamentally wrong with the ‘listunspent’ request I’m making. As you suggest, just running the request without any parameters and getting the same message is an indicator of that. Now engaging us our service host to find out why the option isn’t available.

As a side note, I notice on the listunspent - Zcash 5.5.0 RPC Docs page (and others) that the json object for the curl request doesn’t look valid. Specifically:
“params”: [6, 9999999 “["t1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg","t1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP"]”]

… without a comma between the 999999 and the next element (whatever it might be), it looks like the request would throw a json parse error. :thinking:

1 Like

I’m glad I found a solution to this problem here!
Thanks to the commenter for answering in this thread

1 Like