Hyperledger Fabric: How to get transaction history using key?

0 votes
I have a key and now I want to extract all the transactions made that includes this particular key. I am not able to implement a method that could do this? Can someone tell me how to do this? Or rather share the code. Thanks
Nov 20, 2018 in Blockchain by digger
• 26,550 points
641 views

1 answer to this question.

0 votes
history, err := stub.GetHistoryForKey(key_value)
for history.HasNext() {
    modification, err := history.Next()
    if err != nil {
        fmt.Println(err.Error())
        return shim.Error(err.Error())
    }
    fmt.Println("Returning information about", string(modification.Value))
}
answered Nov 20, 2018 by Omkar
• 67,520 points

Related Questions In Blockchain

+1 vote
2 answers
0 votes
1 answer
0 votes
1 answer

Hyperledger Fabric: How to retrieve result from Fabric Transaction?

invokeChainCode(securityContext, functionName, args, options) { ...READ MORE

answered Nov 8, 2018 in Blockchain by Omkar
• 67,520 points
279 views
0 votes
1 answer

Hyperledger Fabric: How to ping network using program?

// http://nodejs.org/api.html#_child_processes var sys = require('sys') var exec = ...READ MORE

answered Nov 9, 2018 in Blockchain by Omkar
• 67,520 points
124 views
0 votes
1 answer
0 votes
1 answer

Hyperledger Fabric: How to create wallet using program?

You can do this by passing some ...READ MORE

answered Oct 31, 2018 in Blockchain by Omkar
• 67,520 points
428 views
0 votes
1 answer

Hyperledger Fabric: How to access transaction ID in invoke function?

You can access transaction ID in Invoke ...READ MORE

answered Nov 5, 2018 in Blockchain by Omkar
• 67,520 points
398 views