Download large data from streams

+2 votes

I am trying to download data from a stream using getRawTransaction and I have verbose set to 1 so I receive my response in a JSON format.

I have tested this with a small 12 byte text file that says 'hello world', the data is in the data array in the response;

"data" : [
 "7b2266696c654e616d65223a22736d616c6c5f746578745f73616d706c652e747874222c2266696c6554797065223a22746578742f706c61696e222c2266696c654279746573223a225347567362473867563239796247514b227d"
    ]

My next test was to upload and download a image file of size 214171 bytes. I get an error tho when I try to download this. Looking in the docker container for the getRawTransaction I see that the data string array is now an object array that contains the txid, vout and size;

{
            "txid" : "cd8e6a4431f31f58a2a7192a179edfc712e0941722bba8433fe29250065598a8",
            "vout" : 0,
            "size" : 285668
        }

How and where is the actual data stored within this response so I can download the image file?

asked Nov 22, 2018 by doldy101

1 Answer

+1 vote

This is the intended behavior to prevent API responses from becoming very large. The threshold is set in the maxshowndata runtime parameter. So either increase that, or else use the gettxoutdata API to get the data in full.

answered Nov 23, 2018 by MultiChain
...