Stop Bots and Scripts from Breaking Your Game Economy Before a Steam Launch
Launch week is when a game economy gets stress-tested by people writing scripts. If the client can mint coins, claim rewards twice or trade without limits, someone will automate it.
How economies get broken
A typical story, anonymized: an indie dev launches a game with a daily reward and a player-to-player market. Within days, a few accounts hold most of the currency. Nobody hacked the server. They wrote a script that called the reward endpoint in a loop, replayed the same "claim" request in parallel, and then moved the coins to a main account through trades. Each of these comes from the same root cause: the server accepted requests it never should have.
Valve's own Steam Inventory documentation puts the principle plainly: "the client can't be trusted (and the keys in a client can always be captured by an attacker)".
1. The server owns every number
- Currency, XP, loot and rewards are calculated and stored on your server. The client sends what happened ("finished level 4 in 182 seconds"), never what to award ("add 500 gold").
- Prices and reward amounts live in server config, not in client requests.
- Check plausibility: can level 4 really be finished in 9 seconds? Can a player earn 50,000 gold in an hour?
More on this in Never trust the client.
2. Know who is calling: validate Steam tickets on your server
Don't accept a SteamID that the client sends. Per Valve's User Authentication and Ownership docs, the client calls ISteamUser::GetAuthTicketForWebApi, waits for the GetTicketForWebApiResponse_t callback, and sends the ticket to your backend. Your backend calls ISteamUserAuth/AuthenticateUserTicket with the hex-encoded ticket, your App ID and the same identity string, and gets back the verified 64-bit SteamID. That call takes your publisher Web API key, so Valve says it "MUST be called from a secure server, and can never be used directly by clients". Create your own short-lived session token after that, and tie every economy action to that verified account.
For game servers and peer-to-peer sessions, the docs describe GetAuthSessionTicket plus BeginAuthSession. Steam checks that the ticket hasn't been reused and also verifies the player owns your App ID. See our Steam Web API key guide for server-side code.
3. Rate-limit every economy endpoint
Limit per verified account and per IP, and make limits match what a human can do.
// Example: token bucket per account using Redis (Node)
async function allow(accountId, action, perMinute) {
const key = `rl:${action}:${accountId}:${Math.floor(Date.now() / 60000)}`;
const n = await redis.incr(key);
if (n === 1) await redis.expire(key, 70);
return n <= perMinute;
}
app.post("/api/claim-daily", requireSession, async (req, res) => {
if (!(await allow(req.account.id, "claim", 5))) return res.status(429).end();
// ...
});
Add cooldowns in game terms too: a daily reward is checked against the last claim time stored on the server, not a timer in the client.
4. Make every reward and purchase idempotent
A common exploit is to fire the same "claim" or "sell" request 20 times at once so several succeed before the first one is recorded. Fix it in the database, not with an if check in code:
-- One claim per account per day, enforced by the database
create table daily_claims (
account_id bigint not null,
claim_date date not null,
primary key (account_id, claim_date)
);
-- In one transaction: insert the claim, then credit the reward.
-- A duplicate request fails on the primary key and credits nothing.
begin;
insert into daily_claims (account_id, claim_date) values ($1, current_date);
update wallets set gold = gold + 100 where account_id = $1;
commit;
For purchases and trades, have the client send a unique request ID (an idempotency key) and store it with a unique constraint, so a retried or replayed request returns the original result instead of running twice. Wrap balance changes in a transaction and use conditional updates such as update wallets set gold = gold - $2 where account_id = $1 and gold >= $2 so balances can't go negative under concurrency.
5. Lock down trading and markets
- Trade holds for new accounts: block or delay trading until an account has some playtime or age. This kills most farm-and-funnel schemes.
- Value limits: cap daily trade volume and flag one-sided trades (a rare item for nothing).
- Atomic swaps: both sides of a trade move in a single transaction, or neither does.
- Market price sanity: reject listings far outside the normal price range to stop laundering currency between alts.
- Steam Inventory items: if you use the Steam Inventory Service, each item definition has
tradableandmarketableflags, and playtime drops have settings likedrop_intervalanddrop_limit(see the item schema docs). Start conservative: you can open trading later, but it's hard to undo an inflated economy.
6. Watch for anomalies
Log every currency change with the account, amount, reason and timestamp, in an append-only ledger. Then check daily for:
- Accounts earning far more per hour played than the median player
- Many new accounts trading to the same receiver
- Requests at perfectly regular intervals, or around the clock with no breaks
- Rewards claimed faster than the game allows
Flag first, review, then act. Have a way to freeze an account's trades and roll back ledger entries before launch, not after.
7. Real-money purchases
If you sell items through Steam, Valve's microtransactions implementation guide has your server create and finalize transactions through the Steam Web API. Grant items only after your server finalizes the transaction, and record the order ID with a unique constraint so it can't be granted twice. The same rule applies to Stripe or any other provider: see server-side entitlements.
Pre-launch economy checklist
- Every currency change happens on the server and is written to a ledger.
- Every economy request is tied to a Steam-ticket-verified account.
- Rewards, trades and purchases are idempotent and transactional.
- Per-account rate limits and server-side cooldowns are in place.
- New accounts have trade restrictions.
- You can freeze trading and roll back balances.
Prompt to paste into your AI coding tool
Audit this game's economy code. Find every place currency, XP, items or rewards are
created, spent or traded. Make sure each change happens server-side, is tied to an
account verified via Steam ISteamUserAuth/AuthenticateUserTicket, runs in a database
transaction, is idempotent (unique constraint or idempotency key), is rate-limited
per account, and is written to an append-only ledger. Flag any amount, price or
cooldown that comes from the client.
Want this checked automatically?
BossCheck is a security scanner for indie games built with AI tools. It's in pre-launch: join the waitlist for early access.
Join the waitlist →FAQ
How do I stop bots from farming currency in my game?
Calculate all rewards on the server, tie every request to a verified account, rate-limit per account, enforce cooldowns server-side, and log every currency change so you can spot accounts earning far faster than normal players.
How do I verify a Steam player on my backend?
Have the client call GetAuthTicketForWebApi and send the ticket to your server, which validates it with ISteamUserAuth/AuthenticateUserTicket using your publisher Web API key and gets back the verified SteamID. Never trust a SteamID sent by the client.
What is idempotency and why does it matter for game rewards?
An idempotent request has the same effect whether it runs once or many times. Enforcing it with a database unique constraint stops players from claiming a reward or completing a sale multiple times by sending duplicate requests in parallel.
Should I allow trading at launch?
Consider starting with restrictions such as trade holds for new accounts and daily value limits. It is much easier to loosen trading rules later than to repair an inflated economy.
Can Steam Inventory items be granted from the game client safely?
Valve's docs note the client can't be trusted, so client-side grants are limited to things like configured playtime drops and promo items. Specific item grants should come from a trusted server.
More guides
- How to Keep Your Steam Web API Key Out of Your Game Build
- Firebase and Supabase Security Rules for Multiplayer Games
- Never Trust the Client: Stopping Cheaters in Vibe-Coded Multiplayer Games
- Security Checklist Before Shipping a Game Built with Cursor, Claude or Lovable
- Is Code from Cursor, Lovable or Claude Secure? What to Check Before You Ship
- How to Protect API Keys in a Unity Game
- How to Stop Players Editing Browser Game Saves to Unlock Paid Items
- Securing Godot 4 Multiplayer: RPCs, Authority and Server-Side Validation
- Is My Vibe-Coded Game Safe? A Free 10-Minute Security Self-Check