Customize oraclize-integration chaincode for taking another API data

Provable API for Hyperledger Fabric Chaincodes

  1. In Golang it is as simple as importing the oraclize/fabric-api that you'll find in this repository. This will provide your contract with functions like OraclizeQuery_sync(...), which make it trivial for you to leverage our oracle technology straight away.
  2. Simply install the Provable Connector chaincode on your peer.
  3. Create a folder that will contain your chaincode infabric-samples/chaincode, in this example fabric-samples/chaincode/user-chaincode/go.

GCP (Google Cloud Platform) for Hyperledger Fabric Chaincodes

Get Balance Function

func (s *SmartContract) getBalance(APIstub shim.ChaincodeStubInterface) sc.Response {

  fmt.Println("============= START : Calling the oraclize chaincode =============")
  var datasource = "URL"            
  
  // Setting the Oraclize datasource
  var query = "json(https://us-central1-chainlinkdemo.cloudfunctions.net/function-5)"
  
  // Setting the query
  result, proof := oraclizeapi.OraclizeQuery_sync(APIstub, datasource, query, oraclizeapi.TLSNOTARY)

  fmt.Printf("proof: %s", proof)
  fmt.Printf("\nresult: %s\n", result)
  fmt.Println("Do something with the result...")
  fmt.Println("============= END : Calling the oraclize chaincode =============")
  
  return shim.Success(result)
}