# Pack Purchase & Reveal

Pack opening has two parallel tracks: the collector-facing experience and the backend integrity/audit track.

```mermaid
sequenceDiagram
  participant Buyer
  participant Web as Numex Web App
  participant Privy as Privy Embedded Wallet
  participant Base as Base L2 (USDC)
  participant DB as Numex Database
  participant Reveal as Reveal Engine

  Buyer->>Web: Select pack
  Web->>Web: Check USDC balance
  alt Insufficient USDC
    Web->>Privy: Open funding modal (Apple Pay / card / exchange)
    Privy-->>Buyer: Fund wallet with USDC
  end
  Buyer->>Web: Click "Buy"
  Web->>Privy: Send USDC transfer via embedded wallet
  Privy->>Base: USDC transfer to platform wallet
  Base-->>Web: Transaction hash
  Web->>DB: Confirm purchase (verify tx on-chain)
  Web->>DB: Load eligible pack inventory
  Web->>Reveal: Select reveal outcome
  Reveal->>DB: Record opening audit payload
  DB-->>Web: Coin media + proof metadata
  Web-->>Buyer: Play pack video, transition, coin reveal
  DB->>Base: Queue mint/reconciliation
```

## Reveal Fairness

Pack reveal selection is verifiable through a commit-reveal protocol:

```mermaid
flowchart LR
  A["Pool commitment (Merkle root)"] --> B["Seed commitment"]
  B --> C["Buyer nonce at purchase"]
  C --> D["Deterministic index selection"]
  D --> E["Merkle inclusion proof"]
```

This is a **verifiable commitment**, not a zero-knowledge proof. See [Reveal Fairness](/numex-docs/technology/reveal-fairness.md) for the full protocol.

## Pack Availability

* Packs remain purchasable until all coins in the pool have been pulled.
* Pulled coins are marked as pulled and excluded from future reveals.
* Demo odds are not dynamically rewritten when coins are pulled. The stated pull probabilities remain as configured in the pack definition.

## Current State

* Purchases use USDC on Base via Privy embedded wallets.
* Users fund wallets with Apple Pay, card, or exchange transfer through Privy's native funding modal.
* Pack reveal shows the won coin and available product video media.
* Reveal fairness proofs are generated and verifiable (`npm run verify:reveal-proofs`).
* Payment verification uses on-chain tx hash confirmation.
* Bad-frame generated coin videos are gated from frontend rendering while remaining in the media pipeline for regeneration.

## Future Chain State

After canonical chain integration, each confirmed purchase/reveal should create an idempotent transaction queue item that mints or assigns the matching vaulted asset through the backend registry service.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://numex-greenfield.gitbook.io/numex-docs/user-flows/pack-purchase-and-reveal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
