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

# Crash Economy

> Crash Economy — Dark Matter Protocol on Robinhood Chain.

# Crash — Money Model

"Dust Runner" is the flagship Entropy game. Its economy is simple to state and exact:
**RTP is exactly 96% for every cash-out target.** This page proves it and documents
every payment that enters or leaves the system.

## The crash formula

```js theme={null}
// server/crash-engine.js + serverless/crash.js — verbatim model
crash = round2( clamp( (1 − edge) / (1 − u), 1, 100 ) )
// edge = 0.04 (CRASH_EDGE_BPS = 400), u = uniform(0,1) from the committed seed
```

Deriving the RTP for an arbitrary cash-out at multiplier `m`:

```
P(crash ≥ m) = (1 − edge) / m = 0.96 / m
EV(cash out at m) = m × P(crash ≥ m) = m × 0.96/m = 0.96   □
```

The `(1 − edge)` numerator is what makes every target identical in expectation —
there is no "good" or "bad" cash-out point, only variance.

## Round clock

```
roundId = floor(t / 45s)
[0s, 20s)   betting window (fixed 20s)
[20s, 42s)  flight — ends at the round's crash point (variable length)
[42s, 45s)  results
```

Every server instance derives identical state from wall-clock time — no websockets,
no round coordination. The next round rolls over automatically; a crashed round
settles and moves on without rendering stale curves.

## Bet bounds

| Token | Min | Max | Decimals |
| - | - | - | - |
| ETH | 0.0001 | 0.02 | 18 |
| USDG | 0.5 | 100 | 6 |

```
CRASH_MIN_BET_ETH / CRASH_MAX_BET_ETH / CRASH_MIN_BET_USDG / CRASH_MAX_BET_USDG
```

Both currencies move real `CrashVault` custody, so bounds stay conservative out of
the box. DUST is deliberately **not** a bet currency — it is the non-transferable
activity score (see [Stardust](stardust.md)).

## The money flow, end to end

### 1. Deposit (custody)

Player deposits into `CrashVault` themselves (ETH via `depositEth()`, USDG via
`depositToken()`). The server sweeps `Deposited` events and credits the chip ledger
**minus the 1% deposit fee**:

```
player chips = custody − 1% fee
dev chips    = fee/2 (ceil)
VIP chips    = fee − dev     (EventHorizonPool address)
```

The vault always custodies 100% of assets; fee rows are ledger claims settled through
the same signature-gated withdrawal flow. See [The casino's own 1%](../reactor/waterfall.md#casino-fee).

### 2. Betting (ledger)

Bets debit chips at bet time; the round's stakes and payouts accrue per round row.
A bet cashes out at `m` → payout = `amount × m` credited instantly in-ledger.

### 3. Settlement (the bank)

When a round settles, realized edge is booked per token:

```sql theme={null}
crash_bank(token, stakes, payouts)   -- stakes − payouts = realized edge
```

Realized edge **can be negative** — when players outperform, the bank absorbs the
variance honestly. Long-run, the law of large numbers drives realized edge toward
the 4% house edge.

### 4. Edge routing (on-chain)

Accumulated realized edge is forwarded by the relayer:

```solidity theme={null}
CrashVault.routeEdge()   // splits 50/50:
                         //  → rewardsPool (EventHorizonPool weekly pots)
                         //  → lpTreasury (token LP bootstrap)
```

The 50/50 split is fixed in the contract; a zero sink keeps its share as protocol
revenue. This is the casino's engine feeding the VIP pots and LP treasury directly.

## Worked examples

**Example A — 0.01 ETH bet, cash out at 2.00×:**

* P(crash ≥ 2.00) = 0.96 / 2 = **48%**
* Win: 0.02 ETH back (+0.01 profit). Lose: bet.
* EV = 2 × 0.48 × 0.01 = **0.0096 ETH** → exactly 96% RTP.

**Example B — 0.01 ETH bet, cash out at 10.00×:**

* P(crash ≥ 10) = 0.096 → **9.6%**
* EV = 10 × 0.096 × 0.01 = **0.0096 ETH** — identical.

**Example C — a round's edge accounting:**
5 players stake 0.01 ETH each; three cash out at 1.5× (0.015 back), two bust.

```
stakes  = 0.05 ETH
payouts = 0.045 ETH
realized edge = 0.005 ETH  → 50% (0.0025) to VIP pots, 50% to LP treasury on routeEdge()
```

## Auth & session model

Stateless wallet signature — the client signs once per day:

```
DARK MATTER CRASH auth
vault:0x…
chain:46630
wallet:0x…
window:12345
```

The server recovers the signer and compares against the **current and previous 24h
window**, so one signature a day suffices with no mid-game re-sign nag at boundaries.
No sessions exist; every money-touching action carries the signature.

## Withdrawal

Player signs `(player, token, amount, nonce)`; relayer submits `CrashVault.withdraw`.
Gasless for the player, signature-enforced on-chain — the server cannot move player
funds. See [Two Vaults & Custody](../architecture/vaults-custody.md).

Next: [Crash — Provably Fair](crash-fairness.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.