# 0tx.io/draft > Deploy a Solana program to devnet when you hold no SOL. Reserve a program ID, build your program with that `declare_id!`, upload the compiled `.so`, and poll until it is `deployed`. 0tx fronts the devnet rent from a recycled SOL pool and reclaims it when the lease expires. No account, no API key. **Why draft?** Deploying a Solana program locks several SOL of rent—far more than devnet faucets hand out. Because rent returns when a program closes, draft pools devnet SOL and leases program deployments: you get a real devnet program ID, free in-place upgrades during the lease, and zero faucet choreography. Live pricing, limits and pool availability: `GET https://0tx.io/draft/v1/info`. ## Workflow ### 1. Reserve a program ID ``` POST https://0tx.io/draft/v1/programs Content-Type: application/json {"max_bytes": 262144} ``` - `max_bytes` is optional (integer `1` to `limits.max_bytes` from `/draft/v1/info`; defaults to `limits.max_bytes`). Pass a tighter upper bound if your program is small so the pool reserves less rent headroom. - **Pricing**: check `GET /draft/v1/info`. When `free` is `true` (`price_usdc: "0.00"`), the reserve succeeds immediately with `201 Created`. When `price_usdc` is non-zero, the first call returns HTTP 402 with a `PAYMENT-REQUIRED` header (x402 V2, scheme `exact`, network `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`, asset USDC `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`, facilitated by PayAI). Retry with `PAYMENT-SIGNATURE`; any x402 V2 client handles this automatically. - **Response (`201 Created`)**: ```json { "id": "drf_...", "program_id": "", "lease_secret": "drfs_...", "network": "solana-devnet", "status": "ready", "max_bytes": 262144, "expires_at": "", "upload_url": "https://0tx.io/draft/v1/programs/drf_...", "status_url": "https://0tx.io/draft/v1/programs/drf_...", "extend_url": "https://0tx.io/draft/v1/programs/drf_.../extend", "close_url": "https://0tx.io/draft/v1/programs/drf_...", "payment_tx": "" } ``` - Keep `lease_secret`—it authenticates uploads, extensions and early closes (`Authorization: Bearer `). If a paid reserve times out before you read the response, retrying with the exact same `PAYMENT-SIGNATURE` returns the same lease and `lease_secret` without charging twice. ### 2. Build with that program ID Put `program_id` in your program's `declare_id!(...)` (and `Anchor.toml` if using Anchor), then build with `anchor build` or `cargo build-sbf` to produce `target/deploy/.so`. ### 3. Upload the `.so` (and upgrade in place) ``` PUT https://0tx.io/draft/v1/programs/ Authorization: Bearer Content-Type: application/octet-stream ``` - Returns **`202 Accepted`** while the deploy runs in the background. - Validates that the file is a 64-bit little-endian Solana BPF/SBF ELF binary (`<= max_bytes`) before queueing. - Upload again after `status` reaches `deployed` to upgrade the same program ID in place (up to `max_uploads` completed deploys/upgrades per lease). - A failed upload does not consume an upload slot; upload again to retry (on-chain buffer writes resume from where they left off). ### 4. Poll until deployed ``` GET https://0tx.io/draft/v1/programs/ ``` No auth header required (returns no secrets). Poll every few seconds until `status` is `deployed` (or `failed`): - `status`: `ready` | `deploying` | `deployed` | `failed` | `closing` | `closed` - `bytes_written` / `binary_bytes`: live progress while `deploying` - `last_deploy_tx`, `last_deploy_kind` (`deploy` | `upgrade` | `none`), `last_deploy_explorer` - `error`, `retryable` (when `status` is `failed`; `retryable: false` means the runtime rejected the binary and you must rebuild before uploading again) ### 5. Extend or close early - **Extend**: `POST https://0tx.io/draft/v1/programs//extend` with `Authorization: Bearer ` (and x402 payment if `extend_price_usdc` > 0). Adds `lease_days` up to `max_extend_days` from now. - **Close early**: `DELETE https://0tx.io/draft/v1/programs/` with `Authorization: Bearer `. Closes the program data on devnet and returns rent to the pool (also frees one of your active lease slots immediately). ## What you sign (when paid) One mainnet USDC transfer of exactly `price_usdc` (or `extend_price_usdc`) to the 402's `payTo` address. It cannot move anything else from the wallet. When `free` is `true` in `/draft/v1/info`, nothing is signed. ## Lease terms & limits Current values live at `GET https://0tx.io/draft/v1/info`: - 0tx pays all devnet rent and fees and holds the upgrade authority for the lease. - When the lease expires, 0tx closes the program data and reclaims the rent; the closed program ID cannot be redeployed. - Your own test transactions calling the deployed program still need devnet SOL for fees—see `https://0tx.io/drip/llms.txt`. ## Allowed endpoints Everything is on `https://0tx.io`, under `/draft`: - `GET /draft`: the website - `GET /draft/llms.txt`: this file - `GET /draft/SKILL.md`: these instructions as an agent skill - `GET /draft/openapi.json`: machine-readable spec - `GET /draft/v1/info`: live pricing, limits and pool status - `POST /draft/v1/programs`: reserve a program ID - `GET /draft/v1/programs/:id`: poll status and deploy progress - `PUT /draft/v1/programs/:id`: upload `.so` to deploy or upgrade - `POST /draft/v1/programs/:id/extend`: extend an active lease - `DELETE /draft/v1/programs/:id`: close a lease early and return rent The rest of 0tx.io is the home page (`GET /`, `GET /llms.txt`) and sister tools drip (`/drip/llms.txt`), dry (`/dry/llms.txt`) and gas (`/gas/llms.txt`). Requests outside these may get your IP banned permanently; a single wrong path just returns a 404. ## Errors Every refusal on a paid route happens before your payment settles. Error responses carry `error`, `message` and `docs`. | HTTP | error | Meaning | |---|---|---| | 400 | invalid_json / invalid_body / invalid_max_bytes / empty_body / invalid_binary | Bad request body, invalid `max_bytes`, or uploaded bytes are not a valid Solana BPF/SBF ELF `.so` | | 401 | unauthorized | Missing or wrong `Authorization: Bearer ` | | 402 | (x402 challenge) | Payment required or invalid (when `price_usdc` > 0) | | 403 | banned / upload_limit | Payer/IP is blocked, or lease reached `max_uploads` | | 404 | not_found | No lease with that id, or unknown endpoint | | 409 | in_progress / deploy_in_progress / lease_expired / lease_closed / max_lease_reached | Payment settling, a deploy is already running, lease ended, or extending would exceed `max_extend_days` | | 413 | too_large | Binary exceeds the lease's `max_bytes` | | 429 | payer_limit / ip_limit / ip_daily_limit | Active lease limit (or daily free limit) reached. Close an unused lease with `DELETE` or wait | | 429 | (no JSON body) | Rate limited: more than 60 requests/min from your IP. Wait a minute | | 502 | payment_pending | Settlement outcome is unclear; retry with the same `PAYMENT-SIGNATURE` header later—never charged twice | | 503 | paused / out_of_stock / capacity_reached / payments_unavailable | Operator paused, devnet rent pool low, global active lease limit reached, or facilitator unavailable | ## Who runs this draft is built and run by @0sumTX (https://x.com/0sumTX). For problems, message @0sumTX on X with your lease `id` or `payment_tx`.