---
name: solana-draft
description: Deploy and upgrade Solana programs on devnet without holding devnet SOL via 0tx.io/draft. Use when deploying a Solana/Anchor program to devnet fails for lack of SOL or airdrop rate limits.
---

# Deploy Solana programs to devnet without SOL via 0tx.io/draft

Deploying a Solana program to devnet locks several SOL of rent. draft fronts the rent from a recycled devnet pool and leases you a program ID with free in-place upgrades. No account, no API key.

**Check live pricing & limits first**: `GET https://0tx.io/draft/v1/info` (`free`, `price_usdc`, `limits`, `pool.in_stock`).

**Deploy in 4 calls**
1. **Reserve**: `POST https://0tx.io/draft/v1/programs` with JSON `{"max_bytes": 262144}` (or `{}` for the default max). If `free` is `true`, you get `201 Created` immediately. If HTTP 402 is returned, pay with any x402 V2 Solana mainnet USDC client (`@x402/fetch` + `@x402/svm`) and retry. Save `id`, `program_id`, and `lease_secret`.
2. **Build**: Set `declare_id!("<program_id>")` (and `Anchor.toml` if using Anchor), then run `anchor build` or `cargo build-sbf` to produce `target/deploy/<name>.so`.
3. **Upload**: `PUT https://0tx.io/draft/v1/programs/<id>` with `Authorization: Bearer <lease_secret>`, `Content-Type: application/octet-stream`, and the raw `.so` bytes. Returns `202 Accepted`. Upload again anytime during the lease to upgrade in place.
4. **Poll**: `GET https://0tx.io/draft/v1/programs/<id>` every few seconds until `status` is `deployed` (or `failed`). Check `bytes_written` / `binary_bytes` while `deploying`, and `last_deploy_tx` once `deployed`.

**Lifecycle**
- Failed uploads do not consume an upload slot; if `retryable` is `true`, upload again (buffer writes resume). If `retryable` is `false`, fix and rebuild the program first.
- **Extend**: `POST https://0tx.io/draft/v1/programs/<id>/extend` with `Authorization: Bearer <lease_secret>` (plus x402 if `extend_price_usdc` > 0).
- **Close early**: `DELETE https://0tx.io/draft/v1/programs/<id>` with `Authorization: Bearer <lease_secret>` to reclaim rent and free an active lease slot.
- Your own test transactions calling the deployed program still need devnet SOL for fees: see `https://0tx.io/drip/llms.txt`.

**Refusals & retries**: Paid refusals happen before settlement (never charged). On 502 `payment_pending`, retry with the exact same `PAYMENT-SIGNATURE` header; you will never be charged twice and replay returns the same `lease_secret`.

Allowed endpoints on `https://0tx.io`: `GET /draft`, `/draft/llms.txt`, `/draft/SKILL.md`, `/draft/openapi.json`, `/draft/v1/info`, `POST /draft/v1/programs`, `GET/PUT/DELETE /draft/v1/programs/:id`, `POST /draft/v1/programs/:id/extend`, plus `/`, `/llms.txt`, `/drip/llms.txt`, `/dry/llms.txt`, `/gas/llms.txt`. Requests outside these may get your IP banned.

Run by @0sumTX (https://x.com/0sumTX). Full instructions & error table: https://0tx.io/draft/llms.txt
