Skip to content

[GUI][DB] Allow Custom Explorers - #20

Open
Liquid369 wants to merge 7 commits into
PIVX-Project:masterfrom
Liquid369:2024_explorer_customization
Open

Liquid369 wants to merge 7 commits into
PIVX-Project:masterfrom
Liquid369:2024_explorer_customization

Conversation

@Liquid369

Copy link
Copy Markdown
Member

This pull requests adds to the GUI a dropdown menu for explorer selection and allows for custom URL's.

We have updated the two hardcoded ones with https://explorer.duddino.com and https://testnet.duddino.com starters and it should retry zkbitcoin if the main one fails.

I have set this up so that we can save these in the DB like the RPC Servers so a user can therefore not rely on single sources for their PET4L or Ledger.

Update Screenshot:
image

Rockdev instances are done for now.

@Liquid369
Liquid369 requested a review from Fuzzbawls July 8, 2024 23:43
@Liquid369
Liquid369 force-pushed the 2024_explorer_customization branch 4 times, most recently from 9b2d787 to 158474c Compare July 23, 2024 20:03
@Fuzzbawls Fuzzbawls added this to the 0.2.0 milestone Jul 24, 2024
@Fuzzbawls Fuzzbawls added the enhancement New feature or request label Jul 24, 2024
@Liquid369
Liquid369 force-pushed the 2024_explorer_customization branch from e6f2e30 to b8a7b54 Compare June 16, 2026 00:46
@Liquid369

Copy link
Copy Markdown
Member Author

This should be finally good sorry for slacking with it.

@Liquid369
Liquid369 force-pushed the 2024_explorer_customization branch from 159b973 to ef9e899 Compare October 7, 2026 03:23
Liquid369 and others added 7 commits October 7, 2026 10:30
Introduce an EXPLORER_SERVERS table with add/edit/remove/get helpers and
seed the default explorers: explorer.duddino.com, testnet.duddino.com and
zkbitcoin.com as a mainnet fallback. Defaults are seeded by URL so an upgrade
never collides with the ids of explorers a user added previously, and NULL
network metadata left behind by an older schema is backfilled.

Remember the selected explorer per network (keyed by URL) in the settings
cache so switching networks never remaps to an unrelated server.
BlockBookClient now resolves its URL from the active explorer selection.
When the primary explorer fails, the request is retried against the other
explorers configured for the active network (e.g. zkbitcoin) before the
error propagates. ApiClient exposes updateExplorerUrl() to switch the active
explorer at runtime.
Add an Explorer dropdown to the header, filtered to the active network, and
an 'Explorer Servers config...' dialog to add, edit and remove custom
explorers, mirroring the RPC servers UI. The selection is remembered per
network and applied to the API client, and the dropdown refreshes when the
RPC network changes.
Cover the explorer fallback retry, per-network selection persistence,
network filtering of the dropdown, and the database seeding and upgrade
migration. Ignore __pycache__ directories anywhere in the tree.
Explorer switching silently fell back to wrong or dead entries for three
independent reasons.

The client called Blockbook's v1 path. explorer.pivx.org answers that with
the web UI's HTML, which only surfaced later as a JSON decode error. Use v2,
and remap its field shapes: utxo amount arrives as 'value', balance as a
satoshi string.

EXPLORER_SERVERS had no UNIQUE constraint, so INSERT OR IGNORE appended a
new row on every add and trailing-slash variants became separate entries.
Older databases also carry a legacy 'is_custom' column, which SELECT * read
positionally as isTestnet, shifting every flag. Migrate on startup: carry
is_custom over, normalise URLs, merge flags before collapsing duplicates,
prune unshipped defaults while keeping user entries, then add the index.
Select columns by name from here on.

explorer.duddino.com and zkbitcoin.com sit behind a Cloudflare challenge
that answers every API request with 403. Mainnet default is now
explorer.pivx.org. A stale selection falls back to the network default,
never to whatever sorts first.

time.clock() was removed in Python 3.8; use perf_counter. timeThis now
logs the exception it used to swallow, which once hid a working RPC
server reporting itself as unreachable.
The previous commit dropped the duddino mainnet host as unreachable but
kept testnet.duddino.com as the testnet default. It fails the TLS
handshake under the app's own stack (requests, OpenSSL 3.6.3, SSLError),
so testnet users were left on a dead default. Use the testnet6 rusty-blox
instance, which answers /api/v2.

Tests now reference DEFAULT_TESTNET_EXPLORER instead of a literal, so they
track the constant rather than break whenever the default moves. Cost:
they no longer pin the URL itself; reachability was checked live, not in
the suite.
CI lint selects E306; a nested def needs a blank line after the import.
@Liquid369
Liquid369 force-pushed the 2024_explorer_customization branch from ef9e899 to c589033 Compare October 7, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants