-
Notifications
You must be signed in to change notification settings - Fork 25
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
Improve UTxOs Retrieval in Koios #187
Comments
It's a bit tough one, and needs to be thought through very carefully.
|
This is a tough one and as Priyank mentioned has to be thought through carefully.
|
Few points:
for having utxos by all kind of credential types, BF follows CIP-0005 and uses prefixes and conversions between types (Maybe it can help). as long as we can have those that would work best both for Koios and for Lucid Users. Please also take into account the speed and amount of calls for a Library in order to achieve the best results. |
Like others it was supposed to be a list of utxos (but with input & outputs), the issue is with specs which reuses tx_info's output field, instead of having one for utxos, a
Agreed, can add it to the list
I addressed this specifically in my first reply. Unlike many other providers, Koios supports bulk queries - which means not only can you query all utxos for an address, but also all utxos across multiple addresses sent in bulk to fetch info against. So what you're looking at is perhaps 1 call for list of utxos (across multiple address or accounts or creds) and second call for all utxos involved. As against that you'd end up querying each utxo seperately. The performance impact is exactly why it makes sense to seperate the two - and why
agreed - the
If you're leveraging bulk query option, you'd likely be ending up with even lesser calls and better performance when compared (wallets for instance would seldom look at single address for inputs, they'd look at collection of addresses) 🙂 |
Will it be possible to add filters to the basic utxos endpoints by different fields? We don't need them to retrieve the fields themselves. We then can make another query to retrieve the entire model from the info endpoints. If it will be possible then I think it's good. If I'm not mistaken, currently we can't use horizontal filtering for POST endpoints hence it would be very much needed to save some iteration time at client side. |
You'd already be specifying asset/datum/script on the input to list UTxOs by - to then be able to query
You can surely do horizontal as well as verticle filtering for rows on POST endpoints as well, to only return rows (just not sub-array items, for which - if filtered you receive entire row of 1 tx , instead of multiple txs) that match the condition. For example to filter txs by specific address: curl -X GET "https://api.koios.rest/api/v0/account_utxos?_stake_address=stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy&address=eq.addr1qyh6fakqvqfsfs0w9qgchg2hrh77e927vr6wt5su
twnw5huz68jxz2uxdexn04evgeg44a9u7jyvsu7j8zyw9nm3gcgq8guve9&select=tx_hash,tx_index,address,value" -H "accept: application/json"
# [{"tx_hash":"7668b5d5dfad8dbb6160bb117d7cbcda8d04cd42575c32701236e62093cf710b","tx_index":14,"address":"addr1qyh6fakqvqfsfs0w9qgchg2hrh77e927vr6wt5sutwnw5huz68jxz2uxdexn04evgeg44a9u7jyvsu7j8zyw9nm3gcgq8guve9","value":"1518517"},
# {"tx_hash":"492d07303dff3feca78464b34231f4c5c3b3940bab201c3b05363f96af45a045","tx_index":20,"address":"addr1qyh6fakqvqfsfs0w9qgchg2hrh77e927vr6wt5sutwnw5huz68jxz2uxdexn04evgeg44a9u7jyvsu7j8zyw9nm3gcgq8guve9","value":"1679147"},
# {"tx_hash":"0e0731aa17c9373f6934d65222abc512a1f738894464a3526975987cea8e7697","tx_index":32,"address":"addr1qyh6fakqvqfsfs0w9qgchg2hrh77e927vr6wt5sutwnw5huz68jxz2uxdexn04evgeg44a9u7jyvsu7j8zyw9nm3gcgq8guve9","value":"1636209"}] |
Can be tracked via #186 [unfortunately, since it becomes a breaking change, will have to align with a wider breaking change upcoming with dbsync which will tremendously help current UTxOs retrieval as it should no longer require a join] |
In order for Koios to also be used in Lucid Library as another Provider, there are some gaps that should be closed:
UTxO Model
UTxO model should have all the relevant fields as follows:
it is also required to add the Bech32 Payment Address in the UTxO model as a field
Endpoints
Lucid's TypeScript model for Credential:
The text was updated successfully, but these errors were encountered: