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

OptionRequiredDefaultDescription
--chain <chain>YesTarget chain name (e.g. sepolia, ethereum, base)
--skip-testsNoSkip running tests before deployment
--verifyNoVerify contracts on block explorer after deployment
--vercelNoDeploy frontend to Vercel after contract deployment

Supported Chains

Chain NameChain IDTier Required
sepolia11155111Free
base-sepolia84532Free
arbitrum-sepolia421614Free
polygon-amoy80002Free
optimism-sepolia11155420Free
ethereum1Pro
base8453Pro
arbitrum42161Pro
polygon137Pro
optimism10Pro

Required Environment Variables

Set these in a .env file or export them in your shell.

VariableDescription
{CHAIN}_RPC_URLRPC endpoint URL. Chain name is uppercased, dashes become underscores (e.g. SEPOLIA_RPC_URL, BASE_SEPOLIA_RPC_URL).
DEPLOYER_PRIVATE_KEYPrivate 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

TierAllowed Targets
FreeTestnets only (Sepolia, Base Sepolia, etc.)
ProAll chains including mainnets
EnterpriseAll 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