Passing user defined arguments in multichain cli

+1 vote
Here I am trying to pass user defined arguments to cli but it is not working.

arg1= "1V5nnJUpheHFdsMUQkaZBTh3WFd97UZJtKtGfR"

multichain-cli test getaddressbalances arg1

error code: -5
error message:
Invalid address: arg1

how to pass the userdefined argumnets ?
asked Oct 13, 2016 by Rajasekhar

Which shell environment are you trying to do this in? bash or something else?

using bash shell

1 Answer

+1 vote

In bash you would do something like this:


multichain-cli chain1 getaddressbalances $addr

Note that this will not work in multichain-cli interactive mode.

answered Oct 13, 2016 by MultiChain
Thank you for your reply.Now it is working fine
I am trying to pass argument in python script  for command "preparelockunspent"
am getting below error.

1) python  "\'"{"USD":20}"\'"
{'chain-name': 'loanchain', 'params': ("\\'{USD:20}\\'",), 'id': '1476687946.27-742432', 'method': 'preparelockunspent'}
{u'id': u'1476687946.27-742432', u'result': None, u'error': {u'message': u'value is type str, expected real', u'code': -1}}

getting same error for below inputs too
2) python  {'USD':20}
3)python  {"USD":20}
4)python  '{"USD":20}'
It's hard for us to get into this level of debugging, but your general approach should be to use a debug log to output the JSON payload of the request you are sending to the API, and compare this to the first line output by multichain-cli when following the tutorial.

Alternatively why not just use one of the libraries listed at the bottom of this page?