spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.35k stars 3.06k forks source link

Default fiat exchange rates provider not working stable with Tor #6547

Closed MrNaif2018 closed 2 years ago

MrNaif2018 commented 4 years ago

electrum -p socks5:localhost:9150 -v


...Some logs...
I | exchange_rate.CoinGecko | failed fx quotes: ClientResponseError(RequestInfo(url=URL('https://api.coingecko.com/api/v3/exchange_rates'), method='GET', headers=<CIMultiDictProxy('Host': 'api.coingecko.com', 'User-Agent': 'Electrum', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate')>, real_url=URL('https://api.coingecko.com/api/v3/exchange_rates')), (), status=403, message='Forbidden', headers=<CIMultiDictProxy('Date': 'Tue, 01 Sep 2020 19:37:31 GMT', 'Content-Type': 'text/html; charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'close', 'CF-Chl-Bypass': '1', 'Set-Cookie': '__cfduid=d7f8f587b85f41527501eaae0555ab1491598989051; expires=Thu, 01-Oct-20 19:37:31 GMT; path=/; domain=.coingecko.com; HttpOnly; SameSite=Lax', 'Cache-Control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Expires': 'Thu, 01 Jan 1970 00:00:01 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'cf-request-id': '04ecc5bcae0000be3c43b28200000001', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Vary': 'Accept-Encoding', 'Server': 'cloudflare', 'CF-RAY': '5cc172411ff3be3c-MXP', 'Content-Encoding': 'gzip', 'alt-svc': 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400')>)
...

When enabling tor proxy, in around 90 % cases default fiat rates provider - Coingecko - blocks request (because it is behind cloudflare). In very rare cases it works, but in most cases it don't. CoinDesk works for tor well. Is it possible to somehow contact coingecko (providing electrum use case), to make them allow tor? Or maybe when tor is enabled, default exchange provider could be changed to CoinDesk for example?

Edit: related but a bit different: #6407

SomberNight commented 3 years ago

The issue with CoinDesk as default is that they only provide historical exchange rates for USD and EUR. CoinGecko provides it for many currencies.

SomberNight commented 3 years ago

Ideally, the default FX provider should supply historical rates, support many currencies, and not ban Tor/VPNs. BitcoinAverage used to fit all these criteria in the past, but then they stopped (https://github.com/spesmilo/electrum/issues/5188).

amikot commented 3 years ago

I'm not using Tor/VPN and Fiat doesn't work for me anyway.

SomberNight commented 3 years ago

@amikot try with different providers (change it in settings). Also, is there anything in the debug logs?

SomberNight commented 3 years ago

note: text shown in the GUI is "No FX rate available"

SomberNight commented 2 years ago

There are multiple open issues about this, so I am closing this one. see https://github.com/spesmilo/electrum/issues/6738 and https://github.com/spesmilo/electrum/issues/6407