# Quickstart for agents This page shows how to open an AI Proxy gate: a local SOCKS5 port whose traffic exits to the internet through a validator phone's mobile IP. ## 1. Fund the account The client pays from a wallet that holds a USDT deposit on the billing contract on Phase, plus a little PHASE for gas. On mainnet the token is `Bridged PHASE USDT` (symbol `USDT.e`), backed 1:1 by USDT: the bridge mints it only against USDT received at its deposit address, and the 10,000 USDT.e genesis supply is backed by a Phase Labs USDT reserve. The bridge is one-way for now: USDT.e cannot yet be withdrawn back to a source chain. `$PHASE_RPC` below is the Phase RPC: `https://rpc-main.phase.xyz`. Each package has a base price of 0.5 USDT, so even a short session is charged at least 0.5 USDT. Approve the billing contract (`ProxyBilling`, `0x0000000000000000000000000000000000000090`) to spend your USDT, deposit, and check the balance (amounts in 6-decimal units; 2000000 = 2 USDT): ```bash cast send 0x0000000000000000000000000000000000000091 "approve(address,uint256)" 0x0000000000000000000000000000000000000090 2000000 --private-key $KEY --rpc-url $PHASE_RPC cast send 0x0000000000000000000000000000000000000090 "deposit(uint256)" 2000000 --private-key $KEY --rpc-url $PHASE_RPC cast call 0x0000000000000000000000000000000000000090 "balanceOf(address)(uint256)" --rpc-url $PHASE_RPC ``` To withdraw the rest, close the gate first, then call `requestWithdrawal(uint256)` on the billing contract; it is approved once it has been pending for two settlement ticks with no session open (about 10–15 minutes at the default 5-minute tick). On mainnet, if it is not approved within 7 days, call `claimWithdrawal()`. - [Bridge USDT](bridge.md) — USDT - [Get PHASE](get-phase.md) — GAS ## 2. Configure The skill is four files. Put them in one directory and make the scripts executable: ```bash mkdir -p phase-ai-proxy/scripts && cd phase-ai-proxy for f in SKILL.md scripts/setup.sh scripts/open-gate.sh scripts/close-gate.sh; do curl -fsSL -o "$f" "https://phase.xyz/docs/skills/phase-ai-proxy/$f" done chmod +x scripts/*.sh ``` On first use `open-gate.sh` downloads the `iroh-proxy` client for macOS (Apple silicon, Intel) or Linux (x86_64, arm64) from `https://phase.xyz/downloads/iroh-proxy/` and checks its SHA-256 against the published `SHA256SUMS`. Run `setup.sh` in your terminal. It prompts for the billing URL (default `https://billing.phase.xyz`, the Phase mainnet billing service) and, at a hidden prompt, for the private key of the wallet that holds the USDT deposit, and writes them to `config.env` (chmod 600). ```bash ./setup.sh ``` `setup.sh` refuses to overwrite an existing `config.env` unless `--force`. > **Warning:** Do not put the private key on the command line or into a chat: it ends up in shell history, the process list or a transcript. Note that `open-gate.sh` currently passes the key to the client as a command-line argument, so it is visible in the process list of your machine while the gate is open. ## 3. Open the gate Run `open-gate.sh`. It starts the client, waits until the local SOCKS5 port is listening and prints: ```text GATE_ENDPOINT=socks5h://127.0.0.1:1080 GATE_PID=12345 GATE_LOG=/tmp/iroh-proxy-gate/gate.log ``` To use a different billing URL for one run, set `IROH_PROXY_BILLING_URL=`; the key stays in `config.env`. ```bash IROH_PROXY_BILLING_URL= ./open-gate.sh ``` The launcher reports readiness when the local SOCKS5 port is listening; the tunnel to an exit may still be connecting. The real readiness test is the ipify check below. If the process dies during startup, the launcher dumps the log and exits non-zero. ## 4. Check and use it Route your traffic through `GATE_ENDPOINT`. Use the `socks5h://` scheme (the `h`) so DNS is resolved on the proxy side, not locally: ```bash curl -x socks5h://127.0.0.1:1080 https://api.ipify.org # returns the exit node's IP curl -x socks5h://127.0.0.1:1080 https://example.com ``` The most reliable liveness check is that `curl` to api.ipify.org: if it returns the exit node's IP (not your local one), the gate works. ## 5. Close the gate Run `close-gate.sh`. Traffic through the gate is charged, and a withdrawal is not approved while a session is open. ```bash ./close-gate.sh ``` Optional variables: | Variable | Purpose | Default | |---|---|---| | `IROH_PROXY_LISTEN` | local SOCKS5 address | `127.0.0.1:1080` | | `IROH_PROXY_CONFIG` | path to config.env with defaults | `config.env` in the directory above `scripts/` | | `IROH_PROXY_BIN` | explicit binary path (bypasses auto-discovery) | — | | `RUST_LOG` | iroh-proxy log level | `info` | Billing is mandatory: every exit runs the billing protocol, so there is no free relay to fall back to and no way to pin an exit by node id. For agents, the same steps are published as the `phase-ai-proxy` skill. - [phase-ai-proxy skill](../skills/phase-ai-proxy/SKILL.md) — SKILL