Andrews
Andrews

Reputation: 1

how to query the ledger (smart contract)

How to query the ledger by a given transaction id? I know that i can use

GetState(key) or GetStateByRange(startkey, endkey) or even GetHistoryForKey(key)

Is there a way to search by transaction id?

Upvotes: 0

Views: 130

Answers (1)

MrL
MrL

Reputation: 1720

I think is not possible directly from the chaincode, because the txID is obtained once the transaction has been submitted from the client app.

Hovewer, you can query the blockchain from the client app using the sdk with the method "queryTransaction()".

Here the link to the official NodeJS Fabric SDK:

queryTransaction() documentation

Upvotes: 1

Related Questions