简体   繁体   English

如何在Hyperledger Fabric Blockchain中存储图像?

[英]How to store images in Hyperledger Fabric Blockchain?

I am new in Hyperledger Fabric Blockchain. 我是Hyperledger Fabric Blockchain的新手。

Is this possible to store images in Hyperledger Fabric Blockchain? 这是否可以在Hyperledger Fabric Blockchain中存储图像?

If yes, then how can I do that? 如果是,那我该怎么做? I believe we can store images by converting them to base64 string. 我相信我们可以通过将图像转换为base64字符串来存储图像。

What is the maximum size of the image we can store in the Hyperledger Fabric. 我们可以在Hyperledger Fabric中存储的图像的最大大小是多少。

If the chaincode is written in java then we use ChaicodeStub.putState(String key, byte[] value) method to save the data into blockchain. 如果链代码是用java编写的,那么我们使用ChaicodeStub.putState(String key,byte [] value)方法将数据保存到区块链中。

A Java byte array can hold up to 2^31-1 values, if there is contiguous memory available. 如果存在可用的连续内存,则Java字节数组最多可以容纳2 ^ 31-1个值。

PS: An alternative approach could be to store the hash of the image in blockchain. PS:另一种方法可能是在区块链中存储图像的哈希值。

Documentation 文档

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

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