Better approach to retrieve data from streams

+1 vote
Hello Multichain team,

I have made a small program to retrieve data under a specific key. I have more than 90 keys each having 13,500 values stored under them.

When I try to retrieve all the values under any key, it takes around 1.5 seconds to 2.5 seconds.

Here is my code :

import subprocess, json

path = "/home/user/multichain-1.0-beta-1/multichain-cli"
id = "1493517600"
max_entries= "100000"
output = subprocess.check_output([path, "chain2", "liststreamkeyitems", "b", id, "false", max_entries]).decode("utf-8")

Is there any better way to improve it / another way to do it to be faster ?

Also, is it possible to retrieve only one value under a key by searching data inside that value ?
asked May 2, 2017 by Varun

1 Answer

+1 vote
 
Best answer

You can use the count and start parameters of liststreamkeyitems to retrieve only a part of the list in a single API call. It's not currently possible to use MultiChain to search inside a value, but we'll certain be adding more of this type of functionality in future versions.

answered May 2, 2017 by MultiChain
...