Skip to content

Economy

Jan Kluka edited this page Sep 10, 2026 · 3 revisions

Economy

The module that only exists because X-Prison publishes a cancellable event for every credit and debit before it is written. With Vault you get a ledger and rollback; with X-Prison you get the rest.

The checks, by their config id

What each section below is called in warden.yml, so a setting you are reading has a page you can find.

Config id What it is Needs
invariant-guard NaN, infinity, negative credits and absurd magnitudes refused at the boundary X-Prison
vanished-payout a payout that started positive and credited zero X-Prison
multiplier-mismatch a single payout multiplied past multiplier-ceiling X-Prison
income-per-block each block paying far more than the same block pays everyone else Vault or X-Prison
balance-velocity earning more in the window than almost anyone else on the server Vault or X-Prison
lifetime-spike earning more in one window than in their whole recorded history before it Vault or X-Prison
circular-payment money going round a ring of accounts and back to where it started X-Prison

The first two raise bug notices, not violations — see below — so they have one setting each, enabled, and it only decides whether you are told.

The invariant guard

Runs at the boundary, always on, and refuses what cannot be right:

Refused Why
NaN / infinity arithmetic that went wrong somewhere upstream
a negative amount on a credit path a credit that takes money away
an absurd magnitude (past 10^48) an overflow, not a payout
a runaway decimal scale clamped at the storage boundary

These are bug reports, never accusations. A NaN payout is a defect in the core or in an addon, so it reaches staff as a bug notice at full confidence and never touches anybody's violation level. Turning X-Warden on for the first time on an established server routinely finds bugs nobody knew about.

Multiplier auditing

The core has no canonical multiplier resolver, so X-Warden measures the chain rather than recomputing it — four checkpoints on the same event as it is multiplied:

Multiplier chain for Steve (tokens)
 - Base amount: 4200
 - After enchant rewards: 1.5
 - After skins, quality and multipliers: 18
 - Multipliers module reports: 6
 - Unexplained residual: 3
 - Total factor: 27
 - Credited: 113400

If a number nothing accounts for appears, you see which stage produced it. Attribution inside the high band is necessarily lumped, because skins and quality share an event priority — X-Warden says so rather than claiming a precision the platform does not offer.

The full audit is sampled, because it rides the busiest event in the plugin. /xwarden watch and /xwarden audit force full-rate measurement on one player.

Every currency is its own population

A player is compared against what other people earned of the same currency, never against a total. Summing tokens and money into one figure and ranking players by it is arithmetic on unrelated units — on a server where tokens outnumber money a thousand to one, it ranks players by which currency they happened to earn.

Violation levels follow the same rule. Somebody laundering tokens does not build a level against the money they earn honestly, and the money panel on a player report opens a currency-by-currency breakdown: level, in, out, net and transaction count for each, and each one opens on its own with its ledger, its findings and its level per check.

Payment rings are the exception — a payment edge carries no currency, so a ring is not attributable to one.

Anomaly checks

All of these stay dormant until min-samples is reached and log warming up N/M rather than guessing. That is the single biggest day-one false-positive guard.

  • Income per block — peer-relative, not against an oracle
  • Balance velocity — against a rolling server-wide percentile, never a fixed number, so nothing goes stale the moment somebody prestiges
  • Circular payments — A→B→A and longer rings, over the discrete ledger, run on a schedule
  • First-time-ever spike — a gain exceeding the player's entire prior lifetime earnings

The ledger, and what it costs

Mining pays out thousands of times a second, so storing every payout window would be roughly half a million rows a day at 200 miners. Three tiers instead:

Tier Where Holds
Minute resolution memory only the last memory-window-minutes (default 90)
Hourly summaries disk one row per player per currency per hour
Running totals disk one row per player per currency, updated in place

Individual transactions are always their own rows: they are the forensic record, they are what rollback reverses precisely, and they are low volume.

Rollback

/xwarden rollback Steve 30m            # prints the arithmetic, changes nothing
/xwarden rollback Steve 30m --apply    # commits it

Dry-run by default, and --apply is refused unless you previewed the same player and window in the last two minutes — so there is always a moment where a person can read the numbers and stop. Every apply is logged with who ran it.

It reverses the net balance change X-Warden recorded over that window. It does not undo items bought, enchants purchased, ranks gained, or anything another plugin did. Mining income inside the memory window is exact to the payout; beyond it, accurate to the hour.

Clone this wiki locally