clawchain/docs/plans/2026-05-31-explorer.md
caelum0x f0be8fbe3f docs(plans): final session status — P4 settlement complete + live-verified, explorer E4 PASS
- ai-model-tokens P4: MsgResolveInferenceDispute landed; full attestation->dispute->slash->
  resolve lifecycle complete, surfaced in clawd/web/SDK, and live-verified end-to-end.
- explorer: detail pages + overview dashboard + global search; E4 data live-verify PASS;
  tokenfactory tab sources denoms from bank supply (no chain query server).
2026-06-02 22:07:56 +03:00

156 lines
8.5 KiB
Markdown

# Block Explorer Plan (`claw-explorer`)
_Plan only — no code yet. Status: 2026-05-31. Owner: TBD._
## Implementation status (2026-06-01)
E1/E2 (minimal) and assets landed; deploy (E3) and live verify (E4) still pending.
### Update (2026-06-02): E2-richer custom-module tabs landed
Dedicated read-only explorer tabs were added for the ClawChain custom modules under
`claw-explorer/src/modules/[chain]/<module>/index.vue` (auto-routed via `~pages`, nav-listed
via each module name added to the `features[]` array in `chains/{testnet,mainnet,devnet}/clawchain.json`
+ `module.<name>` i18n labels in `en.json`):
- **modelregistry** ("AI Models") — models, inference jobs (incl. the P4 attestation/disputed
state), and inference providers.
- **oracle** — exchange rates, active denoms, params.
- **marketplace** — skills/listings + params.
- **agent** ("Agents") — live agents + params.
- **reputation** — params + per-agent lookup (score/uptime + endorsements) + top-agents.
- **privacy** — tree stats + merkle root + params + nullifier-spent lookup.
- **messaging**, **tokenfactory** ("Token Factory" — surfaces `factory/<issuer>/<sub>` denoms incl.
AI model tokens), and **clawgov** (the custom `x/governance` module) — round 3.
Each fetches the module's REST query endpoints (paths taken verbatim from each module's
`query.pb.gw.go`), with loading/empty/error states matching the `cosmwasm` page. Verified offline:
`vue-tsc --noEmit` 0 errors and `npm run build` (vite) green.
Also landed: detail pages (`modelregistry/[model_id]`, `modelregistry/job/[job_id]` with
attestation/dispute/resolve cards, `clawgov/[proposal_id]`, `marketplace/[skill_id]`), a
**"ClawChain Modules" overview dashboard** (`clawoverview`), and **global search** that jumps to
`model/job/skill/proposal <id>` detail pages.
### Update (2026-06-02): E4 data live-verify — PASS
`scripts/testnet/explorer-data-verify.sh` boots a single node, seeds the full lifecycle
(model → job → complete → attest → dispute → resolve + a minted tokenfactory denom), then asserts
every tab's REST endpoint returns valid JSON — incl. the headline job-detail showing
`attestation_hash` set + `disputed=true` + `resolved=true` on-chain — and that the explorer builds
and **serves an HTTP 200 SPA shell**. PASS. (DOM-render verification is out of scope — needs a
headless browser / `gstack`, not installed.)
It also surfaced a real gap: `x/tokenfactory` ships no query server (`/osmosis/tokenfactory/...`
→ 501), so the **Token Factory tab now lists factory denoms from bank supply**
(`/cosmos/bank/v1beta1/supply`, prefix `factory/`) — see
`docs/known-issues/tokenfactory-no-query-server.md`.
E3 (containerized deploy) plumbing already exists in the root `docker-compose.yml`
(`claw-explorer` on `:8082`, healthcheck, `make build-explorer`); a **public** deploy (E4 against
a real host) still needs the production RPC/REST endpoints + hosting (deferred, infra-dependent).
- **E1 — chain configs:** repaired/normalized `chains/testnet/clawchain.json`
(`chain_id: clawchain-testnet-1`, localhost endpoints kept for local dev, providers
relabelled "ClawChain (local dev)") and `chains/mainnet/clawchain.json`
(`chain_id: clawchain-1`, endpoints set to obvious `REPLACE_ME` placeholder hosts to
be swapped for the real public RPC/REST at launch). Both keep `addr_prefix: claw`,
`coin_type: 118`, CLAW asset (`base uclaw`, exp 6), `theme_color #6C5CE7`,
`logo /logos/clawchain.svg`, and `features`/`keplr_features`
(`cosmwasm`/`ibc-transfer`/`ibc-go`).
- **E1.2 — devnet:** added `chains/devnet/clawchain.json` (`network_type: devnet`,
`chain_id: clawchain-local`, localhost endpoints). NOTE: the dashboard loader
(`src/stores/useDashboard.ts`) only globs `chains/mainnet/*` and `chains/testnet/*`
(`NetworkType` has only `Mainnet`/`Testnet`), so this file is not auto-loaded yet — the
testnet config already covers the localhost/dev path. Wiring a real devnet network into
the dashboard glob/enum is deferred (out of minimal scope).
- **E2 — custom-module surfaces (minimal):** the fork already decodes arbitrary tx
messages generically. `TxsElement.vue` feeds `typeUrl`s to `useFormatter.messages()`,
which labels any type url by its last segment (so `/clawchain.privacy.v1.MsgShield` →
`Shield`), and the tx detail page renders every message's fields via the recursive
`DynamicComponent`. No special-casing was required for custom modules to render. As a
small low-risk polish, `useFormatter.messages()` now carries an optional
`customMsgLabels` map for the four headline custom msgs
(`/clawchain.privacy.v1.MsgShield`, `/clawchain.agent.v1.MsgRegisterAgent`,
`/clawchain.marketplace.v1.MsgListSkill`,
`/terra.oracle.v1beta1.MsgAggregateExchangeRateVote`) with the generic last-segment
fallback preserved for everything else.
- **Assets:** `public/logos/clawchain.svg` already existed (valid SVG) and is referenced
by all three configs; no change needed.
- **Verify:** all four `chains/*` JSON files pass `jq .`; `npm run build`
(`vue-tsc --noEmit` + `vite build`) passes (pre-existing chunk-size warnings only).
## What exists
`claw-explorer/` is a **Ping.pub fork** (Vue 3 + Vite). It already ships clawchain
chain configs:
- `claw-explorer/chains/testnet/clawchain.json`
- `claw-explorer/chains/mainnet/clawchain.json`
Both currently point at `localhost` (RPC `:26657`, REST `:1317`), prefix `claw`,
denom `uclaw`/`CLAW` (exp 6), SDK `0.53.6`, features `cosmwasm`/`ibc-transfer`/
`ibc-go`. There's a `Dockerfile` and a `dist/` build; deploy port is **8082** per the
validated Docker setup.
## Goal
A public block explorer per network (devnet/testnet/mainnet) showing blocks, txs,
validators, governance, IBC, CosmWasm contracts, and the custom modules — wired to
the real endpoints, branded, and deployed.
## Steps
### E1 — Chain configs (per network)
1. Update `chains/testnet/clawchain.json` and `chains/mainnet/clawchain.json` with the
**public** RPC/REST/gRPC endpoints (TLS), correct `chain_name`/`chain_id`
(`clawchain-testnet-1`, `clawchain-1`), seeds, and `min_tx_fee`.
2. Add a `chains/devnet/clawchain.json` (or keep localhost in testnet for dev) so the
devnet plan can point the explorer at a local node.
3. Assets/branding: add `public/logos/clawchain.svg`, set `theme_color`,
`coingecko_id` when listed.
4. Confirm `features`/`keplr_features` match the chain (cosmwasm, ibc-transfer,
ibc-go; add `tokenfactory` if the explorer supports a custom tab).
### E2 — Custom-module surfaces (fork work)
Ping.pub shows standard cosmos modules out of the box. The clawchain custom modules
(privacy, agent, marketplace, oracle, modelregistry, reputation, messaging,
governance) need either:
- minimal: rely on the generic tx/`Any` decoder so custom msgs at least render with
their `/clawchain.*` type url + fields (requires the explorer to resolve the type
urls — provide the proto JSON or a type-url→label map);
- richer (phased): dedicated tabs (e.g. oracle exchange rates, privacy tree stats,
marketplace skills) backed by the REST query endpoints.
Start minimal; add tabs as priorities dictate.
### E3 — Build & deploy
1. Per-network build (`npm run build` with the target network selected), or a runtime
network switcher (Ping.pub supports multiple chains in one deploy — list devnet/
testnet/mainnet clawchain entries).
2. Containerize via the existing `claw-explorer/Dockerfile`; serve on **:8082** behind
the same reverse proxy/TLS as the other public services.
3. Add to the root `docker-compose.yml` for each network profile.
### E4 — Verify
- Against a live node: blocks advance, a known tx (e.g. a tokenfactory create-denom or
a shield) resolves and renders, validator list + gov proposals show, IBC channels
page lists `channel-0`.
## Acceptance criteria
- Explorer reachable on `:8082`, pointed at the live (testnet then mainnet) endpoints.
- Standard cosmos data (blocks, txs, validators, gov, IBC) renders correctly.
- Custom-module txs at least decode/render via their type urls (E2 minimal).
- Branding (logo, theme, denom display CLAW/uclaw exp 6) correct.
## Open decisions
- Single multi-network deploy (Ping.pub switcher) vs one deploy per network.
- How far to go on custom-module tabs in v1 (recommend: ship minimal, iterate).
## Dependencies / references
- `claw-explorer/chains/{testnet,mainnet}/clawchain.json`, `claw-explorer/Dockerfile`
- Testnet/mainnet launch plans (endpoints come from there).
- Custom-module REST query paths (e.g. `/clawchain/privacy/v1/tree_stats`,
`/clawchain/oracle/v1beta1/...`).