// query callback representing the query of a chaincode

query callback representing the query of a chaincode
// query callback representing the query of a chaincode
func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {
	var A string 
	var err error
	if len(args) != 1 {
		return shim.Error("Incorrect number of arguments. Expecting name of the person to query")
	}
	A = args[0]
	Avalbytes, err := stub.GetState(A)
	if err != nil {
		jsonResp := "{\"Error\":\"Failed to get state for " + A + "\"}"
		return shim.Error(jsonResp)
	}
	if Avalbytes == nil {
		jsonResp := "{\"Error\":\"Nil amount for " + A + "\"}"
		return shim.Error(jsonResp)
	}
	jsonResp := "{\"Name\":\"" + A + "\",\"Hash\":\"" + string(Avalbytes) + "\"}"
	fmt.Printf("Query Response:%s\n", jsonResp)
	return shim.Success(Avalbytes)
}
func ( t * SimpleChaincode ) query ( stub shim . ChaincodeStubInterface , args [ ] string ) pb . Response { var A string var err error if len ( args ) != 1 { return shim . Error ( " " ) } A = args [ 0 ] Avalbytes , err := stub . GetState ( A ) if err != nil { jsonResp := " \" \" \" " + A + " \" " return shim . Error ( jsonResp ) } if Avalbytes == nil { jsonResp := " \" \" \" " + A + " \" " return shim . Error ( jsonResp ) } jsonResp := " \" \" \" " + A + " \" \" \" \" " + string ( Avalbytes ) + " \" " fmt . Printf ( " \n " , jsonResp ) return shim . Success ( Avalbytes ) }
query callback representing the query of a chaincode
query callback representing the query of a chaincode
// Entities
 // Get the state from the ledger
