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

# XP

> A double-entry loyalty ledger: rules turn events into awards, tiers rank members, balances settle on-chain

XP is 4D's loyalty currency. It's run like money, not like a score: every XP
movement is a balanced double-entry ledger transaction in whole integer
units, append-only, with a full audit trail - and member balances settle to
an on-chain token.

## How members earn XP

XP accrual is **rules, not code**. Your organization defines XP rules - data,
managed from the console - and the accrual engine evaluates them against
every incoming [event](/concepts/events):

* a rule matches an event type (e.g. an `engagement.*` or `commerce.*`
  event) plus optional conditions on its fields;
* its award is a fixed amount or a formula over event fields, optionally
  with a per-event cap;
* when several rules match one event, the awards are summed and the most
  restrictive cap applies;
* rules are versioned with effective time windows - a rule change never
  rewrites history, it supersedes from a point in time.

Accrual is exactly-once: duplicate event deliveries are detected and become
no-ops, so a member can't be double-awarded for one action.

## Where XP comes from

Every award is a transfer *from* somewhere - that's the double-entry part.
Organizations fund awards from their **engagement reserve**, or from a
**sponsor campaign**: a budgeted pool a sponsor funds, drawn down as its
rules award XP, reported against its budget. Admins can also make direct
**grants** to a member, with a recorded reason.

## Tiers

Tiers rank members by *qualifying* XP - what they've earned, separate from
what they've spent. Your organization defines ordered thresholds
(Bronze/Silver/Gold-style) with attached benefits, computed on lifetime
qualifying XP by default or on a rolling 365-day window if configured. A
member's spendable balance going down (redemption) doesn't demote them.

## Redemption

Members spend XP on rewards from your organization's catalog. A redemption
burns the spent XP - ledger-first, then settled on-chain - so total supply
always reconciles.

## On-chain settlement

Member balances are backed by an XP token on LightLink (an Ethereum L2;
nonprod uses the Pegasus testnet). Awards mint to the member's
platform-custodied wallet, redemptions burn, and the platform continuously
reconciles ledger totals against on-chain supply. As an integrator you don't
have to touch any of this - the REST API and ledger are the interface - but
the trail is publicly verifiable.
