trezor / blockbook

:blue_book: Trezor address/account balance backend
https://trezor.io
GNU Affero General Public License v3.0
663 stars 650 forks source link

BTC Blockbook Issue #993

Closed ianlapinskii closed 9 months ago

ianlapinskii commented 11 months ago

We're currently experiencing troubles with Bitcoin Blockbook Instance.

It takes a lot of time for request to be processed, and sometimes it stops responding with Timeout error. The issue occurs only with /address endpoints and methods - specifically with those that have a lot of parameters and events.

For example, this method:

curl --request GET \
  --url https://btc1.trezor.io/api/v2/address/bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h

goes in timeout and the address (bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h) has many events and a lot of data.

Could you please take a look at our issue and let us know if you're going to work on it?

martinboehm commented 11 months ago

Please stop using our servers, you are not supposed to do that!

vdovhanych commented 11 months ago

The project is indeed open source, and you can run your own instances. Servers used by our project trezor-suite are not supposed to be used by other projects or parties, as mentioned on every blocbook instance we run.

Blockbook - blockchain indexer for Trezor Suite https://trezor.io/trezor-suite. Do not use for any other purpose.
wakiyamap commented 11 months ago

There is no problem if you use the server I set up as a hobby. However, I cannot take responsibility. https://mainnet-explorer.wakiyamap.dev/

ianlapinskii commented 11 months ago

i'm actually running it on my own instance. just wanted to let you know guys that the problem on my server is the same.

martinboehm commented 11 months ago

@ianlapinskii OK, now I understand, I am reopening the issue. You wrote it in such a way that you have a problem with our infrastructure.

martinboehm commented 11 months ago

I think I understand the issue. The address you mention has many thousands of mempool transactions.

image

Blockbook is fetching all of them from backend to be able to sum the nonconfirmed balance. For our use case this is not a problem as standard users do not have thousands of mempool transactions but for certain addresses (I would assume address of an exchange) it is fairly slow (tens of seconds) and can cause timeout in the network infrastructure.

If you are not interested in mempool transactions, you can disable their processing. Unfortunately, the address endpoint does not accept confirmed parameter (although it would be trivial to implement as the underlying methods do support it) but there is a workaround. If you specify to height (parameter to), it stops fetching mempool transactions. The to height can be much higher than current highest block, which will assure that you will always get all confirmed transactions.

Check how fast is https://btc1.trezor.io/address/bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h?to=100000000