Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Fetching a contract through the contract id on the ledger APIForum ↗

Fetching a contract through the contract id on the ledger API

App Development2 posts275 views4 likesLast activity Aug 2022
AR
Arne_GebertOP
Aug 2022

I would like to get the contract corresponding to a certain ContractId. What’s the recommended way to do so when using the gRPC Ledger API?

I saw that the JSON API exposes a fetch endpoint, but my application is directly using the Ledger API and I didn’t see a similar endpoint on the Ledger API.

AR
Arne_Gebert
Aug 2022

Answer: currently, the simplest way to achieve this through the Ledger API is to query the ACS and filter that for the correct contract.

Another, more efficient option, is to build up an index over the ACS in the application, to avoid having to query the complete ACS for a simple look-up every time.

← Back to Discussions