stub.GetHistoryKeys()报告GetHistoryKeys()函数未定义。 当尝试去建立我的Chaincode

I am new to Hyperledger .I am using docker to run Hyperledger. Pulled hyperledger/fabric-peer:latest from Docker hub and able to run stub.CreateTable() ,stub.GetRows() , stub.InsertRows() and some other functions in my Chaincode. But when i tried to run

stub.GetHistoryKeys() or stub.GetCompositeKeys() ...etc in my chaincode It's reporting an error

 stub.GetHistoryForKey undefined (type shim.ChaincodeStubInterface has no field 
  or method GetHistoryForKey)

I found that in my interface.go file there are no such functions . Googled a lot but found nothing .Can anyone tell the correct hyperledger/fabric-peer image to pull so that the above functions can run in Chaincode.

At last I am able to figure it out to get the hyperledger images to support my chaincode.

Please download latest version of fabric image, ( hyperledger/fabric-peer x86_64-1.1.0 ). It can be downloaded from script mentioned on hyperledger official website (Install binary)=> (https://hyperledger-fabric.readthedocs.io/en/latest/install.html. Can't paste url due to stackover flow policy issue). Once you have it. Create a go code. Simply add one json record on one key add then try to add some change some field of json and again add to same key. Once you have done that, fire the below code for gethistory:=>

func (s *SmartContract) getAllTransactionForid(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { fmt.Println("getAllTransactionForNumber called") id:= args[0]

resultsIterator, err := APIstub.GetHistoryForKey(id)
if err != nil {
    return shim.Error(err.Error())
}
defer resultsIterator.Close()

// buffer is a JSON array containing historic values for the number
var buffer bytes.Buffer
buffer.WriteString("[")

bArrayMemberAlreadyWritten := false
for resultsIterator.HasNext() {
    response, err := resultsIterator.Next()
    if err != nil {
        return shim.Error(err.Error())
    }
    // Add a comma before array members, suppress it for the first array member
    if bArrayMemberAlreadyWritten == true {
        buffer.WriteString(",")
    }
    buffer.WriteString("{\"TxId\":")
    buffer.WriteString("\"")
    buffer.WriteString(response.TxId)
    buffer.WriteString("\"")

    buffer.WriteString(", \"Value\":")
    // if it was a delete operation on given key, then we need to set the
    //corresponding value null. Else, we will write the response.Value
    //as-is (as the Value itself a JSON marble)
    if response.IsDelete {
        buffer.WriteString("null")
    } else {
        buffer.WriteString(string(response.Value))
    }

    buffer.WriteString(", \"Timestamp\":")
    buffer.WriteString("\"")
    buffer.WriteString(time.Unix(response.Timestamp.Seconds, int64(response.Timestamp.Nanos)).String())
    buffer.WriteString("\"")

    buffer.WriteString(", \"IsDelete\":")
    buffer.WriteString("\"")
    buffer.WriteString(strconv.FormatBool(response.IsDelete))
    buffer.WriteString("\"")

    buffer.WriteString("}")
    bArrayMemberAlreadyWritten = true
}
if !bArrayMemberAlreadyWritten {
    buffer.WriteString("No record found")
}
buffer.WriteString("]")

fmt.Printf("- getAllTransactionForNumber returning:
%s
", buffer.String())

return shim.Success(buffer.Bytes())

}

If still in doubt, please revert. I will give you my whole source code to make it work. But I hope this will make your problem go away :-)