| # 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! π |
| |