0

Hi I created an asset in Composer model file.

asset Car identifiedby assetId{
o String assetId
o String data
}

when I am trying to put large file above 30kb, it is throwing error as data too large. So, what is the limit of data that can be stored in a variable?

Is this the wrong way of storing files in blockchain(Hyperledger Fabric using Composer)?

there are questions available for storing file in hyperledger fabric/composer. However, there is no question for storing large file.

Sahil
  • 431
  • 1
  • 6
  • 21
  • 1
    The limitation is not the variable. Generally speaking, it is the wrong way - ie this approach is not recommended - see more here https://stackoverflow.com/questions/49464591/what-is-the-best-way-of-image-storage-on-hyperledger-composer?noredirect=1&lq=1. You should save the files outside the blockchain eg via a secured storage service ? and keep the hashes of the location saved in the ledger. Someone also posted this https://github.com/Preetam007/hyperledger_composer_file_storage as an example – Paul O'Mahony Sep 07 '18 at 10:16

1 Answers1

2

see these answers and guidelines (on what to store etc) on these Stack Overflow resources: is there any size limit for pdf in hyperledger fabric? and also this -> what is the best way of image storage on hyperledger composer? - in the comment section it has a link to a Github resource for alternatives such as IPFS

Paul O'Mahony
  • 6,680
  • 1
  • 7
  • 15
  • My question is not about the best way to store file. I have seen both questions of which you have provided links. However I want to know what is the file size that can be stored in data field of asset that I have used. – Sahil Aug 08 '18 at 11:37
  • 1
    ECMAScript Programming Language Specification does not specify a maximum for String AFAIK. Your heading asked 'how to' and that's what I answered. – Paul O'Mahony Aug 08 '18 at 13:30
  • Paul when I am pushing even a 32kb file it says file size too large. Is there way I can store it in asset parameter. – Sahil Aug 14 '18 at 07:07