GetUTxO should provide ability to pass address as a filter #797
Replies: 6 comments 2 replies
-
@matiwinnetou Seems like an interesting idea to explore, could you please tell us a bit more about the why? I could imagine a more general querying/filtering mechanism could be useful but we would like to better understand the need behind the want. Happy to have a chat together to refine my understanding. |
Beta Was this translation helpful? Give feedback.
-
We are trying to process 1 mln votes on Hydra, first we import votes and and then we process them. Not only we need to narrow it down by address by also paginate through it. There is no Hydra indexer or anything like this so we need ability to be able to query the hydra node in an effective way to construct transactions. Right now what we have is hardly scalable for anything of the magnitude we are working on. |
Beta Was this translation helpful? Give feedback.
-
Here is the picture of Hydra Voting's situation:
|
Beta Was this translation helpful? Give feedback.
-
We need filtering for both SnapshotConfirmed and filter requests to GetUTxO (e.g. pass address / pagination support / e.g retrieve only first 100 UTxOs).
We did a test and SnapshotConfirmed completely killed our application on larger data sets and on connecting back to the cluster it was close to insane. SnapshotConfirmed is needed for archival nodes but this is a bit esoteric use case, where there could be a special hydra client within a network which would be storing and indexing all snapshots. Even then on re-connect one needs to start from previous seq because otherwise archival node would reprocess all snapshots since beginning of the blockchain. This is not really necessary because of course this archival node already has this data. We could compare this for cardano-node to boot up and always start from the genesis block. I am aware there is a separate workstream regarding ditching partially history on re-connect. I am not sure exactly how you plan to implement this, if would also be done with some event query API to be honest, as an example:
|
Beta Was this translation helpful? Give feedback.
-
@matiwinnetou We discussed this issue within the team and came to the conclusion we need to propose a proper Query interface to the node to properly address your and possibly others' needs. As it stand the From a high-level architecture, the existing client API fulfils the Command Responsibility of the CQRS pattern, and also provides an Event stream exposing the changes in the internal state of the hydra node, but is not fit for querying. In general, this is inspired by how applications interact with the cardano-node, the latter exposing similar duplex asynchronous protocols and leaving the work of maintaining state to client applications or thirdparty tools (eg. indexers, db-sync...). We have started investigating what such a Query API would look like as there are a few options we can choose from: Should it be synchronous REST-like? Or should we propose a GraphQL API including both queries and subscriptions? What would be the extent of state exposed by this API? But designing and implementing this API could take some time as we would like to involve the small but active community of people involved in building stuff on Hydra. To address your concerns in the short-term, we would like to propose you the following plan:
|
Beta Was this translation helpful? Give feedback.
-
A solution outlined and also pursued in the past by some users of Hydra was to feed the transaction information to Ogmios/Kupo. @Quantumplation and his team had adapted Ogmios for that purpose and may consider open-sourcing their work (working title: HOgmios). I suppose a direct integration of feeding events into Kupo directly would also be possible. End result of this, would be means to aggregate and query UTxOs as indexed by kupo in a REST-like API, which may work with this big volume of UTxOs . |
Beta Was this translation helpful? Give feedback.
-
Why
When working with a large set of UTxOs / addresses responses from GetUTxO request can be substantial. In our case response is so large that it is clogging ability to issue further transactions.
What
Please provide ability to pass address as a filter, consider example:
should only return UTxOs which are matching this address.
How
While generating response for GetUTxO simply filter out any other address.
Beta Was this translation helpful? Give feedback.
All reactions