From e6f2e4b99fb1a7f7baa670650944eee67ca90e72 Mon Sep 17 00:00:00 2001 From: Local Dev Date: Sun, 30 Aug 2026 15:57:01 +0200 Subject: [PATCH] Theseus 0.0.7: multi-source BNS with continuous delta refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first .bch page now opens with zero user-visible latency and stays fresh for as long as the browser runs. Four sources conspire in parallel — none of them can block a navigation: 1. Warm start from disk (sync) warmFromSnapshot loads the user-cache snapshot first, then falls back to the copy bundled with the build. sharedIndex is set BEFORE the first navigation can even fire. 2. Continuous background delta refresh (every 30 s) startBnsPolling opens one electrum connection, fetches the beacon history (a single call), and only pulls verbose tx bodies for txids we don't already have — mergeFreshHistory-style. Merges into memory, rebuilds the index locally, persists the enlarged snapshot to disk. Turns a ~60 s full walk into ~1 s per new event. 3. Sia snapshot pull on boot (one-shot, wins the NEXT boot) refreshSnapshotFromSia downloads the operator's published snapshot from s3.silentmode.st for the next launch. After a long idle period the browser resumes from that fresher snapshot instead of walking days of events. 4. ensureIndex full-walk fallback Still runs on boot for the case where there's no bundled snapshot AND the poll hasn't landed yet — very first launch, offline install, etc. resolveHost now prefers sharedIndex (which the poll keeps live) and, on a miss with a stale index, triggers pollAndMerge (delta fetch) instead of ensureIndex (full walk). The old full-walk fallback is only taken if the delta primitives aren't available (running against an older resolver-web). Argus/src/lib/resolver-web.js exports connectElectrum so the Theseus poll can drive its own ad-hoc queries against the pool without duplicating the Electrum wrapper. Bundled starter snapshot refreshed: 73 beacon txs, root c37b859682…54e414ba. Artifacts: dist-public/TheseusNavigator-Setup-0.0.7.exe (95.4 MB) sha256 1b0dabcd2b13067aa1fd89c3271708b35ba22dfc7a620e248b35e0487b7a104f dist-public/TheseusNavigator-0.0.7-portable.exe (92.7 MB) sha256 706dc01b21a88d3c2fbc3eeced0cab6ace873630bf3edc2d40915ca5be5c8cae --- src/lib/resolver-web.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/resolver-web.js b/src/lib/resolver-web.js index 008cef8..4660e0b 100644 --- a/src/lib/resolver-web.js +++ b/src/lib/resolver-web.js @@ -443,6 +443,14 @@ export async function resolveName(input, opts = {}) { return index.get(name) ?? null; } +// Open one electrum connection against the pool and return the raw client, so +// callers can do ad-hoc queries or drive a delta-refresh loop (fetch just the +// tx bodies they don't already have). Same connection strategy buildIndex uses +// — try hostname first, fall back to pinned-IP+SNI when directIP is on. +export async function connectElectrum({ electrum = CHIPNET_ELECTRUM, WebSocket: WS, directIP = false } = {}) { + return connectAny(electrum, WS, { directIP }); +} + // ---- on-chain electrum discovery (step 2) -------------------------------- // The name ELECTRUM_LIST_NAME carries the current server pool in an "el" record: // a space-separated list of tokens, each "wss://host:port" or "wss://host:port|ip"