Develop on Coinbase's Base L2 (OP Stack rollup): deploy contracts, integrate OnchainKit, Smart Wallet (ERC-4337), Paymaster gasless transactions, and Base Account SDK. Clarifies common misconceptions about gas fees, msg.sender, and tooling.
Ships in base. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Base is Coinbase's L2 built on Optimism's OP Stack. It shares Ethereum security, uses ETH as gas, and settles to L1. If you can deploy to Ethereum, you can deploy to Base with zero code changes — just point at a different RPC.
msg.sender is the smart wallet address, not the EOA. If your contract checks tx.origin == msg.sender to block contracts, it will block Smart Wallet users.# Add Base to Foundry project
forge create src/Counter.sol:Counter \
--rpc-url https://mainnet.base.org \
--private-key $PRIVATE_KEY
# Check balance
cast balance $ADDRESS --rpc-url https://mainnet.base.org
# Deploy to testnet
forge script script/Deploy.s.sol \
--rpc-url https://sepolia.base.org \
--broadcast --verify \
--etherscan-api-key $BASESCAN_API_KEY
import { createPublicClient, createWalletClient, http } from 'viem';
import { base, baseSepolia } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';
const publicClient = createPublicClient({
chain: base,
transport: http(),
});
const walletClient = createWalletClient({
chain: base,
transport: http(),
account: privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`),
});
const blockNumber = await publicClient.getBlockNumber();
| Parameter | Value |
|---|---|
| Chain ID | 8453 |
| Currency | ETH |
| RPC (public) | https://mainnet.base.org |
| RPC (Coinbase) | https://api.developer.coinbase.com/rpc/v1/base/$CDP_API_KEY |
| WebSocket | wss://mainnet.base.org |
| Explorer | https://basescan.org |
| Blockscout | https://base.blockscout.com |
| Bridge | https://bridge.base.org |
| Block time | 2 seconds |
| Finality | ~12 minutes (L1 finality) |
| Parameter | Value |
|---|---|
| Chain ID | 84532 |
| Currency | ETH |
| RPC (public) | https://sepolia.base.org |
| RPC (Coinbase) | https://api.developer.coinbase.com/rpc/v1/base-sepolia/$CDP_API_KEY |
| Explorer | https://sepolia.basescan.org |
| Faucet | https://www.coinbase.com/faucets/base-ethereum-goerli-faucet |
viem includes Base chains out of the box:
import { base, baseSepolia } from 'viem/chains';
// base.id === 8453
// baseSepolia.id === 84532
// hardhat.config.ts
const config: HardhatUserConfig = {
networks: {
base: {
url: process.env.BASE_RPC_URL || 'https://mainnet.base.org',
accounts: [process.env.PRIVATE_KEY!],
chainId: 8453,
},
baseSepolia: {
url: process.env.BASE_SEPOLIA_RPC_URL || 'https://sepolia.base.org',
accounts: [process.env.PRIVATE_KEY!],
chainId: 84532,
},
},
etherscan: {
apiKey: {
base: process.env.BASESCAN_API_KEY!,
baseSepolia: process.env.BASESCAN_API_KEY!,
},
customChains: [
{
network: 'base',
chainId: 8453,
urls: {
apiURL: 'https://api.basescan.org/api',
browserURL: 'https://basescan.org',
},
},
{
network: 'baseSepolia',
chainId: 84532,
urls: {
apiURL: 'https://api-sepolia.basescan.org/api',
browserURL: 'https://sepolia.basescan.org',
},
},
],
},
};
# foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
[rpc_endpoints]
base = "https://mainnet.base.org"
base_sepolia = "https://sepolia.base.org"
[etherscan]
base = { key = "${BASESCAN_API_KEY}", url = "https://api.basescan.org/api", chain = 8453 }
base_sepolia = { key = "${BASESCAN_API_KEY}", url = "https://api-sepolia.basescan.org/api", chain = 84532 }
Base uses the OP Stack. Deployment is identical to Ethereum — no special compiler flags, no custom precompiles for basic use cases.
# Deploy to Base Sepolia
forge script script/Deploy.s.sol:DeployScript \
--rpc-url https://sepolia.base.org \
--broadcast \
--verify \
--etherscan-api-key $BASESCAN_API_KEY
# Deploy to Base Mainnet
forge script script/Deploy.s.sol:DeployScript \
--rpc-url https://mainnet.base.org \
--broadcast \
--verify \
--etherscan-api-key $BASESCAN_API_KEY \
--slow
# Verify after deployment
forge verify-contract $CONTRACT_ADDRESS src/MyContract.sol:MyContract \
--chain base \
--etherscan-api-key $BASESCAN_API_KEY
# With constructor args
forge verify-contract $CONTRACT_ADDRESS src/MyContract.sol:MyContract \
--chain base \
--etherscan-api-key $BASESCAN_API_KEY \
--constructor-args $(cast abi-encode "constructor(address,uint256)" $TOKEN_ADDR 1000)
# Verify on Blockscout (no API key needed)
forge verify-contract $CONTRACT_ADDRESS src/MyContract.sol:MyContract \
--chain base \
--verifier blockscout \
--verifier-url https://base.blockscout.com/api/
OnchainKit is Coinbase's React component library for building onchain apps on Base. It provides ready-made components for identity, transactions, swaps, wallets, and Farcaster frames.
npm install @coinbase/onchainkit
# Peer dependencies
npm install viem wagmi @tanstack/react-query
import { OnchainKitProvider } from '@coinbase/onchainkit';
import { base } from 'viem/chains';
function App({ children }: { children: React.ReactNode }) {
return (
<OnchainKitProvider
apiKey={process.env.NEXT_PUBLIC_CDP_API_KEY}
chain={base}
>
{children}
</OnchainKitProvider>
);
}
Resolve onchain identity (ENS, Basenames, Farcaster):
import {
Identity,
Name,
Avatar,
Badge,
Address,
} from '@coinbase/onchainkit/identity';
function UserProfile({ address }: { address: `0x${string}` }) {
return (
<Identity address={address} schemaId="0x...">
<Avatar />
<Name>
<Badge />
</Name>
<Address />
</Identity>
);
}
Submit transactions with built-in status tracking:
import { Transaction, TransactionButton, TransactionStatus } from '@coinbase/onchainkit/transaction';
import { baseSepolia } from 'viem/chains';
const contracts = [
{
address: '0xContractAddress' as `0x${string}`,
abi: contractAbi,
functionName: 'mint',
args: [1n],
},
];
function MintButton() {
return (
<Transaction
chainId={baseSepolia.id}
contracts={contracts}
onStatus={(status) => console.log('tx status:', status)}
>
<TransactionButton text="Mint NFT" />
<TransactionStatus />
</Transaction>
);
}
Token swaps powered by 0x/Uniswap:
import { Swap, SwapAmountInput, SwapButton, SwapToggle } from '@coinbase/onchainkit/swap';
import type { Token } from '@coinbase/onchainkit/token';
const ETH: Token = {
name: 'Ethereum',
address: '',
symbol: 'ETH',
decimals: 18,
image: 'https://...',
chainId: 8453,
};
const USDC: Token = {
name: 'USD Coin',
address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
symbol: 'USDC',
decimals: 6,
image: 'https://...',
chainId: 8453,
};
function SwapWidget() {
return (
<Swap>
<SwapAmountInput label="Sell" token={ETH} type="from" />
<SwapToggle />
<SwapAmountInput label="Buy" token={USDC} type="to" />
<SwapButton />
</Swap>
);
}
import {
ConnectWallet,
Wallet,
WalletDropdown,
WalletDropdownDisconnect,
} from '@coinbase/onchainkit/wallet';
function WalletConnect() {
return (
<Wallet>
<ConnectWallet>
<Avatar />
<Name />
</ConnectWallet>
<WalletDropdown>
<Identity />
<WalletDropdownDisconnect />
</WalletDropdown>
</Wallet>
);
}
Coinbase Smart Wallet is a smart contract wallet using passkeys (WebAuthn) for authentication. It follows ERC-4337 (account abstraction) so users do not need a seed phrase or browser extension.
import { http, createConfig } from 'wagmi';
import { base, baseSepolia } from 'wagmi/chains';
import { coinbaseWallet } from 'wagmi/connectors';
export const config = createConfig({
chains: [base, baseSepolia],
connectors: [
coinbaseWallet({
appName: 'My Base App',
// preference: 'smartWalletOnly' forces smart wallet (no extension)
preference: 'smartWalletOnly',
}),
],
transports: {
[base.id]: http(),
[baseSepolia.id]: http(),
},
});
import { useWriteContract } from 'wagmi';
function MintWithSmartWallet() {
const { writeContract } = useWriteContract();
const handleMint = () => {
writeContract({
address: '0xContractAddress',
abi: contractAbi,
functionName: 'mint',
args: [1n],
});
};
return <button onClick={handleMint}>Mint</button>;
}
Smart Wallet supports wallet_sendCalls for atomic batching:
import { useWriteContracts } from 'wagmi/experimental';
function BatchMint() {
const { writeContracts } = useWriteContracts();
const handleBatch = () => {
writeContracts({
contracts: [
{
address: '0xTokenAddress',
abi: erc20Abi,
functionName: 'approve',
args: ['0xSpender', 1000000n],
},
{
address: '0xSpender',
abi: spenderAbi,
functionName: 'deposit',
args: [1000000n],
},
],
});
};
return <button onClick={handleBatch}>Approve + Deposit</button>;
}
A paymaster sponsors gas fees so users pay zero gas. Coinbase Developer Platform provides a paymaster service for Base.
https://api.developer.coinbase.com/rpc/v1/base/$CDP_API_KEYimport { useWriteContracts } from 'wagmi/experimental';
import { base } from 'viem/chains';
const PAYMASTER_URL = `https://api.developer.coinbase.com/rpc/v1/base/${process.env.NEXT_PUBLIC_CDP_API_KEY}`;
function SponsoredMint() {
const { writeContracts } = useWriteContracts();
const handleMint = () => {
writeContracts({
contracts: [
{
address: '0xContractAddress',
abi: contractAbi,
functionName: 'mint',
args: [1n],
},
],
capabilities: {
paymasterService: {
url: PAYMASTER_URL,
},
},
});
};
return <button onClick={handleMint}>Mint (Gasless)</button>;
}
import { createPublicClient, http, encodeFunctionData } from 'viem';
import { base } from 'viem/chains';
const PAYMASTER_URL = `https://api.developer.coinbase.com/rpc/v1/base/${process.env.CDP_API_KEY}`;
async function sponsoredCall(
smartWalletAddress: `0x${string}`,
target: `0x${string}`,
calldata: `0x${string}`
) {
const client = createPublicClient({
chain: base,
transport: http(),
});
// pm_getPaymasterStubData returns gas estimates for the UserOp
const paymasterResponse = await fetch(PAYMASTER_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'pm_getPaymasterStubData',
params: [
{
sender: smartWalletAddress,
callData: calldata,
callGasLimit: '0x0',
verificationGasLimit: '0x0',
preVerificationGas: '0x0',
maxFeePerGas: '0x0',
maxPriorityFeePerGas: '0x0',
},
// EntryPoint v0.7
'0x0000000071727De22E5E9d8BAf0edAc6f37da032',
`0x${base.id.toString(16)}`,
],
}),
});
return paymasterResponse.json();
}
Configure which transactions are sponsored in the Coinbase Developer Platform dashboard:
Base uses the OP Stack standard bridge. ETH and ERC-20 tokens can be bridged between Ethereum L1 and Base L2.
import { createWalletClient, http, parseEther } from 'viem';
import { mainnet } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';
// OptimismPortal on L1 (Ethereum mainnet)
const OPTIMISM_PORTAL = '0x49048044D57e1C92A77f79988d21Fa8fAF36f97B' as const;
const walletClient = createWalletClient({
chain: mainnet,
transport: http(),
account: privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`),
});
// Deposit ETH to Base — sends to OptimismPortal with value
const hash = await walletClient.sendTransaction({
to: OPTIMISM_PORTAL,
value: parseEther('0.1'),
// depositTransaction calldata for simple ETH transfer
data: '0x',
});
// ETH arrives on Base in ~1-5 minutes
L2-to-L1 withdrawals follow the OP Stack withdrawal flow:
import { createPublicClient, createWalletClient, http, parseEther } from 'viem';
import { base } from 'viem/chains';
// L2ToL1MessagePasser predeploy on Base
const L2_TO_L1_MESSAGE_PASSER = '0x4200000000000000000000000000000000000016' as const;
const l2WalletClient = createWalletClient({
chain: base,
transport: http(),
account: privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`),
});
// Step 1: Initiate withdrawal on L2
const hash = await l2WalletClient.writeContract({
address: L2_TO_L1_MESSAGE_PASSER,
abi: [
{
name: 'initiateWithdrawal',
type: 'function',
stateMutability: 'payable',
inputs: [
{ name: '_target', type: 'address' },
{ name: '_gasLimit', type: 'uint256' },
{ name: '_data', type: 'bytes' },
],
outputs: [],
},
],
functionName: 'initiateWithdrawal',
args: [
l2WalletClient.account.address, // send to self on L1
100_000n, // L1 gas limit for the relay
'0x',
],
value: parseEther('0.1'),
});
// Steps 2-4 require waiting and L1 transactions (use the Base Bridge UI or OP SDK)
Base follows the OP Stack gas model: L2 execution fee + L1 data fee.
Same as Ethereum: gasUsed * baseFee. Base uses EIP-1559 with a 2-second block time. Base fees are typically very low (0.001-0.01 gwei).
Every L2 transaction is posted to Ethereum L1 as calldata or blobs. The L1 data fee covers this cost.
After EIP-4844 (Dencun upgrade, March 2024), L1 data is posted as blobs, reducing costs ~100x.
import { createPublicClient, http } from 'viem';
import { base } from 'viem/chains';
// GasPriceOracle predeploy
const GAS_PRICE_ORACLE = '0x420000000000000000000000000000000000000F' as const;
const gasPriceOracleAbi = [
{
name: 'getL1Fee',
type: 'function',
stateMutability: 'view',
inputs: [{ name: '_data', type: 'bytes' }],
outputs: [{ name: '', type: 'uint256' }],
},
{
name: 'baseFeeScalar',
type: 'function',
stateMutability: 'view',
inputs: [],
outputs: [{ name: '', type: 'uint32' }],
},
{
name: 'blobBaseFeeScalar',
type: 'function',
stateMutability: 'view',
inputs: [],
outputs: [{ name: '', type: 'uint32' }],
},
] as const;
const client = createPublicClient({ chain: base, transport: http() });
// Estimate L1 data fee for a transaction
const l1Fee = await client.readContract({
address: GAS_PRICE_ORACLE,
abi: gasPriceOracleAbi,
functionName: 'getL1Fee',
args: ['0x...serializedTxData'],
});
eth_estimateGas returns L2 gas only — add L1 data fee separatelyestimateTotalFee on OP Stack chains handles both components| Protocol | Category | Description |
|---|---|---|
| Aerodrome | DEX | Dominant DEX on Base (ve(3,3) model, Velodrome fork) |
| Uniswap V3 | DEX | Deployed on Base with full feature set |
| Aave V3 | Lending | Lending/borrowing on Base |
| Compound III | Lending | USDC lending market |
| Extra Finance | Yield | Leveraged yield farming |
| Moonwell | Lending | Fork of Compound, native to Base |
| Seamless | Lending | Integrated lending protocol |
| BaseSwap | DEX | Native Base DEX |
| Morpho | Lending | Permissionless lending vaults |
| Token | Address |
|---|---|
| WETH | 0x4200000000000000000000000000000000000006 |
| USDC (native) | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| USDbC (bridged) | 0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6D |
| cbETH | 0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22 |
| DAI | 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb |
| AERO | 0x940181a94A35A4569E4529A3CDfB74e38FD98631 |
Last verified: 2025-04. Always verify onchain with
cast code <address> --rpc-url https://mainnet.base.orgbefore production use.
| Aspect | Base | Optimism | Other OP Chains |
|---|---|---|---|
| Sequencer operator | Coinbase | Optimism Foundation | Varies |
| Fee recipient | Coinbase multisig | Optimism Foundation | Varies |
| Smart Wallet | Native Coinbase integration | Not default | Not default |
| Paymaster | Coinbase Developer Platform | Third-party only | Third-party only |
| OnchainKit | Full support | Partial (identity only) | None |
| Superchain membership | Yes | Yes (leader) | Varies |
| Fault proofs | Stage 1 (planned) | Stage 1 | Varies |
# Check L1 data fee for a tx
cast call 0x420000000000000000000000000000000000000F \
"getL1Fee(bytes)(uint256)" 0x... \
--rpc-url https://mainnet.base.org
# Read GasPriceOracle scalars
cast call 0x420000000000000000000000000000000000000F \
"baseFeeScalar()(uint32)" \
--rpc-url https://mainnet.base.org
# Check if address is a contract (smart wallet check)
cast code $ADDRESS --rpc-url https://mainnet.base.org
# Get current L2 base fee
cast base-fee --rpc-url https://mainnet.base.org
# Decode L1 batch data
cast call 0x4200000000000000000000000000000000000015 \
"l1BlockNumber()(uint64)" \
--rpc-url https://mainnet.base.org
docs/troubleshooting.md (opens in a new tab)examples/deploy-contract/README.md (opens in a new tab)examples/onchainkit/README.md (opens in a new tab)examples/paymaster/README.md (opens in a new tab)examples/smart-wallet/README.md (opens in a new tab)resources/contract-addresses.md (opens in a new tab)resources/error-codes.md (opens in a new tab)templates/base-app.ts (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
base-l2, op-stack, coinbase, smart-wallet, onchainkit, paymaster
2 plugins ship this exact skill · first indexed Jul 19, 2026
Other plugins' skills for the same job
/base:basefrom base
npx claudepluginhub naruto11eth/cryptoskills --plugin base