I am just a beginner in HyperLedger Composer and Fabrics.
Following IBM tutorial under 'https://www.coursera.org/learn/ibm-blockchain-essentials-for-developers'
I have one quick question:
How to create a File Server using Hyperledger Composer?
Is it possible now or not?
any feedback will be very helpful.
Using Composer and Fabric as a File Server would be unusual, and due to the nature of Fabric as a Distributed Ledger, it may well perform badly as a File Server.
There are other Questions and Answers in Stack Overflow about storing images etc using base64 encoding, such as this one.
Depending on your use case, it may be more appropriate to store some hash of the file on the Fabric enabling you to prove the validity of the file, whilst storing the file itself on a dedicated File Server.
With the nature of technology, saving a file in hyperledger fabric and using it as a file server would not be a good strategy.
You Hash the original file and Use hyperledger fabric to store the Hash value and other data you need for the system and to Validate. But you should use a different server to Store the Files.
Something similar to this would work I guess: A Sample System Design : Image
Any changes, updates or a version change, you store the new file in the server, create the new hash and add the data in to new entry in hyperledger fabric.
Related
For the past few days i am trying to learn blockchain, more specifically in using hyperledger fabric
However, while i am quite familiar building centralized app, i am so new in grasp this whole new concept, and got some question in mind i haven't found answer, yet.
If its decentralized, does the script will run as desktop background process in every machine connected to the network through internet?
Since
no way it could be "decentralized" if its hosted on 3rd party server
blockchain platform seems could seamlessly write/read local files, which certainly not possible at the case of hosted in 3rd party server
existing blockchain application (i.e bitcoin) written for desktop (c++)
If it does desktop process, in the case of creating website interface to run the application, do we need API to communicate? And if so, how the API could be made to communicate between all machine in the network?
Moreover in the case of storing sensitive data like password, since its stored locally in every machine, does it means we will rely only on encryption being used? I assume common AES256 will work? Or need multi layer encryption (as in XMR) to make it harder for people trying to decrypt those sensitive information?
Any input is greatly appreciated. Thank you in advance!
I'll answer your questions for Hyperledger Fabric since that's what you tagged this post for.
Presumably the "script" you mean is chaincode, the blockchain back-end part of the decentralized application. It runs on endorsers (part of Fabric peers), specifically all endorsers that are specified in the endorsement policy and have installed the chaincode. The endorsement policy specifies how many endorsers need to agree for chaincode transactions to go through, i.e. 3/5. These peers can be hosted by multiple organizations in different places, that's why it's decentralized.
You need to use the Hyperledger Fabric SDK to communicate with your chaincode (get data, send transactions).
Decentralized apps don't really use user-password combo for identity management. Users have public/private keypairs which they need to keep locally. Only if you want to encrypt the private key you'd need a password for the user to decrypt it locally. You use the private key to sign transactions and to authenticate with the network (which determines your access rights, i.e. user vs admin)
I can recommend the Fabric paper as a learning resource
Also check out the docs, they cover many of your questions
I would recommend first taking a step back and finding out what are the best use cases for Web3 vs Web2. There are a number of projects that seem to have been shoehorned into using Web3 when they could have been created more quickly and efficiently using
Web2 technologies.
Ask yourself these questions before jumping on board the decentralized Web3 bandwagon:
Is an Immutable Ledger the Best Fit for Your Back-end?
Does Your Back-end Work Best as Decentralized Computing?
Do You Need Scalability or High Transaction Volumes?
Only when you understand the problem you are trying to solve, can you determine the best technologies for the job.
To help answer the above questions, you can use the following article as a resource: https://www.scalablepath.com/back-end/choosing-web3-for-software-project
I am currently working on a project in Hyperledger, where I want to upload files like pdf and docs into hyperledger blockchain by distributing the document file across the node of the network, and retrieving the document file back. Please help me with how I can do and how should I approves. If it cannot be achieved in Hyperledger then please let me know by which blockchain it can be achieved. Thanks in advance.
As a general rule, blockchain technologies are not suitable to store large documents. Blockchain demands too much process and storage replication. Moreover, there are some more pitfalls, such as block size and confidentiality.
One common approach is storing the files in a distributed P2P storage system such as IPFS (https://ipfs.io/) and store the file's hash (hashes are used as file references in IPFS, so that integrity is assured) in the blockchain's state.
You may need also IPFS-Cluster (https://cluster.ipfs.io/) to ensure persistence and replication.
Encryption is not supported by IPFS, so, if needed, it should be applied end to end outside IPFS, encrypting before storing and decrypting after accessing.
From your comment it sounds like you are thinking of using Hyperledger Fabric. With Fabric you should be able to write chaincode and a client that stores files. It still might not be the best approach and you should think carefully about separating storage of large files from the blockchain consensus based chaincode, especially when storing a hash of the file on-chain would suffice. Each node will need to store the file and come to consensus that all nodes stored the same file (have the same state). This is expensive in terms of compute and network i/o.
With Fabric, you should be able to do just about anything in code, as long as it is deterministic and not a long-running process. In my experience, minimizing code and state on any blockchain is best practice.
A complete example of a Hyperledger Fabric implementation is here: https://fabric-chaintool.readthedocs.io/en/latest/getting-started/
I agree with Kekomal, don't put large files in a blockchain, as it bloats it. Rather store binary/large files offchain. One option in Hyperledger Fabric(HLF) are private data collections where you can store binary files in CouchDB as base64 text, and just store the checksum/hash onchain, but that would increase storage requirements - based on base64.guru a 20KB pdf in base64 text will be 26KB - probably significant with very large binary files, as well as improper use of a document db. Private data collections are nice as HLF let's you share files with various options
I have been researching online a lot, and I have hit a roadblock.
My current situation is that I have a hash inside my blockchain, and this would reference a file that will return this from off chain. My question is that would using IPFS and Storj even be possible using Hyperledger Composer? If so, how would the integration process work? My case right now would require the use of Hyperledger due to its architecture over Ethereum, so it is much preferable to use Hyperledger.
Besides this, I would also like to create a custom front end. Is it possible to work on custom CSS and code, for example, using Angular?
yes - firstly see storage options discussed in this thread -> Best practice to save files in blockchain -
In Composer you could store the hash as a string on an asset in your model etc etc and you can retrieve via IPFS client search etc once you've got your asset (eg by name or ID) etc .- lastly see this announce for current status of Composer FYI
I'm using Hyperledger Composer and Hyperledger Fabric to implement a blockchain application. Here, there is a requirement to publish images of a certain asset in the network. According to my knowledge, it's not a good practice to use images in a blockchain network. Any suggestions to achieve this requirement?
It depends on the further application of the your chained data.
Maybe instead of images you can put inside SHA-2/SHA256 of these images.
If you don't store them on the blockchain, you're back to a centralized solution. Depending on your needs, that might be acceptable, or not. If you need to store it on the blockchain, you might use the url:data format, which lets you store them as strings, but any modern browser would be able to display them without additional code.
I'm currently trying to figure out on couple of things
1) What blockchain databases can be integrated with hyperledger fabric – (such as IPDB, or Bigchain db or couchDb)
2) What distributed file systems can be integrated with hyperledger fabric (such as IPFS, StorJ, Swarm).
can someone add your views, if there is anything better please share.
There are no such limitations, many people use integration patterns with various other technologies, for example:
Clients can write data to a distributed file system or database and then put a link and/or hash of the data on the Fabric blockchain as permanent evidence of the data.
Clients can listen for block events on a Fabric peer, and as blocks are committed to Fabric, write the data to another distributed file system or database.
The possibilities are endless.