在Hyperledger Composer上存储图像的最佳方法是什么? [英] what is the best way of image storage on hyperledger composer?

查看:53
本文介绍了在Hyperledger Composer上存储图像的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. ipfs或storj
  2. 图像散列并在s3上存储文件
  3. 将图像转换为Base64字符串并将字符串存储在作曲家模型中

推荐答案

您可以使用String并对其进行base64编码-例如,作为Asset中的字段.

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

问题已在此处讨论: 如何将MP3文件转换为Base64编码字符串? 和这里: 如何处理表单,图片,视频在Hyperledger Composer中的资产.

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 .

存储图像,扫描文件和音频文件不是最佳实践"-而是对其进行加密散列(在链下引用)是可验证的证据,表明来源是散布"在其中的确切图像/媒体文件在链上记录交易"并链接到链外的时间,该URL包含可验证的源(以及可比较的哈希).例如:医生/患者的音频讨论(尤其是隐私元素!)和咨询录音,PDF,mp3,图像文件.另一个问题是,还需要将编码后的base64图像字符串(如果您选择对媒体/图像文件进行编码)也需要传输给参与共识的其他对等方,并写入其主分类帐的副本中.因此,仅共享哈希(而不是与每个对等方共享base64编码的内容)会更有效.

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).

这篇关于在Hyperledger Composer上存储图像的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