QUACDocs

Tools

Block explorer

The QUAC explorer at quantcoin.world/explorer is a static web page. It has no backend or database and no build step. Your browser calls a QUAC node's REST API directly and renders the result.

Source: website/public/explorer/: index.html, explorer.css and explorer.js (about 450 lines).

What it shows

Page Route Data
Overview #/ Height, total supply, inflation, staked share, block signature size; latest 10 blocks and transactions. Refreshes every 4 seconds.
Block #/block/{height} Hash, time, proposer, transactions, and the ML-DSA-65 commit signatures (count and size)
Transaction #/tx/{hash} Status, fee, gas, memo, signer key type and signature size, messages (transfers rendered as from → amount → to)
Account #/account/{quac1…} Balance, signing key type, transactions sent, recent transactions in and out
Validators #/validators Name, voting power and share, commission, status, consensus key type

The search box accepts a block height, a 64-character transaction hash, or a quac1… address.

Choosing a network

const NETWORKS = {
  testnet: { key: "testnet", name: "Testnet", chainId: "quac-testnet-1", api: "https://testnet-api.quantcoin.world" },
  local:   { key: "local",   name: "Local devnet", chainId: "quac-devnet-1", api: "http://localhost:1317" },
};
  • ?network=local or ?network=testnet picks one explicitly.
  • Served from localhost, the explorer defaults to the local devnet. Anywhere else, it defaults to the testnet.

If the API can't be reached, the explorer says so and offers to switch networks.

How it works

Routing

Routes live in the URL fragment (#/tx/…), so the page is a single static file and every link can be shared. route() parses the fragment, picks a view, and renders into <div id="view">. Every render increments a sequence number, so a slow response for an old route can't overwrite a newer page.

Matching proposers to validators

Block headers name the proposer only by consensus address, 20 raw bytes. To show a validator name, the explorer loads the validator list once a minute and computes each validator's consensus address itself:

// CometBFT validator address = first 20 bytes of SHA-256(consensus pubkey).
const pk = v.consensus_pubkey?.key;
if (pk) byCons.set(bytesB64((await sha256(b64Bytes(pk))).slice(0, 20)), v);

sha256 is the browser's Web Crypto crypto.subtle.digest. The same rule applies to ML-DSA-65 consensus keys as to classical ones.

Transaction hashes inside blocks

A block carries transactions as raw bytes. The explorer computes each hash the same way the chain does, as the uppercase hex SHA-256 of the bytes, and links to the transaction page.

Amounts

Amounts are handled as BigInt throughout, so large balances never lose precision to floating point. fmtQuac converts uquac to QUAC with up to six decimals.

Post-quantum indicators

pqBadge(type) labels every key the explorer shows:

  • ML-DSA-65, in green, for /cosmos.crypto.mldsa65.PubKey.
  • No key yet for accounts that have only received funds.
  • The classical key type, in yellow with a warning, for anything else. On QUAC, such funds can never be spent.

Block pages report the commit: the number of validator signatures and the size of each (3,309 bytes).

Untrusted data

Memos, validator names and error logs come from the chain, so anyone can write them. Every such string goes through esc() before it reaches the page:

const esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) =>
  ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);

Route parameters (heights, hashes, addresses) are validated against strict patterns before they're used in API paths.

Running it locally

scripts/devnet.sh init && scripts/devnet.sh start          # terminal 1
python3 -m http.server 5180 --directory website/public    # terminal 2
# open http://localhost:5180/explorer/

The devnet script turns on the REST API and CORS that the explorer needs. See Running a node.

Edit this page on GitHub