How to add NFT staking on Solana without deploying a program
NFT staking is a farm: holders stake, pick a lock, and earn a reward for as long as they stay. Here a farm is a few lines of JSON on loot, a Solana program every project shares, and it takes any collection, one you did not mint too. You write no staking program and deploy nothing of your own.
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).
What you need
Node 22 or later, and the address of the collection: a Metaplex Core collection, or the mint of a Token Metadata collection its NFTs are verified in. No Rust, no Anchor, no Solana CLI. With an AI coding agent you type a sentence and it runs the commands below; the toolkit’s page has the install lines.
1. Say what you want
“Holders of this collection stake their NFT for 10 GOLD a day. Locking for 30 days doubles it, 90 days pays four times. GOLD has a fixed supply of 10 million, and half of it funds the farm.”
npx -y @xgamesfun/solana@0.29.3 examples stake an NFT collection, lock tiers2. The spec
{
"version": 2,
"network": "devnet",
"name": "Holders' Den",
"currency": "gold",
"tokens": [
{ "key": "sol", "source": "sol" },
{ "key": "gold", "source": "project", "name": "Gold", "symbol": "GOLD", "supply": 10000000 }
],
"collection": false,
"farms": [
{
"key": "den",
"name": "The den",
"stakes": "collectibles",
"gate": { "collection": "<the collection's address>" },
"custody": "freeze",
"rewards": "gold",
"seed": 5000000,
"rate": { "perDay": 10 },
"tiers": [
{ "lock": "1d", "multiplier": 1 },
{ "lock": "30d", "multiplier": 2 },
{ "lock": "90d", "multiplier": 4 }
]
}
],
"scenario": { "days": 30, "staked": { "den": 1000 } }
}gatenames the collection. Put its address there.rateis a fixed 10 GOLD a day for each NFT, whoever else is staked, which is how most Solana NFT staking pays. Leave it out and stakers share whatever lands in the vault by weight.tiersare the locks. A 90-day lock earns four times the rate.supplyandseedfix GOLD at 10 million and put 5 million in the farm’s vault.scenariois what the simulation assumes: 1,000 NFTs staked.
3. Pick how a staked NFT is held
| Custody | Where the NFT is | Works for |
|---|---|---|
freeze | In the holder’s wallet, locked, the project its delegate | Core, Token Metadata (legacy and pNFT), compressed |
watch | In the holder’s wallet, free. It can be sold, and it earns only while its staker holds it | Core, Token Metadata |
escrow (the default) | Held by the project until it is unstaked | Core only |
For a collection you do not control, watch asks the least of holders: nothing is locked, and nothing depends on a key of yours to get an NFT back.
4. Check it
npx -y @xgamesfun/solana@0.29.3 check xsolana.jsonThis spec is ready, with four warnings worth reading before you go on:
- Custody. A frozen NFT is unlocked only by the project’s key. Use it with a collection whose issuer you trust.
- The rate. A fixed rate from a vault is paid while the vault lasts. What it cannot cover is not owed later.
- Prints. In a Token Metadata collection, a print of a master edition does not count as part of the collection. Tell holders of prints.
- An outside collection. The creator of an NFT with a permanent delegate can pull it out of a stake, or burn it there. Prefer collections without one.
5. See how long the rewards last
npx -y @xgamesfun/solana@0.29.3 simulate xsolana.jsonFarm “The den”: 10000 GOLD a day to everyone staked, 10 a day for each collectible staked; each seat
earns 10 a day for each collectible at x1, whoever else is in, while its vault lasts; what a seat gives
back (a forfeit) is left free in its vault, never to the other seats.
The rewards vault of “The den”: 0 GOLD in and 10000 out a day from a seed of 5000000; it runs dry in
about 500 days.Change the rate, the seed or the number staked and run it again. A farm that runs dry early is easy to build by accident, and this is where you see it.
6. Price it
npx -y @xgamesfun/solana@0.29.3 cost xsolana.jsonGoing live takes 3 transactions and about 0.026956086 SOL:
rent 0.01689608 SOL for 8 accounts; program fees 0.00004 SOL; network fees 0.000020006 SOL;
Token Metadata’s fees 0.01 SOL (a token’s name on chain); seeds 5000000 GOLD.
…
stake in “The den” (player): 0.002 SOL fee + 0.000005 SOL network; 0.00154432 SOL for the seat
(back: when they take everything out)
unstake or harvest from “The den” (player): 0.002 SOL fee + 0.000005 SOL network7. Read it the way a cheater would
npx -y @xgamesfun/solana@0.29.3 review xsolana.json- farm “The den” (farm:den)
Who: any wallet that stakes an NFT of the collection … (not a Token Metadata print)
The program keeps: only NFTs its gate takes: …; one seat per NFT, ever; nobody else harvests or
unstakes a seat; a fixed 10 GOLD a day per unit at x1, from its vault while it lasts; locks 1d (x1),
30d (x2), 90d (x4); no end; freeze custody
Trusts off the chain: nothing
Most one cheater gets: each NFT earns up to 40 GOLD a day in “The den” (1,200 in 30 days, 14,600 a
year), for as long as it stays staked, with no end. …(… marks where the output is cut.) The ceiling is the useful line: one NFT earns at most 40 GOLD a day, so the cheapest way to farm GOLD is to buy the cheapest NFT of the collection. Price the reward with that in mind.
8. Go live, signed on your own computer
npx -y @xgamesfun/solana@0.29.3 keygen ~/.config/xsolana/den.json
npx -y @xgamesfun/solana@0.29.3 approve xsolana.json --keypair ~/.config/xsolana/den.jsonkeygen makes a key file for the project and prints its address, never the key. approve lists every transaction and what it pays, ends with a code, and sends nothing; run it again with --yes and that code to send exactly what it listed. Nothing asks for a seed phrase or for the key of a wallet you already have.
9. Let holders stake
npm install @xgamesfun/solanaimport { solanaApp, walletStandardSigner } from '@xgamesfun/solana/play';
const spec = await (await fetch('./xsolana.json')).json(); // the live spec, served with the page
const app = solanaApp({ spec, rpcUrl: 'https://api.devnet.solana.com', wallet: walletStandardSigner(wallet, account) });
await app.stakeNft('den', asset); // asset: the address of one of the player's NFTs
await app.staked('den'); // the player's seats: [{ asset, freeAt, boostPercent, rewards, … }]
await app.harvest('den'); // rewards so farThe player module needs no Solana SDK and runs in a browser. The app reference shows a whole page, the wallet connection included.
What else a farm can do
- Boosts by trait. A percent for a background, or a percent per level.
- Growth. A staked NFT earns points and levels for each day in, written with nobody’s signature, and a gate, a boost or a loot box’s odds can read that level.
- Missions. A lock tier with a prize: an NFT that stays the whole lock comes back with it.
- Staking tokens. The same farm with a token in place of NFTs, and an early-exit fee if you want one.
NFTs and tokens says what the program can do with each kind of NFT, with the project’s authority and without it.
Other ways to build it
- Your own staking program. An Anchor program does exactly what you write. You also test, deploy, upgrade and audit it, and a staking program holds or locks other people’s NFTs.
- The NFT standard’s own tools. Metaplex’s Core docs show staking built from its freeze and attribute plugins, driven by your own backend. That fits a collection whose authority you hold.
- A shared program, as here. Nothing to write or deploy, and it takes collections you do not control. The trade-off: a farm can only be what the spec can say.
Questions people ask
Can I add staking to an NFT collection I did not mint?
Yes. A farm takes the NFTs of any collection its gate names, and the project needs no authority over them. It works for Metaplex Core assets, Token Metadata NFTs (legacy and pNFT) and compressed NFTs. What changes with the kind is how a staked NFT is held: see the custody table on this page.
Do I need to write or deploy a staking program?
No. The farm is an entry in a JSON file and it runs on loot, one Solana program that every project shares. You need Node 22 or later for the tools, and nothing of your own is deployed or audited.
Does the NFT leave the holder’s wallet while it is staked?
That is the custody you pick. With "freeze" it stays in the wallet, locked. With "watch" it stays in the wallet and stays free: it can be sold, and it earns only while its staker still holds it. With "escrow" the project holds it, which only Core NFTs can do.
What does NFT staking cost to set up, and what does a holder pay?
This farm takes 3 transactions and about 0.027 SOL to put live, of which 0.01 SOL is Token Metadata’s fee for naming the reward token on chain. A holder pays a player fee (0.002 SOL on devnet, 0.0005 SOL on mainnet today) and a network fee to stake, to harvest and to unstake, plus about 0.0015 SOL of rent for their seat, which comes back when they take everything out.
Can rewards be a token that already exists, or SOL?
Yes. Rewards are paid from the farm’s own vault, which you fund at the start (a seed), from a share of sales, or on a schedule. The vault can hold SOL, or an existing coin you name by its mint. A reward token the project mints itself is the other choice.
Can rarer NFTs earn more?
Yes. A farm takes up to 32 boosts that read what an NFT says about itself: a flat percent for a trait, or a percent per point of an attribute such as a level. For a collection the project has no authority over, it can vouch for off-chain traits once and let holders prove theirs.
What happens when the rewards run out?
A fixed rate paid from a vault stops when the vault is empty, and what it could not pay is not owed later. The simulation says when: this farm runs dry in about 500 days with 1,000 NFTs staked. Keep the vault funded, or mint the rewards and accept that nothing caps the supply.
Does it run on mainnet?
Yes. The same file runs on mainnet when it says "network": "mainnet". The program has not been independently audited, so build and try a farm on devnet first.
More how-tos
- Make a loot box or gacha: Odds, prizes and a roll nobody can steer, in one JSON file.
- 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.
- Pay players token rewards: A server that checks, a voucher it signs, and caps a leaked key cannot pass.
- 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.