Is it possible to FetchByContractKey when using the gRPC Ledger API?

Hi all,

I’m looking through the Ledger API reference documentation, and I’m not seeing any functionality where I can query the ledger with a contract key.

Is this possible? Or do I really have to go through the Active Contracts Set and filter down until I get what I’m looking for?

Thanks in advance!

At the moment that’s not possible, you have to go via the active contract set. The JSON API supports this more efficiently or you could build up your own index client-side to make that more efficient.

1 Like

I hope this is reasonably high on the priority list. Imagine looking for one contract in tens of thousands, and having to filter through all of them to respond to a user request, and the JSON API is no use to you because it doesn’t support pagination, so you can’t respond when the user requests a list of objects without dumping all tens of thousands in to your application’s memory.

2 Likes

Update for posterity on this old thread. The capability to retrieve a contract by contract key was indeed introduced in the Ledger API. The documentation is available following the link below. Ledger API Reference — Daml SDK 2.7.6 documentation