{"name":"Handshake58","tagline":"Payments for AI Agents — No API keys, no credit cards, no subscriptions.","description":"Service marketplace with USDC micropayments on Polygon. Providers offer LLM, scraping, image generation, VPN, and more. One wallet, one protocol, any provider.","requirements":["Polygon wallet with $5+ USDC (gas provided free via /api/gas-station)"],"quick_start":{"step1_install":"npm install -g drain-mcp","step2_wallet":"node -e \"const w=require('ethers').Wallet.createRandom();console.log(w.address, w.privateKey)\"","step3_config":{"mcpServers":{"drain":{"command":"drain-mcp","env":{"DRAIN_PRIVATE_KEY":"0x_your_private_key"}}}},"step4_fund":"Send $5+ USDC on Polygon to wallet address. Free gas via POST /api/gas-station."},"workflow":{"step1_discover":{"description":"Find service providers with models/services and pricing","tool":"drain_providers","example":"drain_providers(category: 'llm')","api":"GET https://handshake58.com/api/mcp/providers","api_filters":"?category=llm|image|audio|video|code|multi-modal|scraping|search|data|scheduling|network|forecasting|other &model=gpt-4o &tier=bittensor|community &minScore=0.5 &limit=10"},"step2_open_channel":{"description":"Deposit USDC into payment channel (~$0.02 gas)","tool":"drain_open_channel","note":"Approve USDC spending first with drain_approve (one-time). 2% protocol fee deducted on-chain from provider claims."},"step3_use_service":{"description":"Send paid requests through the channel ($0 gas per request)","tool":"drain_chat","note":"For LLM: standard chat messages. For other categories: check provider docs via drain_provider_info first."},"step4_close":{"description":"Close channel when done","tool":"drain_cooperative_close","note":"Instant refund of unspent deposit. Always close when task is finished."}},"cooperative_close_guidance":{"task_done":"Use drain_cooperative_close(channelId) — instant refund. Always do this when finished.","more_requests_planned":"Keep channel open — no need to close and reopen. Saves $0.04 gas.","channel_expired":"Use drain_close_channel(channelId) — reclaim funds after expiry. Funds do NOT auto-return.","rule":"Close when task is done. Keep open while working."},"payment_discovery_402":{"description":"Providers return 402 Payment Required with headers when no payment voucher is sent. Use these headers to discover how to pay — no prior registration needed.","headers":{"X-Payment-Protocol":"drain-v2","X-Payment-Provider":"Provider wallet address (open channel to this address)","X-Payment-Contract":"DRAIN contract address","X-Payment-Chain":"137 (Polygon Mainnet)","X-Payment-Signing":"URL to fetch EIP-712 signing info","X-Payment-Docs":"Provider docs endpoint (request format, parameters, examples)"},"flow":"1. Call provider without voucher → 402 with headers. 2. Read X-Payment-Docs for request format. 3. Open channel to X-Payment-Provider. 4. Retry with X-DRAIN-Voucher header."},"economics":{"gas_per_channel":"$0.02 (open) + $0.02 (close)","per_request":"$0 gas (off-chain vouchers)","protocol_fee":"2% on provider claims (on-chain)","session_fee":"none","example":{"model":"GPT-4o","deposit":"$0.50","per_request_cost":"$0.001755","requests_possible":"~285","cost_for_10_requests":"$0.02 gas + $0.01755 usage = $0.04","refund_after_close":"$0.48"}},"gas_station":{"description":"Free POL for agents with $5+ USDC — no need to acquire gas separately","method":"POST","url":"https://handshake58.com/api/gas-station","body":{"address":"0x_your_wallet_address"},"note":"One-time per wallet. Returns 0.1 POL (~10K transactions). Sends only public address."},"provider_categories":["llm","image","audio","video","code","multi-modal","scraping","search","data","scheduling","network","forecasting","other"],"contracts":{"handshake58_channel":"0x0C2B3aA1e80629D572b1f200e6DF3586B3946A8A","usdc":"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","chain":"Polygon Mainnet (137)"},"mcp_server":{"install":"npm install -g drain-mcp","npm":"https://www.npmjs.com/package/drain-mcp","tools":{"discovery":["drain_providers","drain_provider_info"],"wallet":["drain_balance","drain_approve"],"channels":["drain_open_channel","drain_channel_status","drain_channels"],"usage":["drain_chat"],"settlement":["drain_cooperative_close","drain_close_channel"]}},"skills":{"description":"Pre-built multi-provider workflows. Agents can fetch a skill JSON and execute it step-by-step using drain-mcp tools.","list_url":"https://handshake58.com/api/skills","skill_url_pattern":"https://handshake58.com/api/skills/{slug}","format":"Skill JSON includes providers (with roles, models, deposits) and steps (with dependencies via 'after', message payloads, and LLM templates with {{step_id}} and {{user_prompt}} placeholders).","how_to_run":"1. Fetch skill JSON from /api/skills/{slug}. 2. For each provider role, use drain_providers to find a matching provider. 3. Open channels with drain_open_channel. 4. Execute steps in dependency order using drain_chat. 5. Substitute {{step_id}} placeholders in templates with previous step outputs, and {{user_prompt}} with the user's original input. 6. Close all channels with drain_cooperative_close.","chat_url":"https://handshake58.com/skills"},"docs":{"full_docs":"https://handshake58.com/skill.md","instructions":"https://handshake58.com/llms.txt","providers_api":"https://handshake58.com/api/mcp/providers","signing_api":"https://handshake58.com/api/drain/signing","directory":"https://handshake58.com/directory","source":"https://github.com/kimbo128/DRAIN"}}