diff --git a/dev/test-our-indexer.mjs b/dev/test-our-indexer.mjs new file mode 100644 index 0000000..f25518f --- /dev/null +++ b/dev/test-our-indexer.mjs @@ -0,0 +1,34 @@ +// Prove Theseus can resolve hello.bch through ONLY our VPS-hosted BNS indexer. +// Uses the directIP path (pinned IP + SNI) because this machine's system resolver +// mangles Node's getaddrinfo — same reason test-directip.mjs exists. +import WebSocket from "ws"; +import { resolveName, buildIndex, CHIPNET_ELECTRUM } from "../../Argus/src/lib/resolver-web.js"; + +const OURS = CHIPNET_ELECTRUM[0]; // freshly added — Silent Mode's own server +const PUBLIC = CHIPNET_ELECTRUM.find(s => s.url.includes("chipnet.bch.ninja")); +const NAME = "hello.bch"; + +console.log("Our seed[0]:", OURS); +console.log("Public reference:", PUBLIC.url, "\n"); + +console.log("1) resolving", NAME, "via OUR indexer (directIP → pinned ip + SNI) …"); +const mine = await resolveName(NAME, { + WebSocket, electrum: [OURS], directIP: true, +}); +console.log(" ", mine ? "records: " + Object.keys(mine.records).join(", ") : "NOT FOUND"); +console.log(" txid:", mine?.txid, "height:", mine?.height, "category:", mine?.category); + +console.log("\n2) resolving", NAME, "via a public server (directIP) …"); +const ref = await resolveName(NAME, { + WebSocket, electrum: [PUBLIC], directIP: true, +}); +console.log(" ", ref ? "records: " + Object.keys(ref.records).join(", ") : "NOT FOUND"); + +console.log("\n3) diff:"); +const ok = mine && ref && + JSON.stringify(mine.records) === JSON.stringify(ref.records) && + mine.category === ref.category && + mine.txid === ref.txid; +console.log(ok ? " ✅ IDENTICAL — Theseus resolves hello.bch via our server." + : " ❌ mismatch:\n mine=" + JSON.stringify(mine) + "\n ref =" + JSON.stringify(ref)); +process.exit(ok ? 0 : 1);