Network Setup
Setting up x402 on Avalanche C-Chain Mainnet and Fuji Testnet.
Avalanche Networks Overview
Avalanche provides two networks for x402 development:
| Network | Purpose | Chain ID | RPC URL |
|---|---|---|---|
| Mainnet | Production | 43114 | https://api.avax.network/ext/bc/C/rpc |
| Fuji Testnet | Development | 43113 | https://api.avax-test.network/ext/bc/C/rpc |
Fuji Testnet Setup
Step 1: Configure Network in Wallet
Add Fuji testnet to MetaMask or Core wallet:
// Network configuration
{
networkName: "Avalanche Fuji Testnet",
rpcUrl: "https://api.avax-test.network/ext/bc/C/rpc",
chainId: 43113,
symbol: "AVAX",
explorerUrl: "https://testnet.snowtrace.io/"
}Add Fuji to your wallet using the configuration above. Core Wallet has Fuji pre-configured.
Step 2: Get Test AVAX
Get free test AVAX for gas fees:
- Navigate to the Console Faucet
- Connect your wallet
- Request test AVAX
Step 3: Get Test USDC
Get free test USDC from Circle's official faucet:
- Visit https://faucet.circle.com/
- Select "Avalanche Fuji"
- Enter your wallet address
- Receive test USDC
Contract Addresses
Mainnet Addresses
const AVALANCHE_MAINNET = {
chainId: 43114,
rpc: "https://api.avax.network/ext/bc/C/rpc",
usdc: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
usdt: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
wavax: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"
};Fuji Testnet Addresses
const AVALANCHE_FUJI = {
chainId: 43113,
rpc: "https://api.avax-test.network/ext/bc/C/rpc",
usdc: "0x5425890298aed601595a70AB815c96711a31Bc65",
};Environment Configuration
For x402 development, configure your environment variables:
# .env file
AVALANCHE_RPC_FUJI=https://api.avax-test.network/ext/bc/C/rpc
USDC_FUJI=0x5425890298aed601595a70AB815c96711a31Bc65
PRIVATE_KEY=your_private_key_hereFor mainnet deployment, use:
AVALANCHE_RPC_MAINNET=https://api.avax.network/ext/bc/C/rpc
USDC_MAINNET=0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6ESummary
Setting up x402 on Avalanche Fuji testnet requires three steps: configure your wallet with Fuji network, get free test AVAX from Core Wallet console, and get free test USDC from Circle's faucet. With these resources, you're ready to integrate x402 facilitators and start building payment-enabled applications.
Is this guide helpful?
