NFT markets move in milliseconds. Human traders cannot monitor hundreds of collections simultaneously or execute purchases the instant an underpriced listing appears. AI agents can. This guide walks through building a production-ready sniping agent backed by the Purple Flea Wallet API for zero-latency on-chain purchases.
NFT sniping is the practice of identifying and purchasing NFTs that are listed below their true market value before other buyers notice. These opportunities arise constantly: a holder in a hurry lists at the wrong price, a floor-price calculation lags reality, or a rare trait is incorrectly priced relative to the rest of a collection. The window to capture these trades is often ten to thirty seconds.
Human traders have a fundamental ceiling: attention bandwidth. You can watch one collection at a time, on one marketplace at a time, and your reaction time from seeing a listing to executing a purchase adds browser latency, human processing time, and wallet confirmation steps. An AI agent has none of these limitations. It monitors hundreds of collections across Blur, OpenSea, and Magic Eden simultaneously, computes expected value against floor price in real time, and calls a wallet API to sign and broadcast a transaction β all in under a second.
The edge is structural, not predictive. The agent does not need to forecast which NFTs will appreciate. It only needs to identify listings priced below the current market consensus, buy them, and list them back at or slightly below the current floor. Done at volume with tight risk controls, this produces consistent positive expectation.
A sniping agent is a tight feedback loop: observe prices, evaluate opportunity, act, and track results. Every component has a single responsibility.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β NFT Sniping Agent β β β β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β β β Price Oracle βββββΆβ AI Agent βββββΆβ Wallet API β β β β β β (Evaluator) β β (Purple Flea) β β β β β’ Blur API β β β β β β β β β’ OpenSea β β β’ Floor diff β β β’ Sign tx β β β β β’ Magic Eden β β β’ Trait EV β β β’ Broadcast β β β β β’ WebSockets β β β’ Risk check β β β’ Gas estimate β β β ββββββββββββββββ ββββββββ¬ββββββββ ββββββββββ¬ββββββββββ β β β β β β βΌ βΌ β β ββββββββββββββββ ββββββββββββββββββββ β β β Decision β β NFT Marketplace β β β β Logger β β (Buy executes) β β β ββββββββββββββββ ββββββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Polls Blur, OpenSea, and Magic Eden APIs (plus WebSocket streams where available) to maintain a real-time order book for each monitored collection.
Computes the discount relative to floor, adjusts for trait rarity, checks against daily spend limits, and returns a buy/skip decision with confidence score.
The Purple Flea Wallet API holds ETH/SOL, estimates gas, signs transactions, and broadcasts to the network β all via a single REST call with no local keystore required.
wallet.purpleflea.com. Fund it with enough ETH to cover
purchases plus gas. A reasonable starting float is 0.5 ETH for Ethereum collections
or 20 SOL for Solana collections. The wallet API exposes balance, send, and swap
endpoints β no browser extension needed.
aiohttp, web3.py, and requests.
The agent runs asynchronously β synchronous HTTP will miss opportunities during I/O waits.
Use asyncio event loops and aiohttp sessions for all marketplace
API calls.
Every function below is production-realistic. Mock responses are labelled clearly. The wallet integration uses real Purple Flea API endpoints.
The main loop ties every component together: poll prices, evaluate, buy, list. Runs continuously until the daily spend limit is hit or the stop-loss triggers.
NFT sniping carries real financial risk. Floor prices can crater overnight. A single bad collection can wipe out weeks of snipe profits. These rules are non-negotiable.
Hard-code a daily ETH cap in the agent. Once reached, the agent stops buying until the next calendar day. Start at 0.1-0.3 ETH while calibrating. The cap prevents a bug or bad market from draining the wallet in a single session.
Track the total ETH value of held NFTs (mark-to-market at current floor). If portfolio value drops more than 25% from its peak, halt all new purchases. Floor crashes propagate across collections β stop early.
Set a maximum hold time (e.g., 72 hours). If an NFT has not sold within the window, lower the listing price by 2% every 12 hours until it clears. Illiquidity is the second biggest risk after floor crashes.
No single collection should represent more than 30% of total NFT portfolio value. Correlation within a single collection is 1.0 β if it crashes, everything in it crashes together. Diversify across collections and chains.
Keep 15% of wallet ETH reserved exclusively for gas. Failed transactions on Ethereum still consume gas. High competition on popular collections means a 40-60% failure rate on snipe attempts. Budget for it.
Every snipe attempt, successful purchase, and sale must be logged with timestamp, token ID, prices, floor at time of purchase, tx hash, and P&L. Essential for tuning the minimum discount threshold and for debugging bad decisions.
Most crypto wallets are designed for humans with browsers. Purple Flea is built for agents that need to transact programmatically, reliably, and fast.
The private key never leaves Purple Flea's HSM. Your agent authenticates with an API key and the wallet signs on the server. No risk of key theft from agent memory or logs.
ETH for OpenSea and Blur sniping. SOL for Magic Eden sniping on Solana. Both chains through the same REST API. No chain-switching logic, no separate keystores.
Select slow, standard, fast, or instant
gas strategy per transaction. For sniping, use fast or instant
to outrun competing agents.
Query ETH, SOL, and any ERC-20 balance in real time. Know your exact purchasing power before evaluating each listing. No stale balance estimates.
Every send endpoint accepts an idempotency_key. If your agent retries a
failed request, the transaction is not re-broadcast. No accidental double-purchases
during network hiccups.
Your agent can programmatically generate and distribute referral links for Purple Flea. When another sniping agent, DeFi bot, or trading agent signs up via your link, you earn 10β20% of their transaction fees in perpetuity β a passive revenue stream that compounds as the wider agent ecosystem grows. One sniping agent that onboards five others earns income on every snipe they collectively execute.
Speed and capital availability are the two bottlenecks in NFT sniping. The Purple Flea Wallet API eliminates both: instant USDC-to-ETH swaps keep dry powder ready on any chain, and a single balance endpoint tells the agent exactly what it can spend before it bids.
Keep idle capital in USDC to earn yield, then call the Wallet API swap endpoint to convert to ETH in milliseconds when a snipe opportunity appears. Your agent always has dry powder ready without leaving ETH sitting idle between opportunities.
One API key controls wallets on Ethereum mainnet, Base, and Polygon. Snipe Blur listings on Ethereum, low-fee collections on Base, and high-volume drops on Polygon β all from a single agent loop with no chain-switching complexity.
Call GET /v1/wallet/balance before evaluating each listing. The response
includes ETH, USDC, and USD value in real time so the agent never attempts a purchase
it cannot afford and never wastes gas on a transaction that will revert.
A production NFT sniping agent is more than a buy loop. It monitors floors continuously, executes the moment an underpriced listing appears, and moves proceeds to a trading account for reinvestment β compounding profits rather than leaving them idle.
The price oracle polls Blur, OpenSea, and Magic Eden every 5β8 seconds and maintains a
consensus floor price for each watched collection. Any listing that arrives below
floor * (1 - min_discount_pct / 100) is flagged for evaluation.
WebSocket streams from Blur reduce latency to under one second for new listings on
high-volume collections.
Before submitting any transaction, call GET /v1/wallet/balance to confirm
available ETH exceeds the listing price plus an estimated gas buffer. If ETH is low but
USDC reserves exist, trigger the swap endpoint to top up automatically. This prevents
reverted transactions and wasted gas fees.
Call POST /v1/wallet/send with gas_strategy: "fast" and an
idempotency key tied to the token ID and timestamp. The Purple Flea wallet signs and
broadcasts the transaction server-side β no local keystore, no MetaMask pop-up, no
human confirmation step. The agent completes the buy in the same time window that a
human trader would still be opening their browser wallet.
On confirmed purchase, the agent constructs a Seaport listing order at 98.5% of the
current floor price and submits it via the wallet's sign_listing action.
Undercutting the floor by 1β2% ensures the position exits quickly without waiting for
a floor buyer to appear organically.
After a successful sale, the ETH proceeds land back in the wallet. The agent
automatically transfers a configurable percentage (e.g., 80%) to a Purple Flea
trading account via POST /v1/wallet/send, where the funds can be
deployed into DeFi strategies or used to fund the next sniping cycle. The remaining
20% stays in the wallet as a gas and dry-powder reserve. This compounding loop
means every successful snipe increases the capital base for the next opportunity.
gas_strategy: "fast" on buys, not "instant", unless the collection is
extremely competitive (e.g., top-10 blue chips). The difference in cost between fast and instant
adds up significantly across hundreds of failed attempts.
Also use idempotency keys: if a submit times out, retry without fear of double-spending.
Finally, maintain a local cache of recently seen listing IDs β do not attempt to buy the same
listing twice if a previous attempt is still pending.
evaluate_listing function as a cost on the sell side.
A collection with 10% royalties requires a significantly larger discount to remain profitable
than one with 2.5%. As a rule of thumb: minimum discount threshold = (marketplace fee + royalty
+ desired profit margin + expected failed-gas cost per successful buy). For a 10% royalty
collection, your minimum discount is rarely below 15-18%.
Some marketplaces (notably Blur) allow optional royalty payments β but skipping royalties
can limit where your listing appears. Model this explicitly per marketplace.
asyncio.gather() pattern in the main loop handles this natively.
Practical limits: Purple Flea Wallet API rate limits allow hundreds of transactions per minute,
so the wallet is not the bottleneck. Marketplace API rate limits are the binding constraint.
With standard API keys you can comfortably monitor 10-20 collections concurrently.
Start with 3-5 collections you know well before scaling, so you can validate the minimum
discount thresholds are correctly calibrated per collection.
Create a Purple Flea wallet, fund it with ETH or SOL, and start executing on-chain purchases programmatically β no browser, no MetaMask, no manual signing.