Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give ways to retrieve full datums associated to datum hashes #21

Closed
2 tasks
KtorZ opened this issue May 17, 2022 · 3 comments · Fixed by #42
Closed
2 tasks

Give ways to retrieve full datums associated to datum hashes #21

KtorZ opened this issue May 17, 2022 · 3 comments · Fixed by #42
Labels
enhancement New feature or request
Projects

Comments

@KtorZ
Copy link
Member

KtorZ commented May 17, 2022

Describe your idea, in simple words.

Kupo should give ways for application to retrieve datum associated with specific datum hashes. This could be achieved in two ways; either:

  • By storing datums found in transactions while syncing the chain; and then by providing an API entrypoint to inspect those datums.
  • Or, by resolving datum hashes on-demand using the chain-sync protocol from the chain-provider.

The trade-off between the two approaches is mainly about when the cost is paid. With the former, we pay the cost for every transaction of every block, since we'd now need the consumer process to also look for and store datums. This is possibly a minor cost addition though and need to be checked.

In the latter however, the cost only occurs when requests are made to resolve a specific datum hash, and would likely be a matter of a few milliseconds per datum hash. In principle, this also sounds fine because, resolving datums would likely only happen for submitting transactions which is ultimately capped anyway by the L1 throughput.

Why is it a good idea?

It seems to be a crucial but still missing pieces for making kupo a truly useful chain-index for DApps developers. Rightfully so.

Are you willing to work on it yourself?

Yes.

@KtorZ KtorZ added the enhancement New feature or request label May 17, 2022
@KtorZ KtorZ added this to To do in v2.0.0 via automation May 17, 2022
@waalge
Copy link

waalge commented May 19, 2022

🤔 I thought I'd left a comment here before...Anyway.

Just to point at https://github.com/waalge/kupo/tree/waalge/add-datums as a stop gap attempt while this is in the works.

@nielstron
Copy link
Contributor

nielstron commented Jul 13, 2022

Just to give some perspective on my use case:
I am usually querying the UTxO set of an address. If that address is a contract, I then separately query the datums of each encountered datum hash.

I am more than happy to just continue using that setup, namely that would just mean I would want to use an endpoint /v1/script_datum/{datum_hash}that returns the datum corresponding to that hash, if available.

It would also be handy to have the datum directly in v1/matches but I suggest resolving datums be optionally turned on via a flag like ?resolve_datum_hash or the likes and not having them stored permanently nor resolved in every query.

@KtorZ
Copy link
Member Author

KtorZ commented Jul 13, 2022

@nielstron what you're describing is exactly how I started (and planned finishing) to implementing this. Namely, store the datums separately and give ways to query them by hashes, but allows a "deep fetch" of the matches results through a query flag to also resolve datum hashes.

@KtorZ KtorZ moved this from To do to In progress in v2.0.0 Jul 13, 2022
@KtorZ KtorZ closed this as completed in #42 Jul 16, 2022
v2.0.0 automation moved this from In progress to Done Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants