How do i add images in Hyperledger?

+1 vote
I am trying to make a registry based on hyperperledger with composer .

1- How to integrate image upload with hyperledger Fabric and Composer and How to create smart contract for the registry
Aug 9, 2018 in Blockchain by Shashank
• 10,350 points
89 views

1 answer to this question.

0 votes

You can not directly add an image to the Hyperledger. To add an image to the Hyperledger Blockchain, you need to first convert the image into a Base64 string. 

You can do the conversion using the following code:

fs.readFileSync(‘yourimageFile.jpg’).toString(‘base64’);

And then when the image is converted to the string, store it on the Blockchain like you would usually store any other string.

You can refer to the following links to know more:

https://www.thepolyglotdeveloper.com/2016/02/convert-an-uploaded-image-to-a-base64-string-in-node-js/

https://belltane.wordpress.com/2017/03/27/storing-images-in-hyperledger-fabric-blockchain/

answered Aug 10, 2018 by Omkar
• 67,460 points

Related Questions In Blockchain

0 votes
1 answer

How do i add images in hyperledger?

In your registry, you can Base64-ify your ...READ MORE

answered Aug 20, 2018 in Blockchain by Perry
• 17,020 points
28 views
+4 votes
2 answers

How do I create a new block in Hyperledger Fabric?

This link might help you: https://github.com/hyperledger/fabric-sample ...READ MORE

answered Oct 11, 2018 in Blockchain by Sahu
474 views
+1 vote
1 answer

How do i change the names of validating peers in IBM Bluemix blockchain?

IBM Bluemix Blockchain service Hyperledger Fabric v0.6 will ...READ MORE

answered Apr 10, 2018 in Blockchain by Perry
96 views
0 votes
1 answer
+1 vote
1 answer

I am unable to change port of composer-rest-server. Please help!

Use full format for running a business ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
280 views
+1 vote
1 answer
+3 votes
4 answers

How do I add a new node on a Hyperledger network?

You can do this by generating the crypto ...READ MORE

answered Apr 6, 2018 in Blockchain by Christine
• 15,790 points
1,553 views
+15 votes
5 answers