问题
I created a network on hyperledger composer on one physical machine and create cards for admin and user I have some questions:
1) how can I access the same network using 2 different machines(laptops) ?
2) and if it possible to connect this network on hyperledger composer to Android app ?
I want to know if these possible or not and how can do that?
And I want to know if using hyperledger fabric will be best or go on hyperledger composer?
回答1:
It depends on what you mean with "access the network":
- If you mean sending queries to it, one possible solution could be to launch the composer REST server, open ports, and you should be good to go.
- If you mean accessing the composer backend, just opening ports should be enough.
To "connect" the network with an Android app I suppose you mean sending queries to it, so the REST server solution should work.
About the last question, it also depends on what are you using the tools for. If you are learning or doing fast PoCs, Composer is a good election (even when IBM said on october 2018 they wouldn't continue development), but for serious or production work i'd go directly with Fabric.
Update: composer-rest-server
You can use composer-rest-server
to connect to your composer network from different machines and send transactions to it. Just have to launch it in the machine you have composer running, like so:
composer-rest-server
By default it launches a web service on port 3000, so you can direct your browser to http://localhost:3000/explorer/
to interact with it from the same machine. To connect from a different machine, if you are in the same network, just point the other machine to the local IP of the composer machine, on port 3000. Let's say the composer machine has private IP 192.168.0.10, then you would have to point the browser of the other machine to http://192.168.0.10:3000/explorer/
. If you are in different networks you would need to open router ports, redirect them to the composer machine, and connect to its public IP instead of its private IP. More information about composer-rest-server: https://hyperledger.github.io/composer/v0.16/integrating/getting-started-rest-api
来源:https://stackoverflow.com/questions/55134229/can-connect-between-hyperledger-composer-and-android-app