How to view the image in offchain data on second node

+2 votes
Hi All,

I have created a stream and saved an image as offchain data , when i check the 2nd node i can see the data as basecode 64( correct me if wrong -it is the format that store  multichain stores the images) but when i try to convert the entire data to image in a web decoder I get no image . My question is how can I write an image in one node and view the same on another node, if i convert image to hash and store on stream then i wont be able to recover the image from the hash. please guide.

Thanks in advance
asked Jun 2, 2019 by sp

1 Answer

0 votes

The data itself is stored in raw binary format on the blockchain, but it is published and retrieved via the API in hexadecimal format.

So you can convert it to hexadecimal before calling the publish API and then use gettxoutdata to retrieve the data in hexadecimal and convert it back to binary for retrieval.

Alternatively, you could consider using the binary cache which allows the binary data to be both published and retrieved via the file system – see the createbinarycache and txouttobinarycache commands, and the {"cache":"...."} form accepted by the publish API.

answered Jun 4, 2019 by MultiChain
...