# IUNUA Network Verification

This verifier is an evidence harness, not a deployment tool. It answers a narrow
question: which local contracts, configuration facts, and explicitly requested
read-only network responses were observed during one report-generation window?

It never deploys a program or contract, mints or transfers a token, creates a key,
wallet, or address, starts or stops a node, changes configuration, or contacts a
mainnet. The default commands make no outbound request and write no file.

## Evidence labels

- `VERIFIED` — the exact, narrow check described by that evidence item passed.
- `NOT RUN` — the check was intentionally not executed.
- `BLOCKED` — required evidence is missing, invalid, unsafe, or failed closed.
- `LOCKED` — policy forbids the action in this verifier.

`ok: true` means the verifier command completed, not that a network integration is
ready. `evidenceComplete: true` means only that every item selected by that command
is `VERIFIED`. Reports intentionally keep `integrationReady: false` and
`productionReady: false`. Mainnet always has verdict `LOCKED`.

## Prerequisite

Use Node.js 22.13 or newer and run commands from the repository root:

```bash
cd "/path/to/Iunua - Tokenomics"
node --version
```

No wallet runtime or node has to be running for the offline flow.

## Step-by-step: offline-first verification

### 1. Inspect the plan

```bash
node scripts/network-verification.mjs plan --target local
node scripts/network-verification.mjs plan --target testnet
node scripts/network-verification.mjs plan --target mainnet
```

`plan` validates the checked-in verification contract and describes intended
evidence. It performs no live probe.

### 2. Validate the local simulation sources

```bash
node scripts/network-verification.mjs status --target local
```

On this checked-in tree, the truthful baseline is four static items `VERIFIED`
and wallet loopback health `NOT RUN`. This validates only the demo fixture,
loopback OpenAPI boundary, two documented Game API routes plus no-key/no-CORS
statements, and the MCP loopback-plus-stdio boundary. It does not exercise the
wallet process.

### 3. Validate the testnet policies and local configuration

```bash
node scripts/network-verification.mjs status --target testnet
```

With no reviewed `config/network-lab.local.json`, the baseline is:

- `network-lab-policy` and `setup-policy`: `VERIFIED`
- World ID staging and World Chain Sepolia local configuration: `BLOCKED`
- Solana contained execution: `BLOCKED`
- Monero Stagenet runtime: `NOT RUN`
- Solana Devnet and World Chain Sepolia live reads: `NOT RUN`
- Render compute adapter and IUNUA testnet deployment: `BLOCKED`

Copying or editing configuration is deliberately outside this verifier. Use the
separate Setup Kit only after reviewing its own plan and acknowledgements.

### 4. Generate an offline report

```bash
node scripts/network-verification.mjs report --target local
node scripts/network-verification.mjs report --target testnet
```

The JSON report contains:

- a UTC `generatedAt` timestamp;
- SHA-256 hashes over the raw bytes of source files that were successfully inspected;
- a SHA-256 report digest over canonical JSON excluding the digest field itself;
- observation-window freshness semantics, an explicit non-atomic-snapshot warning,
  and the exact execution boundary.

Hashes make later byte changes detectable when the same inputs are compared. Files
are opened read-only without following symlinks, must be regular and singly linked,
are bounded before reading, and must retain the same descriptor metadata throughout
the read; text parsing rejects invalid UTF-8. The hashes
do not authenticate authorship, replace code review, or prove that a source file
was safe before or after `generatedAt`. A missing, oversized, invalid, or symlinked
evidence file fails closed.

### 5. Optionally check the local wallet health endpoint

Start the wallet separately only if you intend to test it, then explicitly allow
the single loopback GET:

```bash
npm run wallet:start
node scripts/network-verification.mjs report --target local --live-read-only --acknowledge-outbound-read-only
npm run wallet:stop
```

The verifier calls only `GET http://127.0.0.1:8787/v1/health`. It sends no bearer
token. A matching response proves only that the exact loopback endpoint returned
the expected simulated health fields during the report run ending at `generatedAt`.

### 6. Optionally perform the two public testnet reads

This is the only verifier command that makes public outbound requests:

```bash
node scripts/network-verification.mjs report --target testnet --live-read-only --acknowledge-outbound-read-only
```

