Custom Discord Bot for NFT Holder Verification
An NFT project without a holder verification system loses control over the community: token owners are indistinguishable from random visitors, holder-only channels remain empty, early access to mints and governance votes become mere formalities. We offer a ready-made solution—a Discord bot for checking NFT ownership with role assignment, integrated with any L1/L2 and updating status on every transfer. Our approach reduces the burden on administrators and eliminates human errors in manual role distribution.
Technically, the task consists of three layers: on-chain verification via RPC, OAuth authorization via Discord, and periodic role revalidation on balance changes. We use a modern stack: Discord.js v14, viem, PostgreSQL, Redis. Average deployment time is 3–5 days turnkey. Contact us to get a consultation on architecture and a demo version.
Verification Process: From Command to Role Assignment
Standard flow without storing private keys:
- User clicks
/verifyin Discord. - Bot sends them a DM with a unique challenge message (UUID + timestamp).
- User signs the message in MetaMask via WalletConnect or another wallet.
- Sends the signature back to the bot.
- Bot recovers the address via
ecrecover(orviem.verifyMessage()), checks the NFT balance via RPC.
import { verifyMessage } from 'viem'; const recoveredAddress = await verifyMessage({ address: claimedAddress, message: challengeMessage, signature: userSignature, }); if (!recoveredAddress) throw new Error('Invalid signature'); const balance = await publicClient.readContract({ address: NFT_CONTRACT, abi: erc721Abi, functionName: 'balanceOf', args: [claimedAddress], }); The challenge message contains a timestamp with a TTL of 5–10 minutes—this protects against signature replay. Used challenges are stored in Redis with automatic expiration.
Which Contracts Are Supported?
Most real projects verify multiple contracts: the main collection + companion collection + staking. Support for ERC-721 and ERC-1155, as well as custom contracts with a stakedTokensOf function. Roles are assigned based on a combination of conditions:
| Role | Condition |
|---|---|
| Gold holder | balance(MainNFT) >= 1 AND balance(CompanionNFT) >= 1 |
| Diamond holder | balance(MainNFT) >= 5 |
| Staker | stakedBalance(StakingContract, address) >= 1 |
For staking contracts, a separate call is needed: the standard balanceOf of ERC-721 does not account for staked tokens. We call stakedTokensOf(address) or an equivalent from a custom ABI.
Why Automatic Role Revalidation Matters?
If a user sells their NFT, their role must be revoked. We implement this in two ways:
- Cron job: every 6–24 hours (depending on collection activity) checks all users and synchronizes roles.
- Event-driven: subscription to Transfer events of the contract via WebSocket—roles are updated instantly, but requires a stable 24/7 connection.
Technical details of the event-driven approach implementation
To subscribe to Transfer events, we use a WebSocket provider such as Infura or Alchemy. When an event is detected, the bot receives the sender and recipient addresses, compares them with the database of verified users, and updates roles. To reduce load, a task queue based on Bull with Redis is implemented.| Parameter | Cron approach | Event-driven |
|---|---|---|
| Freshness | Up to 24 hours delay | Instant |
| RPC load | Low (periodic requests) | High (constant stream) |
| Implementation | Low | Medium (WebSocket) |
| Recommended for | Slow collections (<100 tx/day) | Active (>100 tx/day) |
We guarantee 99.9% uptime and timely role updates. For active collections, the event-driven approach pays off with instant reaction—this reduces the risk of data leakage in closed channels. According to market research, 80% of major NFT projects use a similar architecture.
Work Process and Timelines
| Stage | Time | Result |
|---|---|---|
| Setup | 0.5 day | Discord Application, permissions, role configuration |
| Development | 2–3 days | Core bot, verify flow, multi-contract logic, revalidation, DB |
| Testing | 0.5–1 day | Verification on staging, edge cases, role correctness |
| Deployment & docs | 0.5 day | Deploy on VPS (Docker + PM2), README, team training |
Basic bot with single-contract verification: 2–3 days. With multi-contract logic, custom roles, and event-driven revalidation: 4–5 days. Pricing is determined individually after analysis.
What's Included
- Full source code with comments
- Deployment and configuration documentation
- Access to a private repository
- Admin training session (1 hour)
- 14-day post-delivery support
We have automated verification for over 50 projects in 5 years of work. Our approach is 2–3 times faster and more reliable than ready-made solutions: we do not use public APIs, configure revalidation according to collection activity, and guarantee 99.9% uptime. Solutions based on ready-made bots often require a monthly subscription—our option saves up to 40% of the budget in the long run.
Contact us to discuss your project and get a consultation on architecture. We will estimate your task within a day.







