-
Modify src/main/resources/application.properties file. Set gcloud.dir property to the directory where gcloud installed. Default value is /usr/bin/
The default value of working.dir property is "./blockchain/artifacts/". The service will use that directory to store templates and files generated by the service.
-
In project directory, run ./gradlew bootRun
-
The restful service endpoint is POST: localhost:9000/gbaas/fabric?create_instance=false&install_software=false$install_example_chaincode=true
The request body looks like below:
{ "domain": "sample-network", "gcpProjectName": "hyperledger-poc", "gcpZoneName": "us-east1-b", "ordererName": "orderer-google-boa", "channelName": "common", "properties": [ { "org": "google", "numOfPeers": 2 }, { "org": "boa", "numOfPeers": 2 } ] }
The domain property will be used for setting up the instance name, e.g orderer.sample-network.
-
If you choose to install the example chaincode, you can ssh to a peer, e.g. boa-peer0, the initiate chaincode with command like:
peer chaincode instantiate -o orderer.sample.com:7050 --tls --cafile /etc/hyperledger/crypto/orderer/tls/ca.crt -C common -n example -v 1.0 -c '{"Args":["init","a","100","b","200"]}'
then query from another peer:peer chaincode query -C common -n example -c '{"Args":["query","a"]}'
Make sure you cryptogen and configtx command are in ~/bin/
if you don't have those binaries, simply run curl -sSL https://goo.gl/6wtTN5 | bash
Make sure you set up JDK for Gradle
It's easier to use IDE to set up the project
Don't forget to run watch -n60 gcloud compute --project=hyperledger-poc firewall-rules create all --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=all --source-ranges=0.0.0.0/0