File size: 2,210 Bytes
fc115d5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # Cloudflare Workers Proxy for Binance Testnet
This proxy bypasses geo-restrictions (Error 451) when accessing Binance testnet from HuggingFace Spaces.
## π― Quick Start
### 1. Deploy the Worker (15 minutes)
Follow the step-by-step guide in **[DEPLOYMENT_GUIDE.md](./DEPLOYMENT_GUIDE.md)**
**Summary:**
1. Sign up at [workers.cloudflare.com](https://workers.cloudflare.com) (FREE, no credit card)
2. Create a new Worker
3. Copy code from `binance-testnet-proxy.js`
4. Save and Deploy
5. Copy your Worker URL
### 2. Configure HuggingFace Space
Add your Worker URL to HuggingFace Secrets:
1. Go to your Space Settings β Repository Secrets
2. Add new secret:
- **Name:** `BINANCE_TESTNET_PROXY_URL`
- **Value:** `https://your-worker.workers.dev`
3. Restart the Space
### 3. Test Locally (Optional)
Before deploying to HuggingFace, test locally:
```bash
# Add to .env file
echo "BINANCE_TESTNET_PROXY_URL=https://your-worker.workers.dev" >> .env
# Run test script
python test_proxy.py
```
If all tests pass β
, you're ready to deploy to HuggingFace!
---
## π Free Tier Limits
- **Requests:** 100,000 per day (FREE)
- **CPU Time:** 50ms per request
- **Workers:** 30 deployed scripts
- **Storage:** 1GB total
**For a single trading bot:** These limits are more than enough!
---
## π Security
- β
You control the proxy code
- β
API keys are not logged or stored
- β
CORS protection limits access to your HuggingFace Spaces only
- β
All traffic is encrypted (HTTPS)
---
## π Files in This Directory
- **`binance-testnet-proxy.js`** - The Cloudflare Worker code
- **`DEPLOYMENT_GUIDE.md`** - Detailed deployment instructions
- **`README.md`** - This file
---
## π Need Help?
1. Check the [DEPLOYMENT_GUIDE.md](./DEPLOYMENT_GUIDE.md) for troubleshooting
2. Review Cloudflare Workers docs: https://developers.cloudflare.com/workers/
3. Check if your Worker is deployed correctly in the Cloudflare dashboard
---
## β
Success Checklist
- [ ] Cloudflare account created
- [ ] Worker deployed with proxy code
- [ ] Worker URL copied
- [ ] `BINANCE_TESTNET_PROXY_URL` added to HuggingFace Secrets
- [ ] HuggingFace Space restarted
- [ ] Testnet tab working! π
|