w3m deploy
Deploy contracts to a target chain. This command builds, tests, runs a preflight check, deploys via Foundry, writes deployment artifacts, and optionally deploys the frontend to Vercel.
w3m deploy --chain <chain>Requires authentication via w3m auth.
For local deployment (Anvil), use the workspace menu instead: run w3m, then select “Deploy” > “Local (Anvil)”. Local deployment does not require authentication.
Options
| Option | Required | Default | Description |
|---|---|---|---|
--chain <chain> | Yes | Target chain name (e.g. sepolia, ethereum, base) | |
--skip-tests | No | Skip running tests before deployment | |
--verify | No | Verify contracts on block explorer after deployment | |
--vercel | No | Deploy frontend to Vercel after contract deployment |
Supported Chains
| Chain Name | Chain ID | Tier Required |
|---|---|---|
sepolia | 11155111 | Free |
base-sepolia | 84532 | Free |
arbitrum-sepolia | 421614 | Free |
polygon-amoy | 80002 | Free |
optimism-sepolia | 11155420 | Free |
ethereum | 1 | Pro |
base | 8453 | Pro |
arbitrum | 42161 | Pro |
polygon | 137 | Pro |
optimism | 10 | Pro |
Required Environment Variables
Set these in a .env file or export them in your shell.
| Variable | Description |
|---|---|
{CHAIN}_RPC_URL | RPC endpoint URL. Chain name is uppercased, dashes become underscores (e.g. SEPOLIA_RPC_URL, BASE_SEPOLIA_RPC_URL). |
DEPLOYER_PRIVATE_KEY | Private key of the deployer wallet. |
Never commit your DEPLOYER_PRIVATE_KEY to version control. Use a .env file that is listed in .gitignore.
Deployment Process
Authentication
Validates your API key. Run w3m auth <key> first if you have not authenticated.
API Preflight Check
Calls the API to check that your tier allows deployment to the target chain. Free tier users cannot deploy to mainnets.
Validate Environment Variables
Checks that {CHAIN}_RPC_URL and DEPLOYER_PRIVATE_KEY are set.
Build Contracts
Runs forge build in the contracts/ directory.
Run Tests
Runs forge test (unless --skip-tests). If any test fails, deployment is aborted.
Deploy via Forge Script
Deploys contracts by running forge script with --broadcast.
Write Deployment Artifacts
Saves contract addresses and metadata to deployments/{chainId}.json.
Register Deployment
Reports the deployment to the Web3 Market API for analytics.
Run Codegen
Regenerates TypeScript bindings with the new deployment addresses.
Vercel Deployment (optional)
If --vercel is passed, deploys the frontend to Vercel.
Tier Enforcement
| Tier | Allowed Targets |
|---|---|
| Free | Testnets only (Sepolia, Base Sepolia, etc.) |
| Pro | All chains including mainnets |
| Enterprise | All chains |
Examples
# Deploy to Sepolia testnet
w3m deploy --chain sepolia
# Deploy to Base mainnet with contract verification
w3m deploy --chain base --verify
# Deploy and also deploy frontend to Vercel
w3m deploy --chain ethereum --verify --vercel
# Quick deploy, skipping tests
w3m deploy --chain sepolia --skip-tests