How to pay players token rewards on Solana without getting farmed
Sending a token to a player is the easy part. The hard part is knowing they earned it. Three facts decide every design: the page cannot be trusted, a wallet is free to make, and a bot can play well. This is how to pay rewards on loot, a Solana program every project shares, with those three in mind.
Devnet by default. Everything on this page runs on Solana devnet, where nothing is real money. The same file runs on mainnet when it says "network": "mainnet", and then it is real money. The program, loot, has not been independently audited. The fees quoted are devnet’s: the player fee is 0.002 SOL there and 0.0005 SOL on mainnet (read from the chain on 2026-11-21; the platform sets it, and the program caps it at 0.01 SOL).
The shape
- A grant in the spec says what a win pays and from which pool.
- A voucher key lives on your game’s server. The server checks a result, then signs a voucher that names the winner’s wallet.
- The winner claims from your page with that voucher. Only their wallet can.
- Caps on chain bound what the grant ever pays: per wallet, per day, in total. They hold even if your server is wrong, or its key is stolen.
1. Say what you want
“Winning a match pays 50 GEM from a rewards pool of 5 million. My server runs the matches. At most 10 wins a day count for one player.”
npx -y @xgamesfun/solana@0.29.3 examples rewards for winning a match, my server decides2. The spec
{
"version": 2,
"network": "devnet",
"name": "Arena Rewards",
"currency": "gem",
"tokens": [
{ "key": "sol", "source": "sol" },
{ "key": "gem", "source": "project", "name": "Gem", "symbol": "GEM", "supply": 10000000 }
],
"collection": false,
"pools": [{ "key": "rewards", "currency": "gem", "seed": 5000000 }],
"grants": [
{
"key": "win",
"name": "Match win",
"trust": "decides",
"prize": { "gives": "tokens", "amount": 50, "currency": "gem", "from": "pool:rewards" },
"vouchers": ["<your server's voucher key: its address, never the key>"],
"limits": { "perWalletEach": { "count": 10, "every": "1d" }, "perDay": 5000 },
"serverLimit": { "per": "person", "amount": 500, "every": "1d" },
"fund": 0.2
}
],
"scenario": { "perDay": { "grant:win": 2000 } }
}vouchersis the public address of the key your server signs with. Up to three.trustsays how much the server checks:decides,replaysorbounds. It changes nothing on chain; the review reads it.limitsis what the chain enforces: 10 claims a wallet a day, 5,000 a day for everyone.serverLimitis what your server promises to sign at most: 500 GEM a person a day.poolsholds the 5 million GEM. When it is empty, claims are refused.
3. Check it, and answer what it asks
npx -y @xgamesfun/solana@0.29.3 check xsolana.jsonThe spec is ready, and the checker has questions that only you can answer. They are the design:
? “Match win”'s server counts GEM, while the chain counts claims (10 a wallet every 1d and 5000 a day
for everyone): how many times a day does a regular player claim it, at most?
? Does your server or page pay a player more for anything they hold, win or do (a token or item held,
a code typed in, a streak, a place on a board): yes, and which, or no?
? How many players will claim “Match win”, and how many times each?
? What a player earned from “Match win” and did not claim in time, in three cases, each kept for them
(until when) or lost: earned past the day's cap; earned past the cap in all, or once the prize runs
out; and a voucher that runs out unclaimed. Players are told each one.
? These caps decide where an honest player stops and the most a leaked voucher key could take. …
Are these the numbers you want?
? Who runs the results server that signs the vouchers of “Match win”: the game’s own server, or one
someone else keeps for you? It has to be up for the whole run (no server, no claims).(… marks where the output is cut.) It also does the sum you would rather not find out later:
“Match win”: each claim gives up to 50 GEM from “rewards”; the caps count claims: 10 a wallet every 1d
(up to 500 GEM); 5000 a day for everyone together (up to 250000 GEM), so the first claims of a day can
use it up. Its server signs at most 500 a person every 1d: that is what it really pays. If its voucher
key leaks, the chain still allows 250000 GEM a day (“rewards” starts with 5000000: emptied in 20 days
at that pace).4. How far a result can be trusted
| Level | What the server does | What a cheater gets |
|---|---|---|
decides | Runs the game or the match itself. The page sends only inputs. | What a bot that plays well earns. Nothing forged. |
replays | Runs the page’s inputs again, from randomness it keeps, and reads the result. | What a bot that plays well earns. With the seed up front, the best run found offline. |
bounds | Starts each run, takes checkpoints in order, refuses what is too fast, caps a day. | Every reward a script claims at human speed, up to the limits. |
Turn games, card games and matches in a room can be decided. Puzzles and runners with short runs can be replayed. Anything the browser simulates can only be bounded, so keep its prize small, cosmetic or capped.
5. Read it the way a cheater would
npx -y @xgamesfun/solana@0.29.3 review xsolana.json- grant “Match win” (grant:win), trust: decides
Who: a wallet the voucher key signs for
The program keeps: 10 per wallet every 1d; 5000 a day, all wallets together; each round pays a
wallet once; a voucher names its wallet, grant and incarnation, so it can’t be moved or replayed;
only the receiving wallet signs the claim
Trusts off the chain: the voucher key … (whatever it signs is paid, within the limits)
Most one cheater gets: Playing for real (a bot that plays well): 50 GEM from “rewards”, 10 per wallet
every 1d, and wallets are free: up to 5000 a day (everyone’s daily total), with no total: without end.
Findings
- [medium] R-GRANT-PERSON (grant:win): “Match win” counts no person ("perPerson"): its limits are per
wallet, and wallets are free, so one person with many wallets claims 50 GEM from “rewards” once for
each, up to 5000 a day.
Fix: Have the server sign only for players signed in with an outside account (X), naming that person
in each voucher (a person hash, never a wallet), and set "perPerson". For a wallet-only player, keep
the prize small and capped a day.
…(… marks where the output is cut.) The finding is the one almost every reward has at first: its limits count wallets, and one person can have many.
6. See how long the pool lasts
npx -y @xgamesfun/solana@0.29.3 simulate xsolana.jsonGrant “Match win”: 2000 claims a day, each giving 50 GEM from “rewards”; each claim costs its funds
about 0.001712 SOL. One wallet may claim 10 a day; …
Pool “rewards”: 0 GEM in and 100000 out a day from a seed of 5000000; it runs dry in about 50 days.A reward stops paying on the chain, not in the game. When the pool is empty the chain refuses every claim, so the server has to stop counting there too, and the page has to say so.
7. Go live, then wire the server
npx -y @xgamesfun/solana@0.29.3 keygen ~/.config/xsolana/arena.json
npx -y @xgamesfun/solana@0.29.3 approve xsolana.json --keypair ~/.config/xsolana/arena.jsonGoing live is signed by the project’s key file on your own computer, after you have read what it sends. The voucher key is a different key: it lives on the server and can only sign claims of this grant. The server signs with signVoucher from @xgamesfun/solana/results, and the winner’s page claims with app.claimGrant('win', { voucher }).
What the server does before it signs, in the toolkit’s own words: it pays only a wallet the player proved is theirs, it counts people where it can, it checks what a wallet holds on the chain and never the page’s word, and before it signs a win again for another wallet it reads whether the first was paid. Trust and cheating has all of it.
In a browser game, with xcore
xcore gives a web game the server this needs, and two ways to sign. When the server already decides who won and the prize is fixed by place, it reports the winners and xgames.fun’s keeper signs, with no key for you to keep. When the amount depends on the result, xcore add vouchers gives the server a key of its own. xcore review then reads the server’s code the way a cheater would and says what one person can take. Add Solana to a browser game has the steps, and the server notes have both signers side by side.
Other ways to do it
- Points now, tokens later. Keep points in your own database and pay out in batches when you choose. It is the simplest thing, and nothing is on chain until you decide. Players have to trust your ledger, and you still have to decide who really earned the points.
- Your own program. A program that verifies your server’s signature and keeps the caps. You write, deploy and audit it.
- A shared program, as here. The caps and the one-claim-a-round rule are already there. The trade-off: a reward can only be what the spec can say.
Questions people ask
How do I stop bots from farming my game’s token rewards?
Three things together. A server, not the page, decides or checks each result before anything is signed. Limits count people where you can, with a sign-in such as X, because a wallet is free to make. And caps on chain (per wallet, per day, in total) bound what can ever be paid, whatever happens to your server. A bot that plays well still earns what a good player earns: keep rewards for results small.
Can a browser game pay token rewards with no server?
Not for a result. A game that runs in the browser cannot prove a score: anyone can change it in the console. With no server, pay only what the player buys or the chain decides, such as a shop, a loot box, staking or a claim for holders of an NFT.
What happens if my server’s voucher key leaks?
Whoever holds it can sign claims, and the chain pays them up to the grant’s limits and no further. That is what the limits are for: the checker works the number out for you, here 250,000 GEM a day until the pool is empty. The voucher key is never the owner’s key, so a leak cannot change the economy or reach other pools.
How do I limit rewards per person and not per wallet?
Have the server sign only for players signed in with an outside account such as X, name that person in each voucher as a hash, and set "perPerson" in the grant’s limits. A per-wallet limit alone never limits a person.
How much does my server have to check?
The spec says it in one word, "trust". "decides": the server runs the game or the match itself, and the page only sends inputs. "replays": the server runs the page’s inputs again and reads the result. "bounds": the page runs the game, and the server checks only pace, order and daily caps, so a script at human speed gets through. Pick the strongest one your game can afford, and size the prize to it.
Do players need SOL to claim a reward?
Only the winning wallet can sign its claim, but anyone may pay the claim’s fees. A game’s server can sponsor them with @xgamesfun/solana/sponsor, so a player with an empty wallet still claims.
What does it cost?
This economy takes 3 transactions and about 0.227 SOL to put live, of which 0.2 SOL is the grant’s fund: it pays the record each claim leaves, and what is left comes back when the grant closes. A claim costs a player fee (0.002 SOL on devnet, 0.0005 SOL on mainnet today) and a network fee.
Does it run on mainnet?
Yes. The same file runs on mainnet when it says "network": "mainnet", and then the tokens are real. The program has not been independently audited, so run the whole loop on devnet first.
More how-tos
- Make a loot box or gacha: Odds, prizes and a roll nobody can steer, in one JSON file.
- Add NFT staking: Lock tiers and rewards for any collection, one you did not mint too.
- Run an NFT raffle or a lottery: The winner gets the NFT before the seller is paid; a short round refunds.
- Run an NFT auction: A reserve, a late-bid extension, and every outbid bidder refunded at once.
- Run an airdrop people claim: A list of wallets with an amount each; only its Merkle root goes on chain.
- Add Solana to a browser game: Payments, loot boxes and token rewards in a game you already made.
- Solana MCP servers and plugins, by job: Which one for docs, programs, chain data, NFTs, wallets, trading and economies.
- Host a web game with xcore: A link anyone can play, with sign-in, saves, multiplayer and an economy.
- The whole toolkit: what else it builds, and how to install it in Claude Code, Codex, Cursor or a chat app.
Checked against @xgamesfun/solana 0.29.3 on 2026-11-21.