It performs exactly two credential-free HTTPS JSON requests:

1. `POST https://api.devnet.solana.com` with JSON-RPC method `getHealth`, empty
   parameters, and numeric request ID `1`; expected result: `ok`.
2. `POST https://worldchain-sepolia.g.alchemy.com/public` with JSON-RPC method
   `eth_chainId`, empty parameters, and numeric request ID `1`; expected result:
   `0x12c1` (4801).

The implementation refuses redirects, non-JSON media types, responses over 64
KiB, responses taking longer than five seconds, changed URLs/methods/results,
credential-bearing URLs, and proxy-related environment or Node runtime settings.
It never accepts a user-provided endpoint. No account, wallet address, user ID,
authorization value, key, or credential is sent.

Privacy boundary: opting in reveals the source IP, timing, target, and the fixed
request method/body to the endpoint provider and relevant network infrastructure.
HTTPS protects content in transit from ordinary passive observers but does not
hide the request from the provider. Do not run the optional checks if that
disclosure is unacceptable.

These responses do not prove IUNUA deployment, balances, transactions, World ID
proof verification, endpoint production suitability, or integration readiness.
A successful read never clears unrelated `BLOCKED` evidence.

### 7. Keep mainnet locked

```bash
node scripts/network-verification.mjs mainnet
```

This command validates the policy lock, performs zero live checks, and always
returns verdict `LOCKED`. Mainnet cannot be unlocked with a flag. Seven independent
gates remain `BLOCKED` until separately reviewed evidence exists:

1. production custody, recovery, authorization, and separation of duties;
2. independent external protocol, cryptography, wallet, API, operations, and
   dependency security audit;
3. repeatable contained local and public-testnet evidence;
4. signed deployment and reconciliation evidence, including commit/build hashes,
   program/mint/contract addresses, authority inventory, supply/treasury limits,
   and cross-adapter reconciliation;
5. jurisdiction-specific legal, privacy, sanctions, consumer, tax, and operator
   compliance review;
6. documented governance, upgrades, emergency authority, monitoring, disclosure,
   and operator accountability;
7. tested rollback, pause, recovery, incident response, communications, and
   post-incident review.

This verifier only lists and enforces these locked gates. It does not accept or
validate external gate evidence. A future, separate independent review must
validate any supplied evidence before a production decision. The verifier never
performs deployment, custody, legal, governance, or operational work.

## npm shortcuts

```bash
npm run network:verify:plan
npm run network:verify:local
npm run network:verify:testnet
npm run network:verify:mainnet
npm run test:network-verification
```

The local and testnet npm shortcuts remain offline. Use the full explicit command
for acknowledged live reads so consent cannot be hidden inside a shortcut.

## Network roles used by the verifier

- [Solana clusters](https://solana.com/docs/references/clusters): Devnet is used
  for application development; Testnet is oriented toward validator stress; the
  public RPC endpoint is not a production service boundary.
- [Monero networks](https://docs.getmonero.org/infrastructure/networks/): Stagenet
  is the application-development lane. This verifier does not probe or start it.
- [World ID integration](https://docs.world.org/world-id/idkit/integrate): staging
  still requires backend proof verification and replay-safe nullifier handling.
- [World Chain networks](https://docs.world.org/world-chain/quick-start/info):
  Sepolia is chain ID 4801; mainnet is chain ID 480. Mainnet remains locked here.
- [Render compute participation](https://rendernetwork.com/participate-compute-clients):
  an onboarding reference is not a working IUNUA compute adapter.

## Troubleshooting

- `proxy-environment-blocked`: remove the proxy-mediated execution context only
  if your network policy permits a direct request; never bypass an organizational
  proxy requirement merely to obtain a green label.
- `invalid-contract`: the reviewed allowlist, proof limits, evidence policy, or
  gates changed. Review the diff; do not patch around the failure.
- a live evidence item is `BLOCKED`: read its narrow detail. The verifier already
  cancelled or aborted the bounded request and made no readiness claim.
- World ID or World Chain configuration is `BLOCKED`: use the Setup Kit guide to
  prepare and manually review local staging configuration. This verifier will not
  create it.
