> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atrum.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# Place a bet

> What a client does, end to end, to bet privately.

Every proof is generated **in the client**. No server ever sees your secrets.

```mermaid theme={null}
sequenceDiagram
  participant U as Your browser
  participant S as Sequencer
  participant P as ShieldedPool

  U->>U: generate nullifier + secret
  U->>P: deposit(commitment, amount)
  Note over U,P: amount must be on the ladder
  S->>P: flushBatch — your note enters the tree

  U->>S: GET /path?commitment=...
  S-->>U: path elements + indices
  Note over S: sequencer cannot prove for you<br/>and never sees your secrets

  U->>U: prove bet_encrypted (~2.3s, 11.8MB artifacts)
  U->>P: betEncrypted(proof, ciphertext)
  Note over U,P: declare the UNIFORM gas limit,<br/>never an estimate
```

<Steps>
  <Step title="Deposit">
    Call `deposit` with a commitment and an amount **on the denomination ladder** (powers of
    ten). Anything else reverts — an unusual amount would identify you, and would shrink the
    anonymity set for everyone else.

    Keep the note's nullifier and secret locally. They are the only way to spend it.
  </Step>

  <Step title="Wait for the graft">
    Your commitment sits in a queue until the sequencer inserts it. You cannot bet from a note
    that is not yet in the tree, because there is no Merkle path to prove membership with.
  </Step>

  <Step title="Fetch a Merkle path">
    Your client asks the sequencer for the sibling hashes between your leaf and the root. The
    sequencer can produce a path but **cannot produce a proof** — it never sees your secrets,
    and the path alone is useless without them.
  </Step>

  <Step title="Build the proof">
    Your client feeds the note, the path, and the encrypted stake into the proving circuit. The
    proof establishes two things at once: that you own an unspent note in the tree, and that
    the ciphertext you are publishing encrypts exactly that note's value — without revealing
    either.

    <Note>
      Proving is not instant. Measured in Node: around 2.3 seconds, with roughly 11.8 MB of
      circuit artifacts to fetch first. Cache them, and prove in a Web Worker or the UI will
      freeze.
    </Note>
  </Step>

  <Step title="Submit">
    Call `betEncrypted` with the proof, the public signals, and the ciphertext — declaring the
    **uniform gas limit**, never an estimate. An estimate leaks which action you took.
  </Step>
</Steps>

## After the market resolves

<Steps>
  <Step title="Redeem privately">
    Prove your position won and receive a **settled note**. No collateral moves and no amount
    is published — this is the step that breaks the link between position and payout.
  </Step>

  <Step title="Withdraw">
    Spend the settled note for public collateral, in a ladder amount, keeping the remainder as
    a private change note. Withdraw whenever you like; timing is part of your privacy.
  </Step>
</Steps>
