I have setup a HyperLedger Fabric V1.0 network with 4 organisations each having 1 peer by following the steps Building Your First Network.
Now I have
- org1.example.com - with peer: peer0.org1.example.com and msp: Org1MSP
- org2.example.com - with peer: peer0.org2.example.com and msp: Org2MSP
- org3.example.com - with peer: peer0.org3.example.com and msp: Org3MSP
- org4.example.com - with peer: peer0.org4.example.com and msp: Org4MSP
And now I can install the chaincode to peers and instantiate the chaincode on the channel. I can also able to invoke and query chain code by using the commands mentioned here like
Invoke:
peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}'Query:
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
I was previously using Hyperledger Fabric V0.6 service provided by IBM Bluemix and my java applications were invoking the chain code through the Rest API.
How can I use the Rest API here in this local network setup using docker image?, then my java applications can interact with my chaincode.
Since I am not so familiar with this local network setup, please suggest me how can I make it work.
Note:
I am using Windows 7 machine and network is setup by running the commands in docker quick start terminal
Thanks in advance..
There is no REST API in Hyperledger Fabric v.1.0.0, however there is Java SDK which could be used to interact with peers. You can setup your java project with following maven dependencies:
Now you can use SDK APIs to invoke/query your chaincodes:
Get instance of HF client
Setup crypto materials for client
Now channel configuration:
Create transaction proposal:
Send proposal