listunspent addresses param

+1 vote
Hi

Looking at the json-rpc-api documentation, the listunspent call should accept "addresses" parameter, which in teory should filter unspent transactions for an specific address, but i cannot fine a way use it.

Via rpc, i allways get "{u'id': 3, u'result': None, u'error': {u'message': u'Expected type int, got str', u'code': -3}}"

I'm using version 1.0 alpha 15
asked Feb 23, 2016 by reiven

1 Answer

0 votes

If you're using the third parameter you need to pass the first two parameters first, even if they're optional. Try listunspent 0 999999 '["<the address>"]'

answered Feb 23, 2016 by MultiChain
edited Feb 23, 2016 by MultiChain
Same answer via CLI and JsonRpc
$ multichain-cli chain listunspent 1 999999 1AcHqGPHq25r7PSThISiSNoTValid
{"method":"listunspent","params":[1,999999,1],"id":1,"chain_name":"chain"}

error: {"code":-3,"message":"Expected type array, got int"}

and from RPC:
[INFO] Request: {"chain_name": "chain", "version": "1.1", "params": [1, 999999, "1AcHqGPHq25r7PSThISiSNoTValid"], "method": "listunspent", "id": 4}
{u'id': 4, u'result': None, u'error': {u'message': u'Expected type array, got str', u'code': -3}}

(the address from the request was valid, just replaced some chars)
My apologies - the original version of this answer showed the wrong format. It's been corrected now. You need to pass an array of addresses in the third parameter rather than a comma-delimited list in a string.
Thanks for your answer

It will be great to add this to the official documentation, because its not clear at all the correct way to use that parameter. Also, using all the "escape" chars to use a parameter looks impractical
Thanks - we already fixed it in the docs :)
...