what is the best way of image storage on hyperledg

2020-03-08 05:48发布

  1. ipfs or storj
  2. hash of image and store file on s3
  3. convert the image to a Base64 string and store string in composer model

2条回答
闹够了就滚
2楼-- · 2020-03-08 06:13

You can use String and base64 encode it - as a field in an Asset for example.

The question has been discussed here: How can I convert MP3 file to a Base64 encoded string? and here: How to deal with forms,images,videos of an asset in hyperledger composer .

Storing images, scans, audio files is not a 'best practice' - rather, a cryptographic hash of it (referenced off-chain) is verifiable proof that the source is the exact image/media file that was 'hashed' at the time the 'transaction' was recorded on the blockchain and link out of the chain, to a URL containing the verifiable source (and comparable hash). Examples may be: doctor/patient audio discussions (not least the privacy elements!) & consultation recordings, PDFs, mp3s, image files. Another issue is that an encoded base64 image string (if you chose to encode the media/image file that is) will also need to be transmitted to the other peers participating in consensus and written to their copy of the master ledger. It is therefore more efficient, to only share the hash (not the base64 encoded contents with each peer).

查看更多
对你真心纯属浪费
3楼-- · 2020-03-08 06:35

Sahil, you need not store an encrypted file in blockchain. One solution is (for keeping privacy of your data) to store the hash of your file in an asset field. The encryption of the same data will sit outside the blockchain, so your have to create one asset field containing the link to that encrypted file.

查看更多
登录 后发表回答