๐ก๏ธ TokenGate: An Access Control System via On-Chain Token Ownership
A back-end system that checks if a given Ethereum wallet holds a specific ERC-20 token, enabling token-based access control for apps, websites, and services.
๐ Key Features
- Wallet Lookup: Accepts any Ethereum wallet address and checks token balance.
- Token-Based Access Control: Returns whether the wallet has access based on ownership of a specific token.
- Blockchain-Integrated: Uses live data from the Ethereum blockchain via
ethers.js
.
- Flexible Integration: Easy to plug into any frontend, backend, or service requiring token gating.
๐ฏ Use Cases
- Membership Unlocks: Restrict premium features or content to token holders.
- NFT Gating: Use ERC-721 ownership for access to exclusive platforms.
- Web3 Communities: Manage access to private groups (Discord, Telegram, etc.).
- Event Access: Allow entry based on ownership of an event token or ticket.
- Paywalled APIs: Enable rate-limited or tiered access based on token quantity.
๐ง Architecture
- Express.js: Lightweight Node.js server for API routing and request handling.
- ethers.js: Ethereum JavaScript SDK for interacting with smart contracts.
- Alchemy / Infura: Remote Ethereum node provider for blockchain queries.
- dotenv: Manages API keys and contract configurations via environment variables.
โ๏ธ Technology Stack
Layer |
Technology |
API |
Express.js |
Blockchain |
ethers.js |
Network |
Ethereum (Testnet or Mainnet) |
Config |
dotenv |
Runtime |
Node.js 18+ |
๐ API Endpoints
GET /check-access?wallet=0x...
Returns whether the specified wallet holds the required token.
๐งช Token Logic
- Token Standard: Defaults to ERC-20; can be adjusted for ERC-721 or ERC-1155.
- Access Check: Uses
balanceOf(wallet)
to determine ownership.
- Zero Knowledge: No login or signature required; pure on-chain lookup.
๐ก๏ธ Notes
- Easy to extend for tiered access, NFT ownership, or allowlist integration.
- Can be deployed on services like Vercel, Railway, or Render.
- Ideal for projects needing quick, reliable, token-based access verification.