Index of every page on this site: llms.txt
All skills
base avatar

/build-on-base

@ef8bcd5 official
by basebase/skills120 stars
130
Run it yourself

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) Agent registration — trading bots, AI agents, automated senders, ERC-8021 attribution wiring, base.dev API, register agent, builder code registration; (5) Node operation — run Base node, Reth setup, hardware requirements, self-hosted RPC, sync.

Use this Skill: https://skilld.dev/gh/base/skills/build-on-base

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesdeploy-contracts.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Deploying Contracts on Base

Prerequisites

  1. Configure RPC endpoint (testnet: sepolia.base.org, mainnet: mainnet.base.org)
  2. Store private keys in Foundry's encrypted keystore — never commit keys
  3. Obtain testnet ETH from CDP faucet (testnet only)
  4. Get a BaseScan API key for contract verification

Security

  • Never commit private keys to version control — use Foundry's encrypted keystore (cast wallet import)
  • Never hardcode API keys in source files — use environment variables or foundry.toml with ${ENV_VAR} references
  • Never expose .env files — add .env to .gitignore
  • Use production RPC providers (not public endpoints) for mainnet deployments to avoid rate limits and data leaks
  • Verify contracts on BaseScan to enable public audit of deployed code

Input Validation

Before constructing shell commands, validate all user-provided values:

  • contract-path: Must match ^[a-zA-Z0-9_/.-]+\.sol:[a-zA-Z0-9_]+$. Reject paths with spaces, semicolons, pipes, or backticks.
  • rpc-url: Must be a valid HTTPS URL (^https://[^\s;|&]+$). Reject non-HTTPS or malformed URLs.
  • keystore-account: Must be alphanumeric with hyphens/underscores (^[a-zA-Z0-9_-]+$).
  • etherscan-api-key: Must be alphanumeric (^[a-zA-Z0-9]+$).

Do not pass unvalidated user input into shell commands.

Obtaining Testnet ETH via CDP Faucet

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.

Option A: CDP Portal UI (recommended for quick setup)

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.

  1. Sign in to CDP Portal (create an account at portal.cdp.coinbase.com/create-account if needed)
  2. Go to Faucets
  3. Select Base Sepolia network
  4. Select ETH token
  5. Enter the wallet address and click Claim
  6. Verify on sepolia.basescan.org that the funds arrived

Option B: Programmatic via CDP SDK

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.

Obtaining a BaseScan API Key

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.

  1. Go to basescan.org/myapikey (or etherscan.io/myapikey — same account works)
  2. Sign in or create a free account
  3. Click Add to create a new API key
  4. Copy the key and set it in your environment:
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" }

Deployment Commands

Testnet

forge create src/MyContract.sol:MyContract \
  --rpc-url https://sepolia.base.org \
  --account <keystore-account> \
  --verify \
  --etherscan-api-key $ETHERSCAN_API_KEY

Mainnet

forge create src/MyContract.sol:MyContract \
  --rpc-url https://mainnet.base.org \
  --account <keystore-account> \
  --verify \
  --etherscan-api-key $ETHERSCAN_API_KEY

Key Notes

  • Contract format: <contract-path>:<contract-name>
  • --verify flag auto-verifies on BaseScan (requires API key)
  • Explorers: basescan.org (mainnet), sepolia.basescan.org (testnet)
  • CDP Faucet docs: docs.cdp.coinbase.com/faucets

Common Issues

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

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill is a development playbook for the Base network that includes scripts for project analysis and wallet registration. It contains behavioral instructions that guide the agent through specific workflows and set mandatory rules for transaction attribution.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at ef8bcd5. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated last month
  • base
  • l2
  • ethereum
  • smart-contracts
  • foundry
  • wagmi
  • viem
  • wallet-auth
  • payments
  • usdc
  • erc-8021
  • basescan
  • node-operation

README badge

README badge for base/skills/build-on-base

Instructs Claude to deploy and build applications on Base L2, covering network setup (RPC/chain IDs), contract deployment with Foundry, wallet authentication via Base Account SDK, USDC payments, ERC-8021 builder code attribution, and migrations from OnchainKit or Farcaster MiniKit. Includes safety guardrails for private keys, payment verification, and transaction attribution.

Generated from the current SKILL.md.

Does this skill cover both Base Mainnet and testnet setup?
Yes. It includes network configuration for Base Mainnet (chain ID 8453) and Base Sepolia testnet (84532), with RPC URLs, explorer config, and testnet ETH faucet setup.
What contract deployment tools does this skill use?
Foundry — specifically `forge create` for deployment and BaseScan verification. It does not cover Hardhat or other frameworks.
Does this skill include payment and wallet authentication?
Yes. It covers Base Account SDK for Sign in with Base (SIWB), Base Pay for USDC transactions, gasless payments, paymasters, and sub-accounts with spend permissions.
Can this skill help migrate from OnchainKit?
Yes. It includes step-by-step migration paths from OnchainKit to wagmi, and separate guides for migrating MiniKit to Farcaster SDK and converting Farcaster miniapps to regular Base apps.
Does this skill cover AI agent and trading bot registration?
Yes. It includes agent registration with ERC-8021 attribution wiring, builder code registration, and base.dev API integration for automated senders and trading bots.

Generated from the current SKILL.md. These answers refresh after source changes.