Error code -1 in datastream

+1 vote

Hi,

I converted manually a photo (50 kb) to hex text file (100 kb)

So I do a TEXT=$(</test.txt) in order to have my string in a variable. (I tested with echo and it works)

But when I do: multichain-cli chain1 publish stream1 key1 $TEXT , I obtain an error code: -1 without any error message.

And when I replace $TEXT with a simple hex string like "AAAAEEEE", it works.

Could you please help me ?

Thank you,

Paul

asked May 17, 2017 by Paul

1 Answer

+1 vote

This could be a limitation of the command line shell you are using, in terms of the size of the parameters that it allows on the command line. It could also be because your blockchain has been configured to only allow a smaller amount of metadata per transaction (the max-std-op-return-size parameter). The default for this has been increased in recent versions but it used to only be 4K. (Up to 64 MB is allowed.)

In the event it's the first problem, if you look in the MultiChain help documentation for each API, you will see an example of how to access that API over HTTP using the curl program, rather than via multichain-cli. With the right settings, curl will read in the POST data from a file rather than the command-line directory, in which case you will bypass this limitation.

answered May 18, 2017 by MultiChain
Thank you for your answer. As I have the last version, it was not a problem of size. But I understood later that it was because I was in interactive mode... Sorry for the inconvenience.
However, I have some problems when I do directly the xxd in the command, so I do:
DATA=$(xxd -p file.jpg | tr -d '\n')
and then
multichain-cli chain1 publish stream1 key $DATA
And it works with no problem now
Great, thanks for the update.
...