leather-io / extension

Leather browser extension
https://leather.io
MIT License
293 stars 140 forks source link

Improve handling when hitting API "Too many history entries" limit #4248

Closed 314159265359879 closed 1 month ago

314159265359879 commented 11 months ago

A user is experiencing this issue where no balance is shown in the wallet for bitcoin: image Other assets such as STX, Stacks NFT's are displayed normally.

bc1qpyjutel6d4gj50dscphjrqcp29ljtfjel7ccap does have balance as seen on mempool.space explorer image

I have seen this issue before and often it is due to local restrictions, firewall, vpn etc. this time it looks like there is a different cause.

Console displays a error 400 for the blockstream API image

The API checked manually shows this https://blockstream.info/api/address/bc1qpyjutel6d4gj50dscphjrqcp29ljtfjel7ccap/utxo image "Too many history entries"

I think we need better error handling for this. Preferably also a way to display the balance anyway.

kyranjamie commented 11 months ago

Needs design input for how we visually display the error cc/ @mica000 @fabric-8

314159265359879 commented 7 months ago

Another wallet affected by this issue, 16,725 transactions bc1qwafz80ygxpurl9fqmldp4x2z7z5g2p3ned68lf

https://mempool.space/address/bc1qwafz80ygxpurl9fqmldp4x2z7z5g2p3ned68lf

https://blockstream.info/api/address/bc1qwafz80ygxpurl9fqmldp4x2z7z5g2p3ned68lf/utxo image

Will we work around this issue in the future. Would it require running a local node /API server for example?

fabric-8 commented 7 months ago

Would be great to discuss constraints & possibilities here to better understand what's feasible from a design perspective cc @markmhendrickson

314159265359879 commented 6 months ago

I noticed this issue is similar: https://github.com/leather-wallet/extension/issues/3631#issuecomment-1941071023 Mark suggested a possible solution there.

another wallet affected by this today: image https://blockstream.info/api/address/bc1qke8cq9kkvpwvm74rrvd7lhxl3d0faw4qau8lzn/utxo

markmhendrickson commented 6 months ago

Can we use blockchain.info as a backup e.g. https://blockchain.info/balance?active=bc1qke8cq9kkvpwvm74rrvd7lhxl3d0faw4qau8lzn ?

kyranjamie commented 6 months ago

This might help us display the balance, but nothing else would work, sending txs, showing transactions etc

kyranjamie commented 6 months ago

Even with a node, getting all the utxos of a given address isn't supported well.

Solutions like Quicknode also don't have a the full suite of RPC commands, and misses the ones we'd need e.g. listunspent. It does however have a paid add-on that supports querying utxos, Blockbook.

If we take this approach, we'll need to investigate the rate limiting tooling they also offer, to avoid abuse of our key that would always be public.

314159265359879 commented 5 months ago

Another case like this https://blockstream.info/api/address/bc1qc4a54g4y7pyq5mcqys8xp4k4k7rkumv9zyt980/utxo image

https://blockstream.info/api/address/bc1qc4a54g4y7pyq5mcqys8xp4k4k7rkumv9zyt980 image

314159265359879 commented 5 months ago

If we switch to BIS, would that resolve this issue?

Another address affected (for mocking/retesting): https://mempool.space/address/bc1qvvlpmskgaq0uulja7nj0wu7m6sk46vearwxwyf

markmhendrickson commented 5 months ago

If we switch to BIS, would that resolve this issue?

This is unrelated to BIS since it involves Blockstream, not Hiro or Ordinals APIs generally

314159265359879 commented 3 months ago

@markmhendrickson do you have an estimate when a fix for this could be live?

markmhendrickson commented 3 months ago

Not yet, since it hasn't been prioritized

brandonmarshall-tm commented 3 months ago

Another report from one of our partners telegram-cloud-photo-size-5-6231204167708426214-y

markmhendrickson commented 3 months ago

I'm moving to our dev backlog and assigning @alter-eggo to investigate solutions, presumably by implementing an alternative to Blockstream for the relevant query/ies

markmhendrickson commented 1 month ago

The build on https://github.com/leather-io/extension/pull/5690 resolves this issue for me.

kyranjamie commented 1 month ago

@markmhendrickson which wallet/address are you using that triggers this error?

markmhendrickson commented 1 month ago

https://github.com/leather-io/extension/issues/3631#issuecomment-2258312130

kyranjamie commented 1 month ago

Ah fantastic, I see it's fixed since using paid Mempool space plan.