Monetizable Blockchain Data API via x402 & Alchemy
Blockchain data on demand - like a vending machine. Insert payment (USDC), get instant access to NFTs, tokens, transactions, and more. No accounts, no API keys, just pay per query.
Vend Server API (Express + x402):
- Transaction History - Asset transfers (ETH, ERC20, ERC721, ERC1155)
- NFT Data - Owned NFTs, metadata, floor prices
- Token Balances - ERC20 holdings and metadata
- Webhooks - Real time notifications for new transactions
- x402 Payments - USDC micropayments with on chain verification
- Production Ready - Deploy to mainnet
Vend CLI Tool (@asimfiles/vend-cli):
- 8 Commands - query, nfts, tokens, balance, info, config, saved, webhook
- Output Formats - Table, JSON, CSV
- Saved Queries - Create reusable query templates
- Automatic Payments - Optional wallet integration for hands free payments
- Multi-Network - Base, Ethereum, Polygon, Arbitrum, Optimism
Powered by: x402-onchain-verification - Open-source middleware for direct on-chain payment verification. No facilitator servers needed. Built by Alchemy.
βββββββββββββββββββββββββββββββββββ
β π° VEND β
β Blockchain Data Vending β
β β
β [Insert 0.01 USDC] β
β β β
β [Get Data] β
βββββββββββββββββββββββββββββββββββ
Vend is production-ready with real on-chain payment verification.
# 1. Fork & clone
git clone https://github.com/yourusername/vend.git
cd vend && npm install
# 2. Configure (get free Alchemy key from dashboard.alchemy.com)
cp .env.example .env
# Edit .env: Add ALCHEMY_API_KEY and PAYMENT_ADDRESS
# 3. Deploy to mainnet
export PAYMENT_NETWORK=base-mainnet
export NODE_ENV=production
npm start
# 4. Done! π Accept USDC payments on BaseReal USDC payments work immediately - no additional setup needed. Payment verification happens automatically on chain via Alchemy.
π Full Deployment Guide | Supports Base, Ethereum, Polygon, Arbitrum, Optimism
##Why Vend?
Traditional APIs:
- Sign up for account β
- Manage API keys β
- Monthly subscriptions β
- Rate limits β
Vend:
- Pay USDC β Get data β
- That's it. π°
Perfect for:
- AI Agents - No API key management, just send USDC
- Developers - Pay per use, no subscriptions, create buisnesses from your API key
- Data Analytics - Access blockchain data on demand
- Researchers - Query without account setup
x402 is an open protocol that revives the HTTP 402 Payment Required status code for instant micropayments.
βββββββββββββββ βββββββββββββββ
β Client β β Vend β
ββββββββ¬βββββββ ββββββββ¬βββββββ
β β
β 1. GET /api/nfts?owner=0x... β
ββββββββββββββββββββββββββββββββββββββββββ>β
β β
β 2. 402 Payment Required β
β { β
β recipient: "0x742d...", β
β amount: "0.01 USDC", β
β network: "base-mainnet" β
β } β
β<ββββββββββββββββββββββββββββββββββββββββββ
β β
β 3. [Client sends 0.01 USDC on Base] β
β β
β 4. GET /api/nfts?owner=0x... β
β Header: X-Payment-Hash: 0xabc123... β
ββββββββββββββββββββββββββββββββββββββββββ>β
β β
β [Vend verifies payment on-chain] β
β [Vend queries Alchemy for NFTs] β
β β
β 5. 200 OK β
β { nfts: [...] } β
β<ββββββββββββββββββββββββββββββββββββββββββ
All endpoints require USDC payment via x402. Payment is verified on chain before returning data.
GET /api/transfers?address=0x...&category=erc20
# Returns
{
"payment": {
"hash": "0xabc123...",
"amount": "0.01",
"currency": "USDC",
"verified": true
},
"data": {
"transfers": [
{
"blockNum": "0x163fcf9",
"hash": "0x5a1882bb...",
"from": "0xd8da6bf...",
"to": "0x742d35cc...",
"value": 1000000,
"asset": "USDC",
"category": "erc20"
}
],
"totalCount": 1523,
"pageKey": "..."
}
}Price: $0.01 USDC Categories: external, internal, erc20, erc721, erc1155
GET /api/nfts?owner=0x...
# Returns NFTs owned by addressPrice: $0.01 USDC Features: Pagination, metadata, contract filtering
GET /api/nfts/metadata?contractAddress=0x...&tokenId=1
# Returns single NFT metadataPrice: $0.005 USDC
GET /api/nfts/floor-price?contractAddress=0x...
# Returns collection floor pricePrice: $0.005 USDC Source: OpenSea, LooksRare
GET /api/tokens/balances?address=0x...
# Returns all ERC20 token balancesPrice: $0.01 USDC
GET /api/tokens/metadata?contractAddress=0x...
# Returns token info (name, symbol, decimals, logo)Price: $0.005 USDC
Create webhook subscriptions to get notified of new transactions:
# Create webhook
POST /api/webhooks
{
"address": "0x...",
"webhookUrl": "https://webhook.site/...",
"categories": ["erc20", "erc721"]
}
# List webhooks
GET /api/webhooks
# Delete webhook
DELETE /api/webhooks/:idPrice: Free (no payment required for webhook management) Monitoring: Server checks every 5 minutes for new transactions
Install globally:
npm install -g @asimfiles/vend-cliOr use with npx:
npx @asimfiles/vend-cli --help# Table format (default)
vend query https://yourapi.com/api/transfers \
--address 0xVitalik... \
--tx-hash demo
# JSON format
vend query https://yourapi.com/api/transfers \
--address 0xVitalik... \
--format json
# CSV format (pipe to file)
vend query https://yourapi.com/api/transfers \
--address 0xVitalik... \
--format csv > transfers.csvvend nfts https://yourapi.com/api/nfts \
--owner 0xVitalik... \
--tx-hash demo \
--format tablevend tokens https://yourapi.com/api/tokens/balances \
--address 0xVitalik... \
--tx-hash demo# Provide private key for automatic USDC payments
vend query https://yourapi.com/api/transfers \
--address 0xVitalik... \
--wallet 0xYourPrivateKey
# No manual payment needed! CLI sends USDC automatically# Create a saved query
vend saved create whale-watch
# Interactive wizard prompts for details
# Run saved query
vend saved run whale-watch
# List saved queries
vend saved list
# Show query details
vend saved show whale-watch
# Delete query
vend saved delete whale-watch# Create webhook
vend webhook create https://yourapi.com/api/webhooks \
--address 0xVitalik... \
--notify https://webhook.site/your-webhook
# List webhooks
vend webhook list https://yourapi.com/api/webhooks
# Delete webhook
vend webhook delete https://yourapi.com/api/webhooks \
--id wh_abc123| Command | Description |
|---|---|
query |
Query transaction history |
nfts |
Query NFT ownership |
tokens |
Query token balances |
balance |
Get token balances (alias) |
info |
Get endpoint info (no payment) |
config |
Manage CLI configuration |
saved |
Manage saved queries |
webhook |
Manage webhooks |
Run vend <command> --help for detailed usage.
β Production Ready! Vend includes real on-chain USDC payment verification using x402-onchain-verification. Deploy to mainnet now!
The deployment guide includes:
- Testnet setup (Base Sepolia) for testing
- Mainnet configuration (Base, Ethereum, Polygon, etc.)
- Payment verification testing
- Security hardening
- Production checklist
npm i -g @railway/cli
railway login
railway up # Add env vars in dashboard- Push to GitHub
- Connect on Render
- Add environment variables
- Deploy!
docker build -t vend .
docker run -p 3000:3000 \
-e ALCHEMY_API_KEY=your_key \
-e PAYMENT_ADDRESS=0x... \
-e PAYMENT_NETWORK=base-mainnet \
-e NODE_ENV=production \
vendnpm i -g pm2
pm2 start src/index.js --name vend
pm2 save
pm2 startupDevelopment (Base Sepolia Testnet):
PAYMENT_NETWORK=base-sepolia
NODE_ENV=developmentProduction (Base Mainnet):
PAYMENT_NETWORK=base-mainnet
NODE_ENV=productionSee DEPLOYMENT.md for complete configuration guide.
- Alchemy: 300M compute units/month
- ~2M queries/month
- Cost: $0
| Queries/Day | Alchemy Cost | Revenue @ $0.01 | Profit |
|---|---|---|---|
| 1,000 | $49/mo | $300/mo | $251/mo |
| 10,000 | $199/mo | $3,000/mo | $2,801/mo |
| 100,000 | $499/mo | $30,000/mo | $29,501/mo |
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Client β
β (CLI, cURL, Browser, AI Agent) β
βββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
HTTP + x402
β
βββββββββββββββββββββ΄βββββββββββββββββββββββββββ
β Vend API Server β
β β
β βββββββββββββββββββββββββββββββββββββββ β
β β x402 Payment Middleware β β
β β β’ Check for X-Payment-Hash header β β
β β β’ Verify USDC payment on-chain β β
β β β’ Parse Transfer events β β
β β β’ Validate amount & recipient β β
β βββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββ΄ββββββββββββββββββ β
β β Express Routes β β
β β β’ /api/transfers β β
β β β’ /api/nfts β β
β β β’ /api/tokens β β
β β β’ /api/webhooks β β
β ββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββ΄ββββββββββ
β β
ββββββββ΄βββββββ ββββββββ΄βββββββ
β Alchemy β β Base β
β SDK β β Blockchain β
β β β β
β β’ NFTs β β β’ Verify β
β β’ Tokens β β USDC β
β β’ Transfersβ β payments β
βββββββββββββββ βββββββββββββββ
- x402 Middleware (
src/middleware/payment.js) - Handles 402 responses and verification - USDC Verifier (
packages/x402-onchain-verification) - On-chain payment verification - Alchemy Service (
src/services/alchemy.js) - Blockchain data queries - Routes (
src/routes/) - API endpoint handlers - CLI (
packages/vend-cli) - Command-line interface
- β On-chain payment verification (no trust required)
- β ERC20 Transfer event parsing
- β Amount and recipient validation
- β HTTPS support
- β Rate limiting ready
- β Input validation
- β No private keys stored on server
- Getting Started - Setup guide
- x402 Integration - Payment protocol deep dive
- Alchemy Guide - Advanced blockchain queries
- Deployment - Go to production
- CLI Guide - Command line usage
- Value Prop - Why Vend?
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
Vend - Insert payment, get data. π°π°