Correct syntax for liststreamkeyitems count=

+1 vote

Hello!

In terminal, I'm trying to list all stream items on training1Stream on chain training1Chain from key 1522442947163\t1\t88213\t79821\t1\tFILE_ACCESS\tTOPMed to that key plus some count. I've tried 

multichain-cli training1Chain liststreamkeyitems training1Stream '1522442947163\t1\t88213\t79821\t1\tFILE_ACCESS\tTOPMed' count=1

as well as

multichain-cli training1Chain liststreamkeyitems training1Stream '1522442947163\t1\t88213\t79821\t1\tFILE_ACCESS\tTOPMed' '["count=1"]'

and

multichain-cli training1Chain liststreamkeyitems training1Stream '1522442947163\t1\t88213\t79821\t1\tFILE_ACCESS\tTOPMed' "count=1"

As well as just about every other variation of single quotes and double quotes and brackets. Can someone help me out with the syntax?

 

With '["count=1"]' I've gotten the following error:

error code: -8

error message:

Invalid parameter value type, should be boolean

 

With all of the other ones, I get an 'error parsing JSON' error.

 

Thank you!

 

asked Aug 13, 2018 by M.Green

1 Answer

0 votes

You just need to pass the value for the count parameter, not the word count itself. So:

multichain-cli training1Chain liststreamkeyitems training1Stream '1522442947163\t1\t88213\t79821\t1\tFILE_ACCESS\tTOPMed' false 1

(This is assuming that the long string with tabs in it is really your key name - I would suggest using underscores or hyphens instead of tabs to make life easier for yourself.)

answered Aug 13, 2018 by MultiChain
edited Aug 13, 2018 by MultiChain
I just got the same error:

[meg98@idrac multichain-1.0.4]$ multichain-cli training1Chain liststreamkeyitems training1Stream '1522442947163\t1\t88213\t79821\t1\tFILE_ACCESS\tTOPMed' 1

{"method":"liststreamkeyitems","params":["training1Stream","1522442947163\t1\t88213\t79821\t1\tFILE_ACCESS\tTOPMed",1],"id":1,"chain_name":"training1Chain"}

error code: -8
error message:
Invalid parameter value type, should be boolean
Oops - my apologies - there's a verbose parameter before the count. The answer above has been corrected.
Thank you for being patient with me.. Unfortunately, changing the number following the boolean (True/False) isn't doing anything. I just keep getting the same transaction over and over again. Do I have a fundamental misunderstanding of what 'count' does? I'm wanting it to list all stream items starting from the key I provided up until the count.

Alternatively, if there's a way to list all stream items between two stream items (by their keys) then that will also work perfectly as well.

Thank you.
The 'count' parameter controls how many items to return, out of those which have that key. So I think you may not be understanding it correctly.

If you want to list all stream items between two items, you should use liststreamblockitems with a block range based on the blocks containing those two items, then you can extract the exact range what is returned. There's not currently  a more direct way to do it than that.
...