Login
Register
All Activity
Questions
Unanswered
Tags
Users
Ask a Question
Welcome to the Developer Q&A for the
MultiChain
blockchain platform.
Please feel free to ask questions about the platform to receive answers from the MultiChain developers or other members of the community.
Related questions
what is the best way to store user confidential info in blockchain instead traditional databases ?
How to use Stream to Store Data
Retriving data fro stream
Stream Performance Under High Data Load
Multichain Stream File Directory Location
4,156
questions
4,369
answers
5,718
comments
Most popular tags
multichain
streams
assets
stream
transactions
json-rpc
blockchain
wallet
permissions
error
address
raw-transactions
asset
mining
node
api
issue
multichain-explorer
nodes
connect
multichaind
multisig
transaction
smart-filters
metadata
private-key
atomic-exchange
multichain-cli
multichain-web-demo
data
connection
performance
blocks
demo
web
json
database
storage
native-currency
bitcoin
private-blockchain
network
fee
smart-contracts
wallets
signrawtransaction
off-chain
exchange
multiple-nodes
getnewaddress
Store Integer List on Stream
+1
vote
Hello,
I have a list of 7000 integers in resulting from a python script. I want to store it in stream but I am unable to find a solution for that. Could you please guide me on how could we do that ?
Thank You
stream
streams
multichain
asked
May 10, 2017
by
Varun
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1 Answer
+1
vote
Assuming you want to store it in one stream item, convert each integer to 4 bytes of data represented as 8 hexadecimal characters (or 8 bytes / 16 characters if the integers might be really big) and concatenate them all together. These links will help you:
http://stackoverflow.com/questions/2269827/how-to-convert-an-int-to-a-hex-string
http://stackoverflow.com/questions/209513/convert-hex-string-to-int-in-python
answered
May 10, 2017
by
MultiChain
That is nice approach. However, what I want to do is, somehow index values inside a key. I have, for example, 7000 values under 1 key. Each value is a hexlified json structure. This json structure contains many attributes. One of them is "timestamp".
Now, I plan to develop a python script to retreive values based on a range of timestamp. For that I prepared a list of the timestamps from each value. This list essentially gives me the index no.--timestamp correlation.
Once I have an index no. specific to that timestamp, I can easily retrieve that value from stream using the index no.
Can you suggest some better arrangement to do the same ?
If I understand correctly, you want to be able to embed JSON documents inside a stream, and then search the stream for documents where a particular field has a particular value. If so, I'm afraid the answer is that you cannot do this, yet...
Yes, I know that, I however, devised another mechanism to do it. Now the problem is just that : I have a file of 50kb. Is there any way to store this file in multichain's stream ?
Yes, you can store files of up to 64 MB in a stream. It's just the value of the stream item.
Is it simple as "publish stream_name key filename_as_value" ?
Not the file name, the file contents.
Please
log in
or
register
to add a comment.
...