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,740 points
3,533 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
• 69,220 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
• 69,220 points
1,885 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
• 69,220 points
1,134 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
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
• 69,220 points
2,125 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
• 69,220 points
2,418 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP