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

GET /liquid/api/address/<address>/utxo returns "Too many history entries" without any possiblity of paging #282

Open
thomaseizinger opened this issue Dec 4, 2020 · 6 comments

Comments

@thomaseizinger
Copy link

thomaseizinger commented Dec 4, 2020

Here is an address I just grabbed of the UI where this happens: https://blockstream.info/liquid/api/address/QLFdUboUPJnUzvsXKu83hUtrQ1DuxyggRg/utxo

❯ curl https://blockstream.info/liquid/api/address/QLFdUboUPJnUzvsXKu83hUtrQ1DuxyggRg/utxo
Too many history entries%                                                                                                                                                                                                                                      
❯

Is there a way of how I can still access the UTXOs?

@shesek
Copy link
Collaborator

shesek commented Dec 4, 2020

I'm afraid that this accessing the UTXO set of "too popular" addresses is currently not possible. This might be revisited in the future.

The only thing you could do today is get the transaction history, which doesn't have a "too popular" limit, and figure out the current UTXO set based on that. One way to do that is with two passes over the transaction list, one to populate a set of (txid,vout,amount) for every funded output, and a second pass to remove the outputs spent by the inputs.

(If tx A spends tx B and they both confirm in the same block, its possible for the spending tx A to appear in the transaction history list before the parent tx B that creates the spent output. Doing two passes is a simple way to deal with this, though not the most efficient one.)

@thomaseizinger
Copy link
Author

What is the limit at which the UTXOs set is becoming inaccessible?

This particular address has 478865 transactions 😅. I don't think we'll be hitting this number anytime soon in our application but knowing where limit is would be nice!

@shesek
Copy link
Collaborator

shesek commented Dec 4, 2020

It's 500 by default, can be increased with --utxos-limit <N>.

@stevenking666

This comment has been minimized.

@php22032
Copy link

Can't support paging?

like:
GET /block/:hash/txs[/:start_index]

@shesek
Copy link
Collaborator

shesek commented Jul 26, 2021

Not easily I'm afraid, the way the utxo database is currently structured is incompatible with (efficient) paging and doesn't work well when the per-address utxo set is huge. Making this work would require some re-designing, which might be done some day, but is not currently prioritized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@shesek @thomaseizinger @stevenking666 @php22032 and others