Skip to content

Value tracing ​

Deutsch

Trace follows recorded money, items and supported asset deals across characters, accounts and inventories. It helps staff investigate unexplained value and review recovery. A traced recipient may have received value in an ordinary sale: a connection or alert is not proof of an exploit or of guilt.

The screenshots use browser test fixtures. Validate transfers and recovery with your installed framework and resource versions on a test server before rollout.

Setup ​

  1. Follow Installation; oxmysql creates the tracing tables on start. Build the updated NUI.
  2. Open Resource settings → np_admin → Tracing. Review the defaults below, particularly duplicate-session handling.
  3. Grant np_admin.trace.view to investigators. Grant np_admin.trace.clawback separately to staff allowed to recover value. Recovery and alert acknowledgement require duty; preview alone changes nothing.
  4. Update the reporting resources and their vendored lib/np_admin.lua together. Make a small transfer, a cash/bank conversion and an item sale on your test server; inspect their holders, units and shared deal references in Flows.
Setting (Config.Tracing) Default Purpose
enabled true Enable recording
retentionDays 90 Raw flow history; expired rows become daily aggregates
reconcileSeconds 60 Online framework balance reconciliation interval
dupSession kick_new alert, kick_new or kick_both for duplicate character sessions
mintAlertPerHour cash 250000, bank 500000, black_money 250000 Per-unit hourly mint thresholds
itemMintAlertPerHour 500 Hourly item mint threshold

np_admin is optional for reporting resources. They vendor the lib rather than depend on @np_admin/... or declare np_admin as a dependency. While it is stopped, npAdmin.flow returns false; missing history is not replayed later. flowRef works locally and asset handlers register again after np_admin:ready.

Panel workflow ​

Flows Holder detail
Flow filters and recorded value moves Holder balances, recent moves and alerts
  • Flows: filter by holder, kind, unit, cause, resource and time. Open a holder for balances, 24-hour totals, recent flows and alerts. A deal reference connects related legs; item origins help inspect recorded lineage.
  • Investigate: select seed holders and a time window, money/items/all and units, a seed amount, attribution mode and hop limit. Run a case, inspect totals, the graph, holder balances and purchased items/assets. Reopen saved cases.
  • Alerts: review duplicate sessions, unattributed balance changes, mint spikes and negative balances; acknowledge after investigation. ESX event observation depends on the events your installed es_extended version emits.
  • Economy: daily minted, burned and moved totals per unit, top sources/sinks and per-resource totals.

Investigation with a graph and holder totals

Alerts Economy
Economy alerts with acknowledgement Daily economy totals by unit

Coverage and limits ​

  • char:<identifier> represents a framework character, not a server-wide licence. Personal np_banking accounts mirrored to framework bank money use that character holder; other ledger accounts use bank:<accountId>.
  • np_banking reports committed ledger moves and balances. Cash/bank conversions share a reference through world:bank. np_payments reports cash legs and passes bank attribution to np_banking, avoiding double reporting.
  • np_inventory reports core add/remove/move operations and private item lineage. Non-stacking item lineage survives metadata replacement and transfers; it is removed from public item views. Other resources must not report the same item move again. Other inventory providers do not automatically provide this item tracing coverage.
  • Reporting np_* resources add causes and counterparties where known. ESX money observation and periodic reconciliation can expose otherwise unreported changes, but cannot reconstruct their missing deal context. Delayed bank observations use live balance and correlation state for up to ten minutes. After a restart, outside that window or without a usable baseline, an observation can remain unknown; compare it against ledger history.
  • Supported business handlers include shops, fuel stations and vending machines. Farming co-ops expose owner lookup only. Generic vehicle, garage and housing ownership handlers are not implemented by this integration. Asset recovery needs the owning resource's actual registered revert or lock function; owner lookup alone is insufficient.
  • Internal holders such as bank:np_golf:escrow:... and bank:pending:... describe bookkeeping, not np_banking ledger accounts. Their balances may be unknown and they cannot be debited through bank clawback.
  • A run accepts 1–50 seeds, 1–10 hops (default 6) and up to 200,000 flow rows, plus up to 20,000 ref-linked purchase rows. A truncated case is incomplete. Older daily aggregates support economy statistics, not reconstruction of expired individual transfers.
  • taint_first attributes the tracked amount first; proportional uses recorded balance data and falls back to taint-first when it is missing. Seed choices (outflow, minted, fixed amount per seed) are investigation assumptions. NPC spending, consumption and other terminal world sinks stop the path; matching ref-linked conversion legs may pass value through. Balances, unknown holders, missing integrations and the selected window limit the conclusion.

Review and clawback ​

Clawback preview with selectable holders and supported assets

  1. Check the case against transaction history and the report. Separate value recovery from moderation: recipients, sellers and intermediaries can be innocent. Do not turn a graph connection into an automatic punishment.
  2. Open Clawback preview. Select holders, choose whether to include seeds and inspect current balances and takes. Never below zero caps the preview when a balance is known; an unknown balance is not a guarantee of recoverability.
  3. Select supported asset actions individually. Revert returns an asset to the recorded seller; lock depends on its handler. Available actions vary by resource. Review the current owner before confirming.
  4. Confirm with a reason, such as a case or ticket reference. The server checks permission and duty and rechecks balances. Character money, real np_banking accounts and supported np_inventory items use their respective adapters; offline money support depends on the framework, and offline character items may be unavailable.
  5. Inspect each result. Attempts are logged; successful takes write admin.clawback flows to world:clawback, ref case:<id>. Cases move from open to applying, then applied or partial. A partial case can retry unfinished actions; successful actions are skipped. A durable claim is written before each provider action. If its outcome cannot be confirmed after a database failure or restart, it requires manual review and is not retried automatically. Unsupported holders, stopped resources and changed owners can prevent recovery.

Integrating your own resource ​

Vendor the current lib as described in Integrating a resource. Report only after a value move succeeds:

lua
local ref = npAdmin.flowRef('trade')
-- After the payment and ownership change have succeeded:
npAdmin.flow({
  { kind = 'money', unit = 'cash', amount = price,
    from = buyer, to = seller, cause = 'my_res.sale', ref = ref },
  { kind = 'asset', unit = 'my_asset', amount = 1, id = assetId,
    from = seller, to = buyer, cause = 'my_res.sale', ref = ref },
})

Numeric holders are player server IDs resolved to characters when received. Use stable holder strings for offline characters, accounts and inventories. cause identifies the operation; ref groups its legs. Optional fields include origin, actor, small meta and post-move fromBalance / toBalance. Half-legs may omit one endpoint and provide world (without world:); unmatched legs become a world source/sink. Explicit counterparties and a shared ref give better evidence than heuristic pairing. Do not also report the same dispatcher or framework move.

Register npAdmin.assetHandler(unit, { label, owner, revert, lock }) only for assets your resource owns and actions it can perform. owner(id) returns a holder; revert(id, toHolder, ctx) and lock(id, locked, ctx) implement recovery. For np_payments callers, use trace = { cause, world, ref, to } in the payment context. Bank legs remain np_banking's responsibility; item legs remain np_inventory's. See Exports & events.