How in-game crypto scripts work
Inside qb-crypto and FiveM mining resources: how the price engine works, how to tune volatility, and the client-trust exploits to design against.
FiveM 'crypto' resources such as qb-crypto are purely virtual. A server loop rolls a price every few minutes within a floor and ceiling, players trade with in-game bank money through a phone app, and mining scripts pay coins per tick from GPU items. The real risk is not crypto, it is client-supplied input reaching money functions unvalidated.
Nothing about GTA 6 modding has been announced. This chapter describes the current FiveM ecosystem on GTA V; the patterns outlive whichever framework replaces it.
Say it once: these scripts are entirely fictional. No chain, no wallet, no real value, nothing that leaves your database. That is what makes them legal under the rules for crypto on servers, and it is a line you must never blur.
What qb-crypto actually is
qb-crypto is the reference implementation for QBCore. Stripped to its parts it is four things:
- A wallet. QBCore’s money table has a third type alongside cash and bank. Each character also carries a wallet ID in metadata, which transfers are addressed to.
- An exchange. Buying and selling happen through the phone app at a fixed world location, converting bank money into coin at the current price and back.
- A price engine. A server loop recalculates the coin’s worth on a timer and appends to a history the phone draws as a chart.
- A redemption item. A
cryptostickheist reward, cashed in for coins at the exchange — how coin enters the world from gameplay rather than from bank balances.
Mining is not part of qb-crypto. Rigs, GPUs and power draw come from separate community resources that pay coins per tick into qb-crypto’s balance. Treat them as an independent faucet bolted onto someone else’s economy, and read designing a server economy first.
The price engine, and how to tune volatility
The price is not a market. No order books, no supply and demand — it is a bounded random walk, and your fake economy’s whole behaviour comes out of a few config values:
Crypto = {
Lower = 500, -- hard floor on the coin's worth
Upper = 5000, -- hard ceiling
Worth = { ['qbit'] = 1000 },
RefreshTimer = 10, -- minutes between recalculations
ChanceOfCrashOrLuck = 2, -- percent chance of a dramatic event
Crash = { 20, 80 }, -- min/max percentage drop on a crash
Luck = { 20, 45 }, -- min/max percentage gain on a lucky roll
ChanceOfDown = 30, -- roll at or below this: price falls
ChanceOfUp = 60, -- roll at or above this: price rises
CasualDown = { 1, 10 }, -- min/max casual percentage fall
CasualUp = { 1, 10 }, -- min/max casual percentage rise
}
Each tick the server rolls once. A crash or luck event fires rarely and moves the price hard; otherwise a casual move of a few per cent happens, or nothing. The result is clamped between Lower and Upper. Tuning advice:
- Keep the floor and ceiling. They are the only thing between a bad run of rolls and a coin worth nothing or worth everything. A player who bought at the ceiling and sold at the floor lost money that left your economy — fine, that is a sink. The reverse is what kills you.
- Lengthen
RefreshTimerif trading feels twitchy. Ten minutes means a session sees a handful of moves. Two turns your city into a day-trading simulator. - Watch the asymmetry. In the defaults, crashes go deeper (up to 80%) than lucky runs go high (up to 45%). Over a long run that is a net drain on player wealth — deliberate, and usually correct.
- Cap positions if you widen the bands. If one lucky roll can make a player the richest character in the city, your volatility is doing damage rather than telling stories.
There is also an optional ticker that pulls a real Bitcoin price from an external API purely to drive the displayed number. It is off by default, and it is a public price feed for flavour: no player asset is exposed to it, nothing is bought or sold, and any bridge you build between the two breaches the licence.
The exploits to design against
The interesting security problem has nothing to do with crypto. It is the standard FiveM one: the client is hostile, and any registered network event or callback can be invoked from a cheat menu with arbitrary arguments.
The FiveM server security documentation is blunt about this:
- Use
AddEventHandlerfor anything that need not cross the network.RegisterNetEventopens a door and authenticates nobody. - Retrieve values server-side rather than accepting them.
- Add distance checks. A player a mile from the exchange is not using the exchange.
- Track state on the server so an action cannot be replayed.
Read qb-crypto’s server callbacks against that list and the gaps are instructive rather than alarming. Balance checks are done properly on the server — you cannot spend coins you do not have. But the amount comes straight from the client, with no distance check against the exchange coordinates and no rate limiting.
That matters because of rounding. The buy path computes the price with math.floor(coins * worth) while crediting the raw coin amount. Feed it a small enough fraction and the floored price rounds to zero while the credited balance does not. That is not a crypto flaw; it is what happens when a number arrives from a player’s machine and reaches a money function unchecked.
Checklist — hardening any economy resource
- Every client-supplied number is validated: a number, positive, finite, in range
- Fractional amounts are rejected, or rounded in the server’s favour on both sides
- Distance to the relevant world location is checked server-side
- Per-player rate limits exist on anything that moves money
- No success or failure outcome is decided by the client
- Every money movement is logged with source, amount and reason
- Third-party resources are read before installing, not after an incident
Two tools help. GetInvokingResource() returns nil when a call crosses the network boundary, so it can reject invocations never meant to come from a player. And ox_lib’s server callbacks inject source as the handler’s first argument — the server’s own view of who is calling, and the only identity you should trust.
Mining scripts, specifically
Mining resources are the faucet half, and they break economies more often than the exchange does. Rigs run continuously — often while the player is away — and pay per tick based on installed GPUs. That is unbounded passive income, frequently shipped unbalanced. If you install one:
- Bound the payout. Cap coins per rig per real-world day, not per tick.
- Make it cost something recurring. Electricity, thermal paste, hardware degradation. A rig that only produces is a hole in your money supply.
- Require presence. Offline earning gives you a city of idle millionaires.
- Log it separately, so mining shows as its own line when circulation climbs.
The line, once more
A virtual coin with a wobbling price is a game mechanic: a speculation sink, a crime plot, a reason to lose everything on a Tuesday. It stops being that the moment real money can enter or leave. No wallet connections, no token, no selling coin for cash, no promoting a coin in your Discord — all four prohibited, with the licence text quoted in the rules for crypto on servers.
- qb-crypto is a wallet, exchange and price engine — no real chain, no real money, ever
- Volatility is four numbers: crash/luck chance, crash and luck ranges, and casual up/down ranges
- Hard floor and ceiling values stop a runaway price destroying your economy
- Never trust client-supplied amounts: validate type, sign, precision and range server-side
- Rounding with math.floor on a client-supplied fractional amount is a real exploit surface
Frequently asked
Does qb-crypto touch a real blockchain?
No. The coin is a row in your server's database and a number on a player's character. The optional ticker can read a real market price for flavour, but no real asset, wallet or transaction exists anywhere.
Can players cash a server coin out for real money?
No, and you must not build a route that lets them. Clause 3.1(1) of the Cfx.re licence bans cash-out mechanics and defines crypto as real money for that purpose, and clause 3.1(8) bans facilitating crypto use, sale or promotion.
What is the single most common exploit in these scripts?
Trusting the client. Amounts, wallet IDs and success or failure outcomes arrive from the player's machine, and any cheat menu can send whatever it likes. Every value must be re-derived or validated on the server.
- qb-crypto source and configuration · QBCore Framework
- Server security — securing your events · Cfx.re / FiveM Documentation
- ox_lib server callbacks · Overextended
- Creator Platform License Agreement, last updated 12 January 2026 · Cfx.re
Get recruited when GTA 6 private servers open.