GetRawTransaction is including more information in original data

+1 vote

Hi,

I am creating a file upload application where I upload a file, convert it to a JSON String and then to a hex value. I publish it to a stream.

Here is an example of a String I would publish before I convert it to hex;

{"fileName":"small_text_sample.txt","fileType":"text/plain","fileBytes":"SGVsbG8gV29ybGQK"}

Now when I retrieve the information from the stream using getRawTransaction I decode it from hex and I end up with a load of extra data...

t{�  �*<��ݯ�}9Y 0�H�����5�mjG0D Y2�qx{<gv_��K��|==�+0
S/��<�0� q(��@��c2����f�����&<^��k�c�!��P�N#�X.̚H�`%�\#��zE��0lK�������spke9Y 0�H�����5�mu*spkk1RjaEgVALivX3koX8fkaUxPYFcgkuSQX6hs68yujL[{"fileName":"small_text_sample.txt","fileType":"text/plain","fileBytes":"SGVsbG8gV29ybGQK"}v����n�o/��Y�d�5 �m`*��

Is there a way I can just retrieve the data I want and not this extra unusable data?

Note when I save my question it does not show all of the data retrieved from getRawTransaction, but my original data is included within the response

asked Nov 22, 2018 by doldy101

1 Answer

+1 vote
 
Best answer

Yes, a transaction contains a lot of padding beyond the raw data itself, so your simplest option is to pass 1 in the verbose parameter of getrawtransaction, then you will see a structure with the transaction's full contents.

answered Nov 22, 2018 by MultiChain
selected Nov 22, 2018 by doldy101
That's brilliant thanks
...