why encoding data in hexadecimal before piblishing in streams

+1 vote
hi, why we must encode data in hexadeciam beforing publishing it in streams ??

the mutichain explorer in php can publish file without encoding, however in commande line we musy encode it , why encoding it ? itahnk you for your help
asked Jan 10, 2019 by ashir

1 Answer

0 votes
You can't pass binary data over a JSON-RPC connection, since JSON has no binary format. So we use hexadecimal strings in order to do that. Another possible option would have been base64, but we don't support that yet. The MultiChain Explorer (or do you mean Web Demo?) is also accessing API data using hexadecimal in both directions.
answered Jan 11, 2019 by MultiChain
yes i mean web demo, i see that the web demo an publish pdf, image .. in streams without encoding
It uses hexadecimal to talk to the API. See the use of bin2hex(...) in page-publish.php and pack("H*", ...) in download-file.php
...