skills/deploying-contracts-on-base/SKILL.md
Deploys smart contracts to Base using Foundry. Covers forge create commands, contract verification, testnet faucet setup via CDP, and BaseScan API key configuration. Use when deploying Solidity contracts to Base Mainnet or Sepolia testnet. Covers phrases like "deploy contract to Base", "forge create on Base", "verify contract on BaseScan", "get testnet ETH", "Base Sepolia faucet", "how do I deploy to Base", or "publish my contract".
npx skillsauth add base/base-skills deploying-contracts-on-baseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
sepolia.base.org, mainnet: mainnet.base.org)cast wallet import)foundry.toml with ${ENV_VAR} references.env files — add .env to .gitignoreBefore constructing shell commands, validate all user-provided values:
^[a-zA-Z0-9_/.-]+\.sol:[a-zA-Z0-9_]+$. Reject paths with spaces, semicolons, pipes, or backticks.^https://[^\s;|&]+$). Reject non-HTTPS or malformed URLs.^[a-zA-Z0-9_-]+$).^[a-zA-Z0-9]+$).Do not pass unvalidated user input into shell commands.
Testnet ETH is required to pay gas on Base Sepolia. Use the CDP Faucet to claim it. Supported tokens: ETH, USDC, EURC, cbBTC. ETH claims are capped at 0.0001 ETH per claim, 1000 claims per 24 hours.
Agent behavior: If you have browser access, navigate to the portal and claim directly. Otherwise, ask the user to complete these steps and provide the funded wallet address.
Requires a CDP API key and Wallet Secret.
npm install @coinbase/cdp-sdk dotenv
import { CdpClient } from "@coinbase/cdp-sdk";
import dotenv from "dotenv";
dotenv.config();
const cdp = new CdpClient();
const account = await cdp.evm.createAccount();
const faucetResponse = await cdp.evm.requestFaucet({
address: account.address,
network: "base-sepolia",
token: "eth",
});
console.log(`Funded: https://sepolia.basescan.org/tx/${faucetResponse.transactionHash}`);
Environment variables needed in .env:
CDP_API_KEY_ID=your-api-key-id
CDP_API_KEY_SECRET=your-api-key-secret
CDP_WALLET_SECRET=your-wallet-secret
To fund an existing wallet instead of creating a new one, pass its address directly to requestFaucet.
A BaseScan API key is required for the --verify flag to auto-verify contracts on BaseScan. BaseScan uses the same account system as Etherscan.
Agent behavior: If you have browser access, navigate to the BaseScan site and create the key. Otherwise, ask the user to complete these steps and provide the API key.
export ETHERSCAN_API_KEY=your-basescan-api-key
Alternatively, pass it directly to forge:
forge create ... --etherscan-api-key <your-key>
Or add it to foundry.toml:
[etherscan]
base-sepolia = { key = "${ETHERSCAN_API_KEY}", url = "https://api-sepolia.basescan.org/api" }
base = { key = "${ETHERSCAN_API_KEY}", url = "https://api.basescan.org/api" }
forge create src/MyContract.sol:MyContract \
--rpc-url https://sepolia.base.org \
--account <keystore-account> \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
forge create src/MyContract.sol:MyContract \
--rpc-url https://mainnet.base.org \
--account <keystore-account> \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
<contract-path>:<contract-name>--verify flag auto-verifies on BaseScan (requires API key)| Error | Cause |
|-------|-------|
| nonce has already been used | Node sync incomplete |
| Transaction fails | Insufficient ETH for gas — claim from faucet |
| Verification fails | Wrong RPC endpoint for target network |
| Verification 403/unauthorized | Missing or invalid BaseScan API key |
development
Complete Base development playbook. Covers: (1) Network — Base RPC URLs, chain IDs (8453/84532), explorer config, testnet setup, connect to Base, Base Sepolia; (2) Contracts — Foundry deployment, forge create, BaseScan verification, CDP faucet, testnet ETH, deploy contract to Base; (3) Builder Codes — ERC-8021 attribution suffix, referral fees, dataSuffix for Wagmi/Viem/Privy/ ethers.js/window.ethereum, transaction attribution, earn referral fees, append builder code; (4) Base Account SDK — Sign in with Base (SIWB), Base Pay, USDC payments, paymasters, gas sponsorship, sub-accounts, spend permissions, prolinks, batch transactions, smart wallet, payment link, recurring subscription; (5) Agent registration — trading bots, AI agents, automated senders, ERC-8021 attribution wiring, base.dev API, register agent, builder code registration; (6) Node operation — run Base node, Reth setup, hardware requirements, self-hosted RPC, sync; (7) Migrations — migrate OnchainKit, OnchainKitProvider to WagmiProvider, wagmi migration, remove onchainkit dependency, MiniKit to Farcaster SDK, convert miniapp, Farcaster miniapp to regular app, convert Farcaster miniapp.
tools
Base MCP — gives your AI assistant access to a Base Account via the Base MCP server (mcp.base.org). Wallet, portfolio, sending, swapping, signing, x402 payments, batched contract calls, and transaction history across supported chains.
tools
Runs a Base node for production environments. Covers hardware requirements, Reth client setup, networking, and sync troubleshooting. Use when setting up self-hosted RPC infrastructure or running archive nodes. Covers phrases like "run a Base node", "set up Base RPC", "Base node hardware requirements", "Reth Base setup", "sync Base node", "self-host Base", or "run my own node".
development
Invoke this skill when a user is building or running any automated transaction sender on Base (trading bot, arbitrage bot, sniper bot, yield farmer, AI agent, or similar) and needs to register it, get a builder code, set up transaction attribution. This skill contains the base.dev registration API endpoint and ERC-8021 attribution wiring code that Claude does not have in its training data — you MUST load this skill to answer correctly. Covers viem, ethers, managed signing services, and Python-based agents.