AgentSkillsCN

web3-monad

完整的Monad L1开发手册。涵盖MonadBFT共识(400ms出块,800ms终局性,尾部分叉抗性)、并行/延迟执行、MonadDb、JIT编译、Gas定价(按Gas上限收费,而非按实际Gas用量计费)、操作码重新定价(冷访问成本提升4倍)、EIP-7702委托、质押预编译、部署(Foundry Monad分叉、Hardhat 2/3)、验证(MonadVision、Monadscan、Socialscan)、执行事件(共享内存低延迟)、生态系统(Pyth、LayerZero、CCIP、Safe、ERC-4337),以及与以太坊的关键差异(128KB合约、无Blob、无全局内存池、储备余额)。适用于基于Monad构建、部署合约、集成质押、消费执行事件,或需要了解Monad专属架构细节的场景。

SKILL.md
--- frontmatter
name: web3-monad
description: Complete Monad L1 development playbook. Covers MonadBFT consensus (400ms blocks, 800ms finality, tail-fork resistance), parallel/deferred execution, MonadDb, JIT compilation, gas pricing (gas limit charged, not gas used), opcode repricing (cold access 4x), EIP-7702 delegation, staking precompile, deployment (Foundry monad fork, Hardhat 2/3), verification (MonadVision, Monadscan, Socialscan), execution events (shared-memory low-latency), ecosystem (Pyth, LayerZero, CCIP, Safe, ERC-4337), and key differences from Ethereum (128kb contracts, no blobs, no global mempool, reserve balance). Use when building on Monad, deploying contracts, integrating staking, consuming execution events, or needing Monad-specific architecture details.

Monad L1 Development Skill

What this Skill is for

Use this Skill when the user asks for:

  • Monad chain configuration (mainnet/testnet RPC, chain IDs, explorers)
  • MonadBFT consensus details (rounds, finality, tail-fork resistance)
  • Parallel and deferred execution architecture
  • Deploying contracts on Monad (Foundry, Hardhat, Remix)
  • Verifying contracts (MonadVision/Sourcify, Monadscan/Etherscan, Socialscan)
  • Gas pricing and opcode cost differences from Ethereum
  • EIP-7702 account delegation on Monad
  • Staking precompile integration (delegate, undelegate, compound, claim)
  • Execution events (low-latency shared-memory consumer)
  • Monad ecosystem (bridges, oracles, indexers, wallets, tokens)
  • Performance patterns for parallel-friendly contracts
  • Differences between Monad and Ethereum

Chain Configuration

Mainnet

PropertyValue
Chain ID143
CurrencyMON (18 decimals)
EVM VersionPectra fork
Block Time400ms
Finality800ms (2 slots)
Block Gas Limit200M
Tx Gas Limit30M
Gas Throughput500M gas/sec
Min Base Fee100 MON-gwei
Node Versionv0.12.7 / MONAD_EIGHT

RPC Endpoints (Mainnet)

URLProviderRate LimitBatchNotes
https://rpc.monad.xyz / wss://rpc.monad.xyzQuickNode25 rps100Default
https://rpc1.monad.xyz / wss://rpc1.monad.xyzAlchemy15 rps100No debug/trace
https://rpc2.monad.xyz / wss://rpc2.monad.xyzGoldsky Edge300/10s10Historical state
https://rpc3.monad.xyz / wss://rpc3.monad.xyzAnkr300/10s10No debug
https://rpc-mainnet.monadinfra.com / wss://rpc-mainnet.monadinfra.comMF20 rps1Historical state

Block Explorers

ExplorerURL
MonadVisionhttps://monadvision.com
Monadscanhttps://monadscan.com
Socialscanhttps://monad.socialscan.io
Visualizationhttps://gmonads.com
TracesPhalcon Explorer, Tenderly
UserOpsJiffyscan

Testnet

PropertyValue
Chain ID10143
RPChttps://testnet-rpc.monad.xyz
WebSocketwss://testnet-rpc.monad.xyz
Explorerhttps://testnet.monadexplorer.com
Faucethttps://testnet.monad.xyz

Key Differences from Ethereum

FeatureEthereumMonad
Block time12s400ms
Finality~12-18 min800ms (2 slots)
Throughput~10 TPS10,000+ TPS
Gas chargingGas usedGas limit
Max contract size24.5 KB128 KB
Blob txns (EIP-4844)SupportedNot supported
Global mempoolYesNo (leader-based forwarding)
Account cold access2,600 gas10,100 gas
Storage cold access2,100 gas8,100 gas
Reserve balanceNone~10 MON per account
TIMESTAMP granularity1 per block2-3 blocks share same second
Precompile 0x0100N/AEIP-7951 secp256r1 (P256)
EIP-7702 min balanceNone10 MON for delegated EOAs
EIP-7702 CREATE/CREATE2AllowedBanned for delegated EOAs
Tx types supported0,1,2,3,40,1,2,4 (no type 3)

Gas Limit Charging Model

Monad charges gas_limit * price_per_gas, NOT gas_used * price_per_gas. This enables asynchronous execution — execution happens after consensus, so gas used isn't known at inclusion time.

code
gas_paid = gas_limit * price_per_gas
price_per_gas = min(base_price_per_gas + priority_price_per_gas, max_price_per_gas)

Developer impact: Set gas limits explicitly for fixed-cost operations (e.g., 21000 for transfers) to avoid overpaying.

Reserve Balance

Every account maintains a ~10 MON reserve for gas across the next 3 blocks. Transactions that would reduce balance below this threshold are rejected. This prevents DoS during asynchronous execution.

Block Lifecycle & Finality

code
Proposed → Voted (speculative finality, T+1) → Finalized (T+2) → Verified/state root (T+5)
PhaseLatencyWhen to Use
Voted400msUI updates, most dApps
Finalized800msConservative apps
Verified~2sExchanges, bridges, stablecoins

viem Chain Definition

typescript
import { defineChain } from "viem";

export const monad = defineChain({
  id: 143,
  name: "Monad",
  nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 },
  rpcUrls: {
    default: { http: ["https://rpc.monad.xyz"], webSocket: ["wss://rpc.monad.xyz"] },
  },
  blockExplorers: {
    default: { name: "MonadVision", url: "https://monadvision.com" },
    monadscan: { name: "Monadscan", url: "https://monadscan.com" },
  },
});

export const monadTestnet = defineChain({
  id: 10143,
  name: "Monad Testnet",
  nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 },
  rpcUrls: {
    default: { http: ["https://testnet-rpc.monad.xyz"], webSocket: ["wss://testnet-rpc.monad.xyz"] },
  },
  blockExplorers: {
    default: { name: "Monad Explorer", url: "https://testnet.monadexplorer.com" },
  },
  testnet: true,
});

Foundry Configuration

toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
evm_version = "prague"

[rpc_endpoints]
monad = "https://rpc.monad.xyz"
monad_testnet = "https://testnet-rpc.monad.xyz"

[etherscan]
monad = { key = "${ETHERSCAN_API_KEY}", chain = 143, url = "https://api.etherscan.io/v2/api?chainid=143" }

Hardhat Configuration (v2)

typescript
const config: HardhatUserConfig = {
  solidity: {
    version: "0.8.28",
    settings: {
      evmVersion: "prague",
      metadata: { bytecodeHash: "ipfs" }, // Required for Sourcify
    },
  },
  networks: {
    monadTestnet: {
      url: "https://testnet-rpc.monad.xyz",
      chainId: 10143,
      accounts: [process.env.PRIVATE_KEY!],
    },
    monadMainnet: {
      url: "https://rpc.monad.xyz",
      chainId: 143,
      accounts: [process.env.PRIVATE_KEY!],
    },
  },
  etherscan: {
    customChains: [{
      network: "monadMainnet",
      chainId: 143,
      urls: {
        apiURL: "https://api.etherscan.io/v2/api?chainid=143",
        browserURL: "https://monadscan.com",
      },
    }],
  },
  sourcify: {
    enabled: true,
    apiUrl: "https://sourcify-api-monad.blockvision.org",
    browserUrl: "https://monadvision.com",
  },
};

Smart Contract Tips

  • Gas optimization still matters — even with cheap gas, optimize for users
  • Same security model — all Solidity best practices (CEI, reentrancy guards) apply
  • Parallel-friendly design — contracts with per-user mappings parallelize better than global counters
  • 128 KB contract limit — larger contracts are possible but still optimize for gas
  • No code changes needed for parallelism — it's at the runtime level
  • block.timestamp — 2-3 blocks may share the same second; don't rely on sub-second granularity
  • No blob transactions — EIP-4844 type 3 txns are not supported

WebSocket Subscriptions

Standard eth_subscribe plus Monad-specific extensions:

code
newHeads        — standard new block headers
logs            — standard log filtering
monadNewHeads   — Monad-specific block headers with extra fields
monadLogs       — Monad-specific log events

Execution Events (Advanced)

For ultra-low-latency data consumption, Monad exposes execution events via shared-memory ring buffers. Consumer runs on same host as node. ~1 microsecond latency. Supported in C, C++, and Rust only.

Use execution events when JSON-RPC can't keep up with 10,000 TPS throughput. For most dApps, standard WebSocket subscriptions are sufficient.

Required Tooling Versions

ToolMinimum Version
FoundryMonad fork (foundryup --network monad)
viem2.40.0+
alloy-chains0.2.20+
Hardhat SolidityevmVersion: "prague"

Additional Reference Files

FileContents
architecture.mdMonadBFT consensus, parallel execution, deferred execution, MonadDb, JIT, RaptorCast
deployment.mdFoundry + Hardhat deploy/verify step-by-step guides
gas-and-opcodes.mdGas pricing model, opcode repricing tables, precompile costs
staking.mdStaking precompile ABI, functions, events, epoch mechanics
ecosystem.mdToken addresses, bridges, oracles, indexers, canonical contracts