Reputation: 11
I wanted to build an application using Hyperledger Fabric where user first register/login himself and after logging in one can view its profile(which basically display the data he entered while registering and all the transaction he did). I couldn't understand how to make the frontend part and connect Hyperledger with it.
The login could be done with the help of the article; Deep-Dive into FabCar: A Complete Application Example on Hyperledger Fabric. But how to connect it with frontend. 'yo' command can be used to build frontend but then, how can one modify it, so that it looks according to the need.
Upvotes: 1
Views: 1815
Reputation: 176
Connecting a front-end to your Hyperledger Fabric network is like connecting any front-end layer to the back end. In Hyperledger Fabric 1.4, the submitTranasaction - API is the last layer before interacting with the smart contract. So your front-end will have to take front-end inputs/arguments from the user, and pass them to submitTransaction, along with the associated smart contract function.
I have an example of doing so outlined here - note that the networkObj in this case contains the current channel, and the current smart contract we are running, and then we pass in the arguments to the contract.submitTransaction function.
Hopefully this helps. If you are still stuck, look at the code that I posted in the second link, and try and understand the server-side components. I've used Vue.js in my example, but you can use anything for your front-end framework.
Upvotes: 1
Reputation: 491
One on the best practice to make use of the Hyperledger Fabric Network is to create a web service to interact with the Fabric network and the front end will interact with the web service.
front-end <--> web service <--> Fabric network
For creating a web service there is already a boiler plate template to get you started in NestJs. the link to the code is. https://github.com/wearetheledger/hyperledger-typescript-boilerplate
For building the fabric network you can make use of an extension in VSCode called IBM Blockchain Platform.
Upvotes: 0