简体   繁体   English

在区块链上/下存储图像? 哪个更好?

[英]Store Images on/off blockchain? which is better?

I'm using hyperledger fabric and need to store images but don't know what is the best way to store is it on or off the blockchain?我正在使用超级账本结构,需要存储图像,但不知道存储在区块链上还是链下的最佳方式是什么? both have their pros and cons.两者都有其优点和缺点。 should sacrifice the security of the images or the performance of the network?应该牺牲图像的安全性还是网络的性能?

Blockchains are not suitable for storing big size data.区块链不适合存储大数据。 There are drawbacks such as the replication rate and limitations such as the block size.存在诸如复制率之类的缺点和诸如块大小之类的限制。

So I recommend using an off-chain storage system.所以我推荐使用链下存储系统。 A common approach is using IPFS, a P2P distributed storage system.一种常见的方法是使用 IPFS,一种 P2P 分布式存储系统。 IPFS provides availability, higher performance and integrity (as files are referenced by their hash). IPFS 提供可用性、更高的性能和完整性(因为文件由其哈希引用)。 The IPFS hash can be saved suitably on the blockchain. IPFS hash 可以适当地保存在区块链上。 IPFS is available as a public P2P network, but you can also deploy your own private IPFS network. IPFS 可用作公共 P2P 网络,但您也可以部署自己的私有 IPFS 网络。

If using IPFS, I also recommend using IPFS-Cluster over IPFS, to manage persistence and replication.如果使用 IPFS,我还建议使用 IPFS-Cluster over IPFS 来管理持久性和复制。

If you need encryption (maybe you don't), you should implement it outside IPFS (in your clients).如果您需要加密(也许您不需要),您应该在 IPFS 之外(在您的客户端中)实施它。 How do you implement it, is up to you and your use case.你如何实现它,取决于你和你的用例。 As @GraphicalDot suggests in its comment, you can encrypt your file via AES and store the key in the blockchain (encrypted in turn via ECIES or ECDH) if you need user-level encryption (although if have its drawbacks if your user enrolls new keys).正如@GraphicalDot 在其评论中所建议的那样,如果您需要用户级加密,您可以通过 AES 加密您的文件并将密钥存储在区块链中(依次通过 ECIES 或 ECDH 加密)(尽管如果您的用户注册新密钥有其缺点)。 Anyway, Fabric itself only provides privacy at organization level (not at user level).无论如何,Fabric 本身仅在组织级别(而不是用户级别)提供隐私。

I think the answer also comes down to the business case of why you want to store images on chain.我认为答案还归结为为什么要在链上存储图像的商业案例。 If you are trying to establish provenance, you can do that with metadata stored on chain and the images off chain, etc. If you want to make sure the images are stored for immutability, then maybe, but if you want to be able to delete them or modify them down the road, then maybe not.如果您正在尝试建立出处,您可以使用存储在链上的元数据和链下的图像等来做到这一点。如果您想确保图像的存储是不变的,那么也许可以,但如果您希望能够删除他们或修改他们的道路,然后也许不是。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM