diff --git a/.claude/commands/llms.md b/.claude/commands/llms.md new file mode 100644 index 000000000..48d8ae84c --- /dev/null +++ b/.claude/commands/llms.md @@ -0,0 +1,66 @@ +# Regenerate llms.txt + llms-full.txt + +Regenerate `docs/llms.txt` (strict [llms.txt spec](https://llmstxt.org)) and `docs/llms-full.txt` (spec-aligned + preserved hand-written extras) from the current `docs/` tree. + +## How it normally runs + +The repo's `githooks/post-commit` hook runs `scripts/llms.js` automatically when a commit message contains the substring `llms.txt` (case-insensitive). If the regenerated files differ from what was committed, the hook creates a follow-up `chore: regenerate docs/llms.txt` commit. + +So the day-to-day flow is just: + +```bash +git commit -m "docs: add foo guide; updates llms.txt" +``` + +…and the hook handles the rest. + +Use `/llms` only when you want to: +- Preview the output before committing +- Regenerate without committing (e.g., to sanity-check a refactor) +- Install the hook on a fresh clone + +## Steps + +1. **If `$ARGUMENTS` includes `install`:** Install the post-commit hook so future commits with the right trigger token regenerate automatically. Always use `--local` so the config lands in `.git/config`, not the global `~/.gitconfig`: + ```bash + git config --local core.hooksPath githooks + chmod +x githooks/post-commit + ``` + Verify it stayed local: `git config --global --get core.hooksPath` should print nothing. + +2. **Otherwise, run the generator:** + ```bash + node scripts/llms.js + ``` + +3. **If `$ARGUMENTS` includes `status`:** Show current file sizes and last-modified times instead of regenerating: + ```bash + ls -lh docs/llms.txt docs/llms-full.txt + ``` + +4. **Report the result:** + - File sizes for `docs/llms.txt` and `docs/llms-full.txt` (visible in script output) + - Section + page counts (visible in script output) + - Reminder: hand-written extras between `LLMS_EXTRAS_*` markers in `llms-full.txt` are preserved across regenerations + - Reminder: to commit the regenerated files via the post-commit hook, include `llms.txt` in the commit message + +## Arguments + +- No arguments: Regenerate both files +- `install`: Install the post-commit hook (one-time setup per clone) +- `status`: Show current file sizes and last-modified times without regenerating + +## Output format + +``` +## llms.txt Generation + +### Generated +- docs/llms.txt: 54.13 KB +- docs/llms-full.txt: 58.56 KB +- Sections: 5, pages: 300 + +### Notes +- Hand-written extras inside LLMS_EXTRAS markers in llms-full.txt preserved +- Include "llms.txt" in your commit message to trigger the hook on the next commit +``` diff --git a/claude.md b/claude.md index f835e3f1f..de0cfdce2 100644 --- a/claude.md +++ b/claude.md @@ -9,7 +9,8 @@ Technical documentation for Base (Ethereum L2). Built with Mintlify. | `mintlify dev` | Local dev server | | `/lint` | Lint MDX files and fix issues | | `/doc-feedback` | Review content quality | -| `/agents` | Generate AGENTS.md index for AI agents | +| `/agents` | Generate AGENTS.md index for AI agents (also runs via `githooks/post-commit` when commit message contains `agents.md`) | +| `/llms` | Regenerate `docs/llms.txt` and `docs/llms-full.txt` (also runs via `githooks/post-commit` when commit message contains `llms.txt`) | ## Structure @@ -60,5 +61,6 @@ Edit `docs.json` to add/remove pages. Add redirects when removing pages. 1. Run `/lint` and fix errors 2. Run `/agents` if docs structure changed + - Or include `agents.md` / `llms.txt` in your commit message — the `githooks/post-commit` hook will regenerate the matching index files and create a follow-up commit. Enable hooks once per clone with `git config --local core.hooksPath githooks` (repo-scoped, never global). 3. Add redirects for removed pages 4. Verify links work diff --git a/docs/get-started/deploy-smart-contracts.mdx b/docs/get-started/deploy-smart-contracts.mdx index 84d7e6ca9..892345cd0 100644 --- a/docs/get-started/deploy-smart-contracts.mdx +++ b/docs/get-started/deploy-smart-contracts.mdx @@ -1,6 +1,6 @@ --- title: 'Deploy Smart Contracts' -description: A guide to help you get started with deploying your smart contracts on Base. +description: Step-by-step guide to deploying smart contracts on Base. --- Welcome to the Base deployment quickstart guide! This comprehensive walkthrough will help you set up your environment and deploy smart contracts on Base. Whether you're a seasoned developer or just starting out, this guide has got you covered. diff --git a/docs/llms-full.txt b/docs/llms-full.txt index 1177d3889..6725d0223 100644 --- a/docs/llms-full.txt +++ b/docs/llms-full.txt @@ -1,8 +1,8 @@ -# https://docs.base.org/llms-full.txt +# Base Documentation — Full Context -## Base Documentation — Full Context (Root) +> Full context for AI agents working with Base. Cross-cutting concept guides (networks, auth, errors, rate limits) sit above an exhaustive per-page index of every documentation file. Follow page URLs for source content. -> Rich, lightweight entry point for AI agents. Orients to cross-site concepts, SDK patterns, and links to per-product full shards. For deep dives, follow the Source links. + ## How the docs are organized - Products have two files each: `//llms.txt` (index) and `//llms-full.txt` (expanded) @@ -86,3 +86,323 @@ const client = createPublicClient({ chain: base, transport: http() }) - Get Started: `./get-started/llms.txt` and `./get-started/llms-full.txt` - Each product section: `//llms.txt` (index) + + + + +## Get Started +- [Base](https://docs.base.org/get-started/base): The #1 Ethereum Layer 2, incubated by Coinbase +- [Base Mentorship Program](https://docs.base.org/get-started/base-mentorship-program): Connect with experienced builders and industry leaders to accelerate your journey on Base +- [Base Services Hub](https://docs.base.org/get-started/base-services-hub): A collection of services for building on Base. +- [Block Explorers](https://docs.base.org/get-started/block-explorers): Documentation for block explorers for the Base network. +- [Core Concepts](https://docs.base.org/get-started/concepts) +- [Country Leads & Ambassadors](https://docs.base.org/get-started/country-leads-and-ambassadors): Connect with local Base community leaders and ambassadors around the world +- [Data Indexers](https://docs.base.org/get-started/data-indexers): Documentation for data indexing platforms for Base network. +- [Deploy Smart Contracts](https://docs.base.org/get-started/deploy-smart-contracts): Step-by-step guide to deploying smart contracts on Base. +- [Static Docs Files](https://docs.base.org/get-started/docs-llms): Use llms.txt and llms-full.txt to give AI assistants access to Base documentation. +- [MCP Server](https://docs.base.org/get-started/docs-mcp): Connect your AI coding assistant to Base documentation using Model Context Protocol for real-time access. +- [Get Funded](https://docs.base.org/get-started/get-funded): The Base ecosystem offers multiple funding pathways designed specifically for builders at every stage—from weekend experiments to full-scale ventures. +- [Launch a Token](https://docs.base.org/get-started/launch-token) +- [Learning Resources](https://docs.base.org/get-started/learning-resources): Find educational content for learning Solidity, Ethereum, and blockchain development +- [Developer's Guide to Effective AI Prompting](https://docs.base.org/get-started/prompt-library): Learn practical AI prompting techniques to enhance your coding workflow and get better results from AI coding assistants. +- [Resources for AI agents](https://docs.base.org/get-started/resources-for-ai-agents): Base-first resources for AI agents, including docs indexes, MCP access, skills, and recommended starting points + +## Base Chain +- [Flashblocks Overview](https://docs.base.org/base-chain/flashblocks/overview): Understand the sequencer architecture, block building algorithm, and integration options for Flashblocks on Base. +- [Base Change Proposals (BCPs)](https://docs.base.org/base-chain/specs/bcps/index): Index of Base Chain Proposals (BCPs) — design documents describing proposed changes to the Base Chain protocol. +- [Overview](https://docs.base.org/base-chain/specs/overview): Technical specification of the Base Chain protocol, covering block derivation, execution, transaction propagation, and state verification. +- [Specification](https://docs.base.org/base-chain/specs/protocol/consensus/index): Specification of the Base rollup node, describing its components and role in L2 block derivation and consensus. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/protocol/execution/index): Specification of the L2 execution engine, detailing EIP-1559 parameters, fee vaults, Engine API usage, and execution layer behavior. +- [Fault Proof](https://docs.base.org/base-chain/specs/protocol/fault-proof/index): Overview of the Base fault proof system, describing the program, virtual machine, and interactive dispute game components that verify L2 state. +- [Stage One Decentralization](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/index): Specification of the stage one fault proof system for Base Chain decentralization, covering output proposals and dispute game integration. +- [Overview](https://docs.base.org/base-chain/specs/protocol/overview): High-level overview of the Base Chain protocol, covering rollup architecture, core components, and user flows for deposits, transactions, and withdrawals. +- [Azul](https://docs.base.org/base-chain/specs/upgrades/azul/overview): Overview of the Azul hardfork, introducing Osaka EVM support, a simplified execution client, and a multi-proof system for L2 checkpoints. +- [Canyon](https://docs.base.org/base-chain/specs/upgrades/canyon/overview): Overview of the Canyon hardfork, bringing Ethereum Shanghai EIPs (EIP-3651, EIP-3855, EIP-3860) to the Base execution layer. +- [Delta](https://docs.base.org/base-chain/specs/upgrades/delta/overview): Overview of the Delta hardfork, introducing span batches to reduce L1 data costs by compressing multiple L2 blocks into single batcher transactions. +- [Ecotone](https://docs.base.org/base-chain/specs/upgrades/ecotone/overview): Overview of the Ecotone hardfork, integrating Ethereum Dencun changes including EIP-4844 blob transactions and EIP-4788 beacon block roots. +- [Fjord](https://docs.base.org/base-chain/specs/upgrades/fjord/overview): Overview of the Fjord hardfork, introducing FastLZ-based L1 fee estimation, the RIP-7212 secp256r1 precompile, and brotli channel compression. +- [Granite](https://docs.base.org/base-chain/specs/upgrades/granite/overview): Overview of the Granite hardfork, adding bn256Pairing precompile input size restrictions and CHANNEL_TIMEOUT parameter changes. +- [Holocene](https://docs.base.org/base-chain/specs/upgrades/holocene/overview): Overview of the Holocene hardfork, introducing dynamic EIP-1559 parameters configurable via SystemConfig and stricter block derivation rules. +- [Isthmus](https://docs.base.org/base-chain/specs/upgrades/isthmus/overview): Overview of the Isthmus hardfork, incorporating Ethereum Pectra EIPs and introducing the operator fee mechanism for sequencer revenue. +- [Jovian](https://docs.base.org/base-chain/specs/upgrades/jovian/overview): Overview of the Jovian hardfork, introducing a configurable minimum base fee and a DA footprint gas scalar for improved fee market stability. +- [Pectra Blob Schedule (Sepolia)](https://docs.base.org/base-chain/specs/upgrades/pectra-blob-schedule/overview): Overview of the Pectra Blob Schedule hardfork, an optional upgrade that delays adoption of Ethereum's increased blob count schedule on Base. +- [debug_traceBlockByHash](https://docs.base.org/base-chain/api-reference/debug-api/debug_traceBlockByHash): Returns EVM execution traces for all transactions in a block by block hash. +- [debug_traceBlockByNumber](https://docs.base.org/base-chain/api-reference/debug-api/debug_traceBlockByNumber): Returns EVM execution traces for all transactions in a block by block number. +- [debug_traceTransaction](https://docs.base.org/base-chain/api-reference/debug-api/debug_traceTransaction): Returns the full EVM execution trace for a transaction. Requires a node with debug APIs enabled. +- [eth_blockNumber](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_blockNumber): Returns the number of the most recently mined block. +- [eth_call](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_call): Executes a message call without creating a transaction. Use pending on a Flashblocks endpoint to simulate against pre-confirmed state. +- [eth_chainId](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_chainId): Returns the chain ID of the current network. +- [eth_estimateGas](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_estimateGas): Estimates the gas required for a transaction. Use pending on a Flashblocks endpoint to estimate against pre-confirmed state. +- [eth_feeHistory](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_feeHistory): Returns historical base fees and priority fee percentiles for a range of blocks. +- [eth_gasPrice](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_gasPrice): Returns the current gas price in wei. +- [eth_getBalance](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBalance): Returns the ETH balance of an account at a given block. Use the pending tag on a Flashblocks endpoint for 200ms pre-confirmed balances. +- [eth_getBlockByHash](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockByHash): Returns block information by block hash. +- [eth_getBlockByNumber](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockByNumber): Returns block information by number. On Flashblocks endpoints, the pending tag returns the live pre-confirmed block updated every ~200ms. +- [eth_getBlockReceipts](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockReceipts): Returns all transaction receipts for a block. Use pending on a Flashblocks endpoint for pre-confirmed receipts. +- [eth_getBlockTransactionCountByHash](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockTransactionCountByHash): Returns the number of transactions in a block by block hash. +- [eth_getBlockTransactionCountByNumber](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockTransactionCountByNumber): Returns the number of transactions in a block by block number. +- [eth_getCode](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getCode): Returns the contract bytecode at an address. Use pending on a Flashblocks endpoint to detect newly deployed contracts before block finalization. +- [eth_getLogs](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getLogs): Returns logs matching a filter. Use pending on a Flashblocks endpoint to query logs from pre-confirmed transactions. +- [eth_getStorageAt](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getStorageAt): Returns the value of a storage slot at an address. Use pending on a Flashblocks endpoint for pre-confirmed storage reads. +- [eth_getTransactionByBlockHashAndIndex](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionByBlockHashAndIndex): Returns a transaction by block hash and index position. +- [eth_getTransactionByBlockNumberAndIndex](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionByBlockNumberAndIndex): Returns a transaction by block number and index position. +- [eth_getTransactionByHash](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionByHash): Returns a transaction by its hash. +- [eth_getTransactionCount](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionCount): Returns the number of transactions sent from an address (the nonce). Use pending on a Flashblocks endpoint to get the pre-confirmed nonce. +- [eth_getTransactionReceipt](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionReceipt): Returns the receipt for a mined transaction. Receipts are only available after a transaction is included in a block. +- [eth_maxPriorityFeePerGas](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_maxPriorityFeePerGas): Returns the suggested EIP-1559 priority fee (tip) per gas. +- [eth_sendRawTransaction](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_sendRawTransaction): Submits a pre-signed transaction to the network. Submit to a Flashblocks preconf endpoint to get 200ms pre-confirmation. +- [eth_subscribe](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_subscribe): Creates a real-time WebSocket subscription. Flashblocks endpoints add three extra subscription types and emit newHeads every ~200ms. +- [eth_syncing](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_syncing): Returns the sync status of the node. +- [eth_unsubscribe](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_unsubscribe): Cancels an active WebSocket subscription. +- [net_version](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/net_version): Returns the current network ID as a string. +- [web3_clientVersion](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/web3_clientVersion): Returns the current client version string. +- [base_transactionStatus](https://docs.base.org/base-chain/api-reference/flashblocks-api/base_transactionStatus): Checks whether a transaction is in the node mempool. Only available on Flashblocks endpoints. +- [eth_simulateV1](https://docs.base.org/base-chain/api-reference/flashblocks-api/eth_simulateV1): Simulates one or more transaction bundles against the current pre-confirmed Flashblock state. Only available on Flashblocks endpoints. +- [Overview](https://docs.base.org/base-chain/api-reference/flashblocks-api/flashblocks-api-overview): Flashblocks-specific RPC methods, WebSocket subscriptions, and the infrastructure stream schema for Base pre-confirmations. +- [newFlashblocks](https://docs.base.org/base-chain/api-reference/flashblocks-api/newFlashblocks): Subscribe to receive full Flashblock payload stream as each pre-confirmed block is built. Only available on Flashblocks WebSocket endpoints. +- [newFlashblockTransactions](https://docs.base.org/base-chain/api-reference/flashblocks-api/newFlashblockTransactions): Subscribe to receive each transaction as it is pre-confirmed into a Flashblock. Only available on Flashblocks WebSocket endpoints. +- [pendingLogs](https://docs.base.org/base-chain/api-reference/flashblocks-api/pendingLogs): Subscribe to logs from pre-confirmed transactions matching an optional filter. Only available on Flashblocks WebSocket endpoints. +- [Base RPC Overview](https://docs.base.org/base-chain/api-reference/rpc-overview): Complete reference for all JSON-RPC and Flashblocks methods available on Base nodes. +- [App Integration](https://docs.base.org/base-chain/flashblocks/app-integration): Integrate Flashblocks into your app for 200ms transaction confirmations using RPC APIs and popular libraries like Ethers, Wagmi and Viem. +- [Flashblocks Architecture](https://docs.base.org/base-chain/flashblocks/architecture): Understand the sequencer architecture and infrastructure components that power Flashblocks on Base. +- [Flashblocks FAQ](https://docs.base.org/base-chain/flashblocks/faq): Frequently asked questions about Flashblocks, including block building, WebSocket data, RPC usage, and node setup. +- [Contract Addresses](https://docs.base.org/base-chain/network-information/base-contracts): A comprehensive list of L2 contract addresses for Base Mainnet and Base Testnet, including links to their respective blockchain explorers. +- [Block Building](https://docs.base.org/base-chain/network-information/block-building): This page outlines how Base blocks are built. +- [Bridges](https://docs.base.org/base-chain/network-information/bridges): Documentation for bridging assets to Base. This page covers how to bridge assets between Ethereum, Solana, Bitcoin, and Base. +- [Configuration Changelog](https://docs.base.org/base-chain/network-information/configuration-changelog): A log of configuration changes to the Base networks. +- [Differences between Ethereum and Base](https://docs.base.org/base-chain/network-information/diffs-ethereum-base) +- [Ecosystem Contracts](https://docs.base.org/base-chain/network-information/ecosystem-contracts) +- [Network Faucets](https://docs.base.org/base-chain/network-information/network-faucets): Documentation for Testnet Faucets on the Base network. +- [Network Fees](https://docs.base.org/base-chain/network-information/network-fees): Documentation about network fees on Base. This page covers details of the two-component cost system involving L2 execution fees and L1 security fees, and offers insights on fee variations and cost-saving strategies. +- [Transaction Finality](https://docs.base.org/base-chain/network-information/transaction-finality): Detailed information about transaction finality on Base. +- [Troubleshooting Transactions](https://docs.base.org/base-chain/network-information/troubleshooting-transactions): Guide to diagnosing and resolving transaction issues on Base. +- [Base Azul Upgrade](https://docs.base.org/base-chain/node-operators/base-v1-upgrade): Migrate your Base node to base-reth-node and base-consensus for Azul. +- [Node Providers](https://docs.base.org/base-chain/node-operators/node-providers): Documentation for Node Providers for the Base network. Including details on their services, supported networks, and pricing plans. +- [Node Performance](https://docs.base.org/base-chain/node-operators/performance-tuning): Hardware specifications, storage requirements, client recommendations, and configuration settings for running a performant Base node. +- [Run a Node](https://docs.base.org/base-chain/node-operators/run-a-base-node): A tutorial that teaches how to set up and run a Base Node. +- [Node Snapshots](https://docs.base.org/base-chain/node-operators/snapshots): Download and restore Base node snapshots to significantly reduce initial sync time for both archive and pruned nodes. +- [Node Troubleshooting](https://docs.base.org/base-chain/node-operators/troubleshooting): Solutions to common issues when setting up and running a Base node, covering sync problems, networking, snapshots, and performance. +- [Base-Solana Bridge](https://docs.base.org/base-chain/quickstart/base-solana-bridge): Bridge tokens and messages between Base and Solana Mainnet +- [Connecting to Base](https://docs.base.org/base-chain/quickstart/connecting-to-base): Documentation about Base Mainnet and Base Testnet. This page covers network information for the Base network, including network names, descriptions, RPC endpoints, chain IDs, currency symbols, and block explorers. +- [Deploy on Base](https://docs.base.org/base-chain/quickstart/deploy-on-base) +- [Why Base?](https://docs.base.org/base-chain/quickstart/why-base) +- [How to avoid getting your app flagged as malicious](https://docs.base.org/base-chain/security/avoid-malicious-flags): The Base bug bounty program and procedures for reporting vulnerabilities. +- [Bug Bounty](https://docs.base.org/base-chain/security/bug-bounty) +- [Reporting Vulnerabilities](https://docs.base.org/base-chain/security/report-vulnerability): The Base procedures for reporting vulnerabilities. +- [Security Council for Base](https://docs.base.org/base-chain/security/security-council): This page outlines the purpose, goals, structure, and responsibilities of the Security Council for Base. +- [BCP-0000: BCP Process](https://docs.base.org/base-chain/specs/bcps/bcp-0000): BCP-0000 defines the Base Change Proposal process, establishing the template and standards for proposing, reviewing, and accepting protocol changes. +- [Batcher](https://docs.base.org/base-chain/specs/protocol/batcher): Specification of the batcher (batch submitter), the component responsible for posting L2 sequencer data to L1 for data availability. +- [Standard Bridges](https://docs.base.org/base-chain/specs/protocol/bridging/bridges): Specification of the standard bridges enabling cross-domain ETH and ERC20 token transfers between L1 and L2 on Base. +- [Deposits](https://docs.base.org/base-chain/specs/protocol/bridging/deposits): Specification of the deposit mechanism for Base, detailing how L1 transactions are converted into L2 deposit transactions. +- [Cross Domain Messengers](https://docs.base.org/base-chain/specs/protocol/bridging/messengers): Specification of the cross-domain messenger contracts, providing a higher-level API for sending messages between L1 and L2 on Base. +- [Withdrawals](https://docs.base.org/base-chain/specs/protocol/bridging/withdrawals): Specification of the withdrawal mechanism for Base, describing how L2 state is proven on L1 and funds are released from the bridge. +- [Derivation](https://docs.base.org/base-chain/specs/protocol/consensus/derivation): Specification of the L2 chain derivation pipeline, describing how L2 blocks are deterministically derived from L1 data and sequencer batches. +- [P2P](https://docs.base.org/base-chain/specs/protocol/consensus/p2p): Specification of the rollup node peer-to-peer network, covering node discovery, gossip protocol, and unsafe block propagation. +- [RPC](https://docs.base.org/base-chain/specs/protocol/consensus/rpc): Specification of the rollup node RPC interface, including the optimism_outputAtBlock method for retrieving L2 output roots. +- [Precompiles](https://docs.base.org/base-chain/specs/protocol/execution/evm/precompiles): Specification of precompiled contracts on Base, including native EVM implementations available at predefined addresses. +- [Predeploys](https://docs.base.org/base-chain/specs/protocol/execution/evm/predeploys): Specification of predeployed smart contracts on Base, including system contracts deployed at predetermined addresses in genesis state. +- [Preinstalls](https://docs.base.org/base-chain/specs/protocol/execution/evm/preinstalls): Specification of preinstalled smart contracts on Base, including utility contracts deployed in genesis state that run directly in the EVM. +- [Multithreaded Cannon Fault Proof Virtual Machine](https://docs.base.org/base-chain/specs/protocol/fault-proof/cannon-fault-proof-vm): Specification of the Cannon Fault Proof Virtual Machine (FPVM), the multithreaded VM used for executing programs in dispute game resolution. +- [Proposer](https://docs.base.org/base-chain/specs/protocol/fault-proof/proposer): Specification of the L2 output proposer, which publishes L2 output roots and withdrawal hashes to L1 for use in the fault proof system. +- [AnchorStateRegistry](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/anchor-state-registry): Specification of the AnchorStateRegistry contract, which stores verified dispute game results as anchor states for new dispute game instances. +- [Bond Incentives](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/bond-incentives): Specification of the bond incentive system for the Fault Dispute Game, adding financial rewards and penalties to enforce honest challenger behavior. +- [Bridge Integration](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/bridge-integration): Specification of how fault proofs integrate with the Base bridge, replacing the trusted proposer withdrawal path with dispute-game-based proof verification. +- [Dispute Game Interface](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/dispute-game-interface): Specification of the dispute game interface, defining the common contract interface for games that resolve contested L2 state claims. +- [Fault Dispute Game](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/fault-dispute-game): Specification of the Fault Dispute Game (FDG), a bisection-based protocol for verifying the validity of L2 output roots via interactive dispute resolution. +- [Honest Challenger (Fault Dispute Game)](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/honest-challenger-fdg): Specification of the honest challenger agent in the Fault Dispute Game, defining correct behavior for supporting valid claims and disputing invalid ones. +- [OptimismPortal](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/optimism-portal): Specification of the OptimismPortal contract, the primary L1 interface for deposits and withdrawals between L1 and L2 on Base. +- [Configuration](https://docs.base.org/base-chain/specs/reference/configurability): Reference for Base Chain configuration parameters across consensus, policy, admin, and sequencer categories. +- [Glossary](https://docs.base.org/base-chain/specs/reference/glossary): Glossary of terms and definitions used throughout the Base Chain protocol specification. +- [Azul: Execution Engine](https://docs.base.org/base-chain/specs/upgrades/azul/exec-engine): Execution engine changes in the Azul hardfork, including the EIP-7825 transaction gas limit cap and secp256r1 precompile cost updates. +- [Azul: Proof System](https://docs.base.org/base-chain/specs/upgrades/azul/proofs): Specification of the Azul multi-proof system, replacing the single output proposer with an AggregateVerifier contract for L2 checkpoint security. +- [Span-batches](https://docs.base.org/base-chain/specs/upgrades/delta/span-batches): Specification of span batches introduced in Delta, a new batch format that compresses sequences of L2 blocks for more efficient L1 data posting. +- [Derivation](https://docs.base.org/base-chain/specs/upgrades/ecotone/derivation): Derivation changes in the Ecotone upgrade, extending the retrieval stage to support EIP-4844 blobs as an additional data availability source. +- [Ecotone L1 Attributes](https://docs.base.org/base-chain/specs/upgrades/ecotone/l1-attributes): L1 attributes transaction changes in the Ecotone upgrade, updating calldata format to support the new blob-based fee calculation model. +- [Fjord L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/fjord/derivation): Derivation changes in the Fjord upgrade, updating protocol parameters for max sequencer drift, channel bank size, and adding brotli compression support. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/fjord/exec-engine): Execution engine changes in the Fjord upgrade, replacing the L1 cost fee estimator with a FastLZ-based compression model. +- [Predeploys](https://docs.base.org/base-chain/specs/upgrades/fjord/predeploys): Predeploy changes in the Fjord upgrade, adding FastLZ fee computation constants to the GasPriceOracle contract. +- [Granite L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/granite/derivation): Derivation changes in the Granite upgrade, updating the CHANNEL_TIMEOUT protocol parameter. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/granite/exec-engine): Execution engine changes in the Granite upgrade, restricting bn256Pairing precompile input size to prevent unbounded gas consumption. +- [Holocene L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/holocene/derivation): Derivation changes in the Holocene upgrade, introducing stricter pipeline rules that simplify derivation and improve fault proof worst-case behavior. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/holocene/exec-engine): Execution engine changes in the Holocene upgrade, enabling dynamic EIP-1559 parameters encoded in block headers and configured via SystemConfig. +- [System Config](https://docs.base.org/base-chain/specs/upgrades/holocene/system-config): SystemConfig changes in the Holocene upgrade, adding dynamic EIP-1559 parameter configuration via ConfigUpdate events. +- [Isthmus L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/isthmus/derivation): Derivation changes in the Isthmus upgrade, specifying network upgrade automation transactions executed at hardfork activation. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/isthmus/exec-engine): Execution engine changes in the Isthmus upgrade, including L2ToL1MessagePasser storage root in block headers and operator fee collection. +- [L1 Block Attributes](https://docs.base.org/base-chain/specs/upgrades/isthmus/l1-attributes): L1 attributes transaction changes in the Isthmus upgrade, extending calldata to include operator fee scalar and constant parameters. +- [Predeploys](https://docs.base.org/base-chain/specs/upgrades/isthmus/predeploys): Predeploy changes in the Isthmus upgrade, including updates to L1Block and the new OperatorFeeVault contract. +- [Isthmus: System Config](https://docs.base.org/base-chain/specs/upgrades/isthmus/system-config): SystemConfig changes in the Isthmus upgrade, adding operatorFeeScalar and operatorFeeConstant configuration variables. +- [Derivation](https://docs.base.org/base-chain/specs/upgrades/jovian/derivation): Derivation changes in the Jovian upgrade, specifying activation block rules and gas computation behavior at hardfork activation. +- [Jovian: Execution Engine](https://docs.base.org/base-chain/specs/upgrades/jovian/exec-engine): Execution engine changes in the Jovian upgrade, introducing a configurable minimum base fee via SystemConfig to reduce priority-fee auction durations. +- [L1 Block Attributes](https://docs.base.org/base-chain/specs/upgrades/jovian/l1-attributes): L1 attributes transaction changes in the Jovian upgrade, extending calldata to include the DA footprint gas scalar. +- [Jovian: System Config](https://docs.base.org/base-chain/specs/upgrades/jovian/system-config): SystemConfig changes in the Jovian upgrade, adding a minimum base fee configuration variable for the EIP-1559 fee market. +- [Pectra Blob Schedule Derivation](https://docs.base.org/base-chain/specs/upgrades/pectra-blob-schedule/derivation): Derivation changes for the Pectra Blob Schedule hardfork, specifying how blob fee parameters are handled in L1 attributes transactions. + +## Base Account +- [Capabilities Overview](https://docs.base.org/base-account/reference/core/capabilities/overview): Understand how to use Base Account capabilities with wallet_connect and wallet_sendCalls +- [Basename Transfer Guide](https://docs.base.org/base-account/basenames/basename-transfer): Step-by-step guide for Base App users to transfer their Basenames to new wallet addresses. +- [Basenames FAQ](https://docs.base.org/base-account/basenames/basenames-faq): Frequently asked questions on basenames. +- [Contribute to the Base Account Docs](https://docs.base.org/base-account/contribute/contribute-to-base-account-docs) +- [Security and Bug Bounty](https://docs.base.org/base-account/contribute/security-and-bug-bounty) +- [Coinbase Developer Platform](https://docs.base.org/base-account/framework-integrations/cdp): Build onchain apps supporting both Base Account and CDP Embedded Wallets +- [Auth (Sign In With Base)](https://docs.base.org/base-account/framework-integrations/privy/authentication): Manage user authentication with Privy and Base Account +- [Setup](https://docs.base.org/base-account/framework-integrations/privy/setup): Configure Privy with Base Account for your React application +- [Spend Permissions](https://docs.base.org/base-account/framework-integrations/privy/spend-permissions): Enable trusted spenders to move assets without additional signatures +- [Sub Accounts](https://docs.base.org/base-account/framework-integrations/privy/sub-accounts): Create and manage app-specific wallet accounts with Base Account +- [Wallet Actions](https://docs.base.org/base-account/framework-integrations/privy/wallet-actions): Sign messages, transactions, and typed data with Privy wallets +- [RainbowKit](https://docs.base.org/base-account/framework-integrations/rainbowkit): Integrate Base Account with RainbowKit +- [Reown](https://docs.base.org/base-account/framework-integrations/reown): Integrate Base Account with Reown AppKit for your React application +- [Thirdweb](https://docs.base.org/base-account/framework-integrations/thirdweb): Configure Thirdweb with Base Account for your React application +- [Base Pay](https://docs.base.org/base-account/framework-integrations/wagmi/base-pay): Accept USDC payments with Base Pay in your Wagmi-powered React application +- [Basenames](https://docs.base.org/base-account/framework-integrations/wagmi/basenames): Add support for Base names in your application using Wagmi and Viem +- [Batch Transactions](https://docs.base.org/base-account/framework-integrations/wagmi/batch-transactions): Send multiple onchain calls in a single transaction with Wagmi and Base Account +- [Other Use Cases](https://docs.base.org/base-account/framework-integrations/wagmi/other-use-cases): Access the Base Account provider from Wagmi for advanced functionality like Sub Accounts, Spend Permissions, and more +- [Setup](https://docs.base.org/base-account/framework-integrations/wagmi/setup): Configure Wagmi with Base Account connector for your React application +- [Sign in with Base](https://docs.base.org/base-account/framework-integrations/wagmi/sign-in-with-base): Implement Base Account authentication using the proper SIWE flow with Wagmi +- [Using Sub Accounts](https://docs.base.org/base-account/framework-integrations/wagmi/sub-accounts): Implement Base Account Sub Accounts using Wagmi +- [Accept Payments](https://docs.base.org/base-account/guides/accept-payments): Add one-tap USDC payments to your app with the pay() helper and Base Pay Button. +- [Accept Recurring Payments](https://docs.base.org/base-account/guides/accept-recurring-payments): Enable subscription-based revenue models with automatic USDC payments +- [Authenticate Users](https://docs.base.org/base-account/guides/authenticate-users): Let a user click “Sign in with Base,” prove ownership of their onchain account, and give your server everything it needs to create a session – using open standards and no passwords +- [Migrate from Coinbase Wallet SDK](https://docs.base.org/base-account/guides/migration-guide): A guide to migrating from the Coinbase Wallet SDK to the Base Account SDK +- [Sign and Verify Typed Data](https://docs.base.org/base-account/guides/sign-and-verify-typed-data): EIP-712 structured data signing and verification for Base Account +- [Transaction Simulation Data](https://docs.base.org/base-account/guides/tips/inspect-txn-simulation) +- [Popup Tips](https://docs.base.org/base-account/guides/tips/popup-tips) +- [Verify Social Accounts](https://docs.base.org/base-account/guides/verify-social-accounts): Use Base Verify to let users prove ownership of verified accounts (X, Coinbase, Instagram, TikTok) without sharing credentials, enabling Sybil-resistant airdrops, gated content, and identity-based rewards. +- [Batch Transactions](https://docs.base.org/base-account/improve-ux/batch-transactions) +- [Use Spend Permissions](https://docs.base.org/base-account/improve-ux/spend-permissions): Learn how to use Spend Permissions to allow a trusted spender to spend user assets +- [Pay Gas in ERC20 tokens](https://docs.base.org/base-account/improve-ux/sponsor-gas/erc20-paymasters): Base Account enables users to pay for gas in ERC20 tokens +- [Sponsor Gas](https://docs.base.org/base-account/improve-ux/sponsor-gas/paymasters): Use Paymasters to sponsor your users' transactions +- [Use Sub Accounts](https://docs.base.org/base-account/improve-ux/sub-accounts): Learn how to create and use Sub Accounts using Base Account SDK +- [Base Gasless Campaign](https://docs.base.org/base-account/more/base-gasless-campaign) +- [Telemetry · Base Account](https://docs.base.org/base-account/more/telemetry): Understanding Base Account's anonymous telemetry system and how to configure it. +- [Gas Usage](https://docs.base.org/base-account/more/troubleshooting/usage-details/gas-usage) +- [Popup Tips](https://docs.base.org/base-account/more/troubleshooting/usage-details/popups) +- [Transaction Simulation Data](https://docs.base.org/base-account/more/troubleshooting/usage-details/simulations) +- [Unsupported Calls](https://docs.base.org/base-account/more/troubleshooting/usage-details/unsupported-calls) +- [Wallet Library Support](https://docs.base.org/base-account/more/troubleshooting/usage-details/wallet-library-support) +- [Base Account Overview](https://docs.base.org/base-account/overview/what-is-base-account): What is a Base Account and how the Base Account SDK lets you add universal sign-in and one-tap USDC payments to any app. +- [AI Tools for Base Account Developers](https://docs.base.org/base-account/quickstart/ai-tools-available-for-devs) +- [Mobile (React Native)](https://docs.base.org/base-account/quickstart/mobile-integration) +- [Web (HTML + JS)](https://docs.base.org/base-account/quickstart/web): Integrate Sign in with Base and Base Pay using nothing but HTML and JavaScript. +- [Web (Next.js)](https://docs.base.org/base-account/quickstart/web-react): Quickly add Sign in with Base and Base Pay to any Next.js app +- [subscription.charge](https://docs.base.org/base-account/reference/base-pay/charge): Execute subscription charges from your backend using CDP server wallets +- [subscription.getOrCreateSubscriptionOwnerWallet](https://docs.base.org/base-account/reference/base-pay/getOrCreateSubscriptionOwnerWallet): Create or retrieve a CDP smart wallet to act as subscription owner +- [getPaymentStatus](https://docs.base.org/base-account/reference/base-pay/getPaymentStatus): Check the status of a payment transaction +- [subscription.getStatus](https://docs.base.org/base-account/reference/base-pay/getStatus): Check the status and details of an existing subscription +- [pay](https://docs.base.org/base-account/reference/base-pay/pay): Send USDC payments on the Base network +- [subscription.prepareCharge](https://docs.base.org/base-account/reference/base-pay/prepareCharge): Prepare transaction calls to charge a subscription (advanced) +- [subscription.prepareRevoke](https://docs.base.org/base-account/reference/base-pay/prepareRevoke): Prepare transaction calls to revoke a subscription (advanced) +- [subscription.revoke](https://docs.base.org/base-account/reference/base-pay/revoke): Revoke subscriptions from your backend using CDP server wallets +- [subscription.subscribe](https://docs.base.org/base-account/reference/base-pay/subscribe): Create USDC subscriptions with spend permissions on Base network +- [Subscriptions Overview](https://docs.base.org/base-account/reference/base-pay/subscriptions-overview): Accept recurring USDC payments using spend permissions on Base +- [atomic](https://docs.base.org/base-account/reference/core/capabilities/atomic): Ensures batched transactions are executed atomically and contiguously +- [auxiliaryFunds](https://docs.base.org/base-account/reference/core/capabilities/auxiliaryFunds): Indicates wallet access to funds beyond on-chain balance verification +- [dataCallback](https://docs.base.org/base-account/reference/core/capabilities/datacallback): Base Account allows you to collect personal information like email addresses, physical addresses, phone numbers, and names during transactions. +- [dataSuffix](https://docs.base.org/base-account/reference/core/capabilities/dataSuffix): Append arbitrary data to transaction calldata for attribution tracking +- [flowControl](https://docs.base.org/base-account/reference/core/capabilities/flowControl): Control transaction batch behavior after failed or reverted calls +- [gasLimitOverride](https://docs.base.org/base-account/reference/core/capabilities/gasLimitOverride): Override gas limits for individual calls in a wallet_sendCalls batch +- [paymasterService](https://docs.base.org/base-account/reference/core/capabilities/paymasterService): Enable sponsored transactions using ERC-4337 paymaster web services +- [signInWithEthereum](https://docs.base.org/base-account/reference/core/capabilities/signInWithEthereum): Enable secure authentication using the Sign-In With Ethereum (SIWE) standard +- [createBaseAccountSDK](https://docs.base.org/base-account/reference/core/createBaseAccount): Create a Base Account SDK instance with EIP-1193 compliant provider +- [generateKeyPair](https://docs.base.org/base-account/reference/core/generateKeyPair): Generate a new P256 key pair for use with Base Account +- [getCryptoKeyAccount](https://docs.base.org/base-account/reference/core/getCryptoKeyAccount): Retrieve the current crypto key account associated with the user's session +- [getKeypair](https://docs.base.org/base-account/reference/core/getKeypair): Retrieve an existing P256 key pair from storage +- [getProvider](https://docs.base.org/base-account/reference/core/getProvider): Get an Ethereum provider instance from the Base Account SDK +- [coinbase_fetchPermission](https://docs.base.org/base-account/reference/core/provider-rpc-methods/coinbase_fetchPermission): Retrieve a single permission by its hash +- [coinbase_fetchPermissions](https://docs.base.org/base-account/reference/core/provider-rpc-methods/coinbase_fetchPermissions): Retrieve permissions for a specific spender and chain, optionally filtered by account +- [eth_accounts](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_accounts): Returns a list of addresses owned by the connected wallet without prompting user authorization +- [eth_blockNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_blockNumber): Get the number of the most recent block +- [eth_chainId](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_chainId): Get the currently configured chain ID +- [eth_coinbase](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_coinbase): Get the client coinbase address +- [eth_estimateGas](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_estimateGas): Estimate gas needed for a transaction +- [eth_feeHistory](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_feeHistory): Get historical gas fee information for a range of blocks +- [eth_gasPrice](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_gasPrice): Get the current gas price +- [eth_getBalance](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBalance): Get the balance of an account at a given block +- [eth_getBlockByHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockByHash): Get information about a block by block hash +- [eth_getBlockByNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockByNumber): Get information about a block by block number +- [eth_getBlockTransactionCountByHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockTransactionCountByHash): Get the number of transactions in a block by block hash +- [eth_getBlockTransactionCountByNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockTransactionCountByNumber): Get the number of transactions in a block by block number +- [eth_getCode](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getCode): Get the bytecode at a given address +- [eth_getLogs](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getLogs): Get an array of all logs matching a given filter object +- [eth_getProof](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getProof): Get the Merkle proof for account and storage values +- [eth_getStorageAt](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getStorageAt): Get the value from a storage position at a given address +- [eth_getTransactionByBlockHashAndIndex](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionByBlockHashAndIndex): Get a transaction by block hash and transaction index position +- [eth_getTransactionByBlockNumberAndIndex](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionByBlockNumberAndIndex): Get a transaction by block number and transaction index position +- [eth_getTransactionByHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionByHash): Get transaction details by transaction hash +- [eth_getTransactionCount](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionCount): Get the number of transactions sent from an address +- [eth_getTransactionReceipt](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionReceipt): Get the receipt of a transaction by transaction hash +- [eth_getUncleCountByBlockHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getUncleCountByBlockHash): Get the number of uncles in a block by block hash +- [eth_getUncleCountByBlockNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getUncleCountByBlockNumber): Get the number of uncles in a block by block number +- [eth_requestAccounts](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_requestAccounts): Request account access and authorization from the user +- [eth_sendRawTransaction](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_sendRawTransaction): Submit a signed transaction to the network +- [eth_sendTransaction](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_sendTransaction): Create and send a new transaction or message call +- [eth_signTypedData_v4](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_signTypedData_v4): Sign structured data according to EIP-712 +- [personal_sign](https://docs.base.org/base-account/reference/core/provider-rpc-methods/personal_sign): Sign data using a specific account with Ethereum-specific signature format +- [Overview](https://docs.base.org/base-account/reference/core/provider-rpc-methods/request-overview) +- [SDK Overview](https://docs.base.org/base-account/reference/core/provider-rpc-methods/sdk-overview) +- [Standard RPC Methods](https://docs.base.org/base-account/reference/core/provider-rpc-methods/standard-rpc-methods): Standard Ethereum RPC methods supported by Base Account +- [wallet_addEthereumChain](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_addEthereumChain): Add a new Ethereum chain to the wallet +- [wallet_addSubAccount](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_addSubAccount): Add a sub account to the wallet +- [wallet_connect](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_connect): Connect wallet and request account access +- [wallet_getCallsStatus](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_getCallsStatus): Get the status of a call batch sent via wallet_sendCalls +- [wallet_getCapabilities](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_getCapabilities): Get the wallet's supported capabilities for the given account +- [wallet_getSubAccounts](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_getSubAccounts): Fetch the sub accounts of the wallet +- [wallet_sendCalls](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_sendCalls): Submit a batch of calls to the wallet for execution +- [wallet_switchEthereumChain](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_switchEthereumChain): Switch the wallet to a different Ethereum chain +- [wallet_watchAsset](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_watchAsset): Add a token to the wallet's asset watchlist +- [web3_clientVersion](https://docs.base.org/base-account/reference/core/provider-rpc-methods/web3_clientVersion): Get the current client version +- [SDK Utilities](https://docs.base.org/base-account/reference/core/sdk-utilities): Core utility functions for key management and account access +- [Basenames](https://docs.base.org/base-account/reference/onchain-contracts/basenames): Decentralized naming system that allows users to register human-readable names (like 'alice.base.eth') on Base. +- [Smart Wallet](https://docs.base.org/base-account/reference/onchain-contracts/smart-wallet): ERC-4337 compliant smart contract wallet that serves as the foundation for Base Account. +- [Spend Permissions](https://docs.base.org/base-account/reference/onchain-contracts/spend-permissions) +- [createProlinkUrl](https://docs.base.org/base-account/reference/prolink-utilities/createProlinkUrl): Create a link with a prolink query parameter +- [decodeProlink](https://docs.base.org/base-account/reference/prolink-utilities/decodeProlink): Decode a prolink payload back to a JSON-RPC request +- [encodeProlink](https://docs.base.org/base-account/reference/prolink-utilities/encodeProlink): Encode a JSON-RPC request into a compressed, URL-safe prolink payload +- [fetchPermission](https://docs.base.org/base-account/reference/spend-permission-utilities/fetchPermission): Retrieve a single Spend Permission by its hash +- [fetchPermissions](https://docs.base.org/base-account/reference/spend-permission-utilities/fetchPermissions): Retrieve available Spend Permissions for an account and chain, optionally filtered by spender +- [getPermissionStatus](https://docs.base.org/base-account/reference/spend-permission-utilities/getPermissionStatus): Gets the current status of a Spend Permission +- [prepareRevokeCallData](https://docs.base.org/base-account/reference/spend-permission-utilities/prepareRevokeCallData): Construct calldata so your app's spender can revoke a Spend Permission without user interaction +- [prepareSpendCallData](https://docs.base.org/base-account/reference/spend-permission-utilities/prepareSpendCallData): Prepare calldata to approve (if needed) and spend using a Spend Permission +- [requestRevoke](https://docs.base.org/base-account/reference/spend-permission-utilities/requestRevoke): Request the user's approval to revoke a Spend Permission +- [requestSpendPermission](https://docs.base.org/base-account/reference/spend-permission-utilities/requestSpendPermission): Create and sign an EIP-712 Spend Permission for a user's Base Account +- [BasePayButton](https://docs.base.org/base-account/reference/ui-elements/base-pay-button): Pre-built React component for accepting payments with Base Account +- [Brand Guidelines](https://docs.base.org/base-account/reference/ui-elements/brand-guidelines): Design and brand guidelines for Sign in With Base and Base Pay buttons +- [SignInWithBaseButton](https://docs.base.org/base-account/reference/ui-elements/sign-in-with-base-button): Pre-built React component for user authentication with Base Account + +## AI Agents +- [AI Agents on Base](https://docs.base.org/ai-agents/index): Build AI agents that trade, earn, and transact autonomously on Base +- [Overview](https://docs.base.org/ai-agents/skills/index): Installable agent capabilities for wallets, payments, and trading on Base +- [Accepting Payments (x402)](https://docs.base.org/ai-agents/payments/accepting-payments): Gate your agent's endpoints with x402 to charge other agents per request +- [Pay for APIs & Services (x402)](https://docs.base.org/ai-agents/payments/pay-for-services-with-x402): How x402 works, how your agent makes payments, and which networks and tokens are supported +- [Get Started with Payments](https://docs.base.org/ai-agents/quickstart/payments): Build an agent that makes and accepts x402 payments on Base in under 10 minutes +- [Get Started with Trading](https://docs.base.org/ai-agents/quickstart/trading): Build an agent that fetches live market data and executes token swaps on Base +- [Builder Codes for Agents](https://docs.base.org/ai-agents/setup/agent-builder-codes): Register your agent on Base.dev and append a Builder Code to every transaction to measure onchain activity. +- [Agent Registration & Identity](https://docs.base.org/ai-agents/setup/agent-registration): Register your agent's identity onchain, get a Basename, and authenticate with services using Sign In With Agent (SIWA) +- [Wallet Setup for Agents](https://docs.base.org/ai-agents/setup/wallet-setup): Give your AI agent a dedicated wallet on Base to hold funds, send payments, sign messages, and interact with onchain protocols securely. +- [CDP Payment Skills](https://docs.base.org/ai-agents/skills/payments/cdp-payment-skills): Skills for discovering, paying for, and monetizing x402 API services via the CDP Agentic Wallet +- [Sponge x402](https://docs.base.org/ai-agents/skills/payments/sponge-x402): Skill for discovering and paying for x402 services automatically using Sponge Wallet's built-in proxy +- [Alchemy Agentic Gateway](https://docs.base.org/ai-agents/skills/trading/alchemy-agentic-gateway): Skill for accessing Alchemy's blockchain APIs — token balances, NFTs, portfolio data, and prices — via x402 SIWE auth +- [CoinGecko](https://docs.base.org/ai-agents/skills/trading/coingecko): Skill for fetching live crypto price feeds, market cap, and OHLCV data via x402 — no API key required +- [Swap Execution](https://docs.base.org/ai-agents/skills/trading/swap-execution): Skills for executing token swaps on Base using wallet-native tools across Bankr, CDP Agentic Wallet, and Sponge +- [Bankr](https://docs.base.org/ai-agents/skills/wallets/bankr): Skill that gives your AI agent a cross-chain wallet with built-in swaps, gas sponsorship, and token launching +- [CDP Agentic Wallet](https://docs.base.org/ai-agents/skills/wallets/cdp-agentic-wallet): Skill that gives your AI agent an email-authenticated wallet on Base with x402 payments built in +- [Sponge Wallet](https://docs.base.org/ai-agents/skills/wallets/sponge-wallet): Skill that gives your AI agent a multi-chain wallet with native x402 payments, swaps, bridges, and banking +- [Fetching Market Data](https://docs.base.org/ai-agents/trading/data-fetching): Use x402 to access live market data from CoinGecko, Alchemy, and other sources — no API key management required +- [Trade Execution on Base](https://docs.base.org/ai-agents/trading/trade-execution): Base-specific patterns, fee calibration, and onchain signals for trading agents + +## Apps +- [Build an app on Base](https://docs.base.org/apps/index): A step-by-step guide to building a Next.js tally app on Base using wagmi and viem, with wallet connection, contract reads and writes, and batch transaction support. +- [Builder Codes for Agent Developers](https://docs.base.org/apps/builder-codes/agent-developers): Attribute your AI agent's onchain transactions to your identity on Base and unlock analytics and leaderboard features. +- [Builder Codes for App Developers](https://docs.base.org/apps/builder-codes/app-developers): Integrate Builder Codes into your app using Wagmi or Viem to attribute onchain activity. +- [Base Builder Codes](https://docs.base.org/apps/builder-codes/builder-codes): Attribute onchain activity to your app, wallet or agent with Builder Codes. +- [Builder Codes for Wallet Developers](https://docs.base.org/apps/builder-codes/wallet-developers): Implement the dataSuffix capability in your wallet to enable Builder Code attribution. +- [Rewards](https://docs.base.org/apps/growth/rewards): Earn financial incentives for building high-quality Apps that drive user engagement and onchain transactions +- [Migrate to a Standard Web App](https://docs.base.org/apps/guides/migrate-to-standard-web-app): Migrate your Farcaster mini-app to work in the Base App. Covers replacing deprecated SDK methods, and registering on Base.dev. +- [Build an app on Base](https://docs.base.org/apps/quickstart/build-app): A step-by-step guide to building a Next.js tally app on Base using wagmi and viem, with wallet connection, contract reads and writes, and batch transaction support. +- [Add notifications](https://docs.base.org/apps/technical-guides/base-notifications): Send in-app notifications to your app's users through the Base Dashboard REST API. + +## Optional +- [Base MCP server](https://docs.base.org/mcp): Direct AI access to Base documentation +- [Base skills](https://github.com/base/skills): Installable agent skills (`npx skills add base/base-skills`) +- [Index (llms.txt)](https://docs.base.org/llms.txt): Strict-spec section index without the full-context extras + + diff --git a/docs/llms.txt b/docs/llms.txt index 486790237..9e763930c 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -1,125 +1,319 @@ -# https://docs.base.org/llms.txt +# Base Documentation -## Base Documentation — LLM Entry Point -> High‑signal index of section guides. Jump to a section's llms.txt for concise intros, curated links, and fast navigation. +> Build on Base — Coinbase's Ethereum L2. Smart Wallet, OnchainKit, MiniKit, Base Chain RPCs, and AI Agents. This index points AI assistants at the canonical page for each topic; follow the links for full context. -- [Get Started](./get-started/llms.txt) — Orientation, products, use cases, and quickstarts -- [Base Chain](./base-chain/llms.txt) — Deploy/connect, network info, tools, node ops, security -- [Base Account](./base-account/llms.txt) — Passkey smart wallet, payments, social verification, spend permissions, sponsored gas, sub‑accounts -- [AI Agents](./ai-agents/llms.txt) — Build onchain AI agents: wallets, payments, identity, trading, and installable skills -- [Apps](./apps/llms.txt) — Build apps on Base, migrate to standard web apps, register on Base.dev, earn rewards +## Get Started +- [Base](https://docs.base.org/get-started/base): The #1 Ethereum Layer 2, incubated by Coinbase +- [Base Mentorship Program](https://docs.base.org/get-started/base-mentorship-program): Connect with experienced builders and industry leaders to accelerate your journey on Base +- [Base Services Hub](https://docs.base.org/get-started/base-services-hub): A collection of services for building on Base. +- [Block Explorers](https://docs.base.org/get-started/block-explorers): Documentation for block explorers for the Base network. +- [Core Concepts](https://docs.base.org/get-started/concepts) +- [Country Leads & Ambassadors](https://docs.base.org/get-started/country-leads-and-ambassadors): Connect with local Base community leaders and ambassadors around the world +- [Data Indexers](https://docs.base.org/get-started/data-indexers): Documentation for data indexing platforms for Base network. +- [Deploy Smart Contracts](https://docs.base.org/get-started/deploy-smart-contracts): Step-by-step guide to deploying smart contracts on Base. +- [Static Docs Files](https://docs.base.org/get-started/docs-llms): Use llms.txt and llms-full.txt to give AI assistants access to Base documentation. +- [MCP Server](https://docs.base.org/get-started/docs-mcp): Connect your AI coding assistant to Base documentation using Model Context Protocol for real-time access. +- [Get Funded](https://docs.base.org/get-started/get-funded): The Base ecosystem offers multiple funding pathways designed specifically for builders at every stage—from weekend experiments to full-scale ventures. +- [Launch a Token](https://docs.base.org/get-started/launch-token) +- [Learning Resources](https://docs.base.org/get-started/learning-resources): Find educational content for learning Solidity, Ethereum, and blockchain development +- [Developer's Guide to Effective AI Prompting](https://docs.base.org/get-started/prompt-library): Learn practical AI prompting techniques to enhance your coding workflow and get better results from AI coding assistants. +- [Resources for AI agents](https://docs.base.org/get-started/resources-for-ai-agents): Base-first resources for AI agents, including docs indexes, MCP access, skills, and recommended starting points -## Tools available for AI assistants +## Base Chain +- [Flashblocks Overview](https://docs.base.org/base-chain/flashblocks/overview): Understand the sequencer architecture, block building algorithm, and integration options for Flashblocks on Base. +- [Base Change Proposals (BCPs)](https://docs.base.org/base-chain/specs/bcps/index): Index of Base Chain Proposals (BCPs) — design documents describing proposed changes to the Base Chain protocol. +- [Overview](https://docs.base.org/base-chain/specs/overview): Technical specification of the Base Chain protocol, covering block derivation, execution, transaction propagation, and state verification. +- [Specification](https://docs.base.org/base-chain/specs/protocol/consensus/index): Specification of the Base rollup node, describing its components and role in L2 block derivation and consensus. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/protocol/execution/index): Specification of the L2 execution engine, detailing EIP-1559 parameters, fee vaults, Engine API usage, and execution layer behavior. +- [Fault Proof](https://docs.base.org/base-chain/specs/protocol/fault-proof/index): Overview of the Base fault proof system, describing the program, virtual machine, and interactive dispute game components that verify L2 state. +- [Stage One Decentralization](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/index): Specification of the stage one fault proof system for Base Chain decentralization, covering output proposals and dispute game integration. +- [Overview](https://docs.base.org/base-chain/specs/protocol/overview): High-level overview of the Base Chain protocol, covering rollup architecture, core components, and user flows for deposits, transactions, and withdrawals. +- [Azul](https://docs.base.org/base-chain/specs/upgrades/azul/overview): Overview of the Azul hardfork, introducing Osaka EVM support, a simplified execution client, and a multi-proof system for L2 checkpoints. +- [Canyon](https://docs.base.org/base-chain/specs/upgrades/canyon/overview): Overview of the Canyon hardfork, bringing Ethereum Shanghai EIPs (EIP-3651, EIP-3855, EIP-3860) to the Base execution layer. +- [Delta](https://docs.base.org/base-chain/specs/upgrades/delta/overview): Overview of the Delta hardfork, introducing span batches to reduce L1 data costs by compressing multiple L2 blocks into single batcher transactions. +- [Ecotone](https://docs.base.org/base-chain/specs/upgrades/ecotone/overview): Overview of the Ecotone hardfork, integrating Ethereum Dencun changes including EIP-4844 blob transactions and EIP-4788 beacon block roots. +- [Fjord](https://docs.base.org/base-chain/specs/upgrades/fjord/overview): Overview of the Fjord hardfork, introducing FastLZ-based L1 fee estimation, the RIP-7212 secp256r1 precompile, and brotli channel compression. +- [Granite](https://docs.base.org/base-chain/specs/upgrades/granite/overview): Overview of the Granite hardfork, adding bn256Pairing precompile input size restrictions and CHANNEL_TIMEOUT parameter changes. +- [Holocene](https://docs.base.org/base-chain/specs/upgrades/holocene/overview): Overview of the Holocene hardfork, introducing dynamic EIP-1559 parameters configurable via SystemConfig and stricter block derivation rules. +- [Isthmus](https://docs.base.org/base-chain/specs/upgrades/isthmus/overview): Overview of the Isthmus hardfork, incorporating Ethereum Pectra EIPs and introducing the operator fee mechanism for sequencer revenue. +- [Jovian](https://docs.base.org/base-chain/specs/upgrades/jovian/overview): Overview of the Jovian hardfork, introducing a configurable minimum base fee and a DA footprint gas scalar for improved fee market stability. +- [Pectra Blob Schedule (Sepolia)](https://docs.base.org/base-chain/specs/upgrades/pectra-blob-schedule/overview): Overview of the Pectra Blob Schedule hardfork, an optional upgrade that delays adoption of Ethereum's increased blob count schedule on Base. +- [debug_traceBlockByHash](https://docs.base.org/base-chain/api-reference/debug-api/debug_traceBlockByHash): Returns EVM execution traces for all transactions in a block by block hash. +- [debug_traceBlockByNumber](https://docs.base.org/base-chain/api-reference/debug-api/debug_traceBlockByNumber): Returns EVM execution traces for all transactions in a block by block number. +- [debug_traceTransaction](https://docs.base.org/base-chain/api-reference/debug-api/debug_traceTransaction): Returns the full EVM execution trace for a transaction. Requires a node with debug APIs enabled. +- [eth_blockNumber](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_blockNumber): Returns the number of the most recently mined block. +- [eth_call](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_call): Executes a message call without creating a transaction. Use pending on a Flashblocks endpoint to simulate against pre-confirmed state. +- [eth_chainId](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_chainId): Returns the chain ID of the current network. +- [eth_estimateGas](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_estimateGas): Estimates the gas required for a transaction. Use pending on a Flashblocks endpoint to estimate against pre-confirmed state. +- [eth_feeHistory](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_feeHistory): Returns historical base fees and priority fee percentiles for a range of blocks. +- [eth_gasPrice](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_gasPrice): Returns the current gas price in wei. +- [eth_getBalance](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBalance): Returns the ETH balance of an account at a given block. Use the pending tag on a Flashblocks endpoint for 200ms pre-confirmed balances. +- [eth_getBlockByHash](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockByHash): Returns block information by block hash. +- [eth_getBlockByNumber](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockByNumber): Returns block information by number. On Flashblocks endpoints, the pending tag returns the live pre-confirmed block updated every ~200ms. +- [eth_getBlockReceipts](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockReceipts): Returns all transaction receipts for a block. Use pending on a Flashblocks endpoint for pre-confirmed receipts. +- [eth_getBlockTransactionCountByHash](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockTransactionCountByHash): Returns the number of transactions in a block by block hash. +- [eth_getBlockTransactionCountByNumber](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getBlockTransactionCountByNumber): Returns the number of transactions in a block by block number. +- [eth_getCode](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getCode): Returns the contract bytecode at an address. Use pending on a Flashblocks endpoint to detect newly deployed contracts before block finalization. +- [eth_getLogs](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getLogs): Returns logs matching a filter. Use pending on a Flashblocks endpoint to query logs from pre-confirmed transactions. +- [eth_getStorageAt](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getStorageAt): Returns the value of a storage slot at an address. Use pending on a Flashblocks endpoint for pre-confirmed storage reads. +- [eth_getTransactionByBlockHashAndIndex](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionByBlockHashAndIndex): Returns a transaction by block hash and index position. +- [eth_getTransactionByBlockNumberAndIndex](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionByBlockNumberAndIndex): Returns a transaction by block number and index position. +- [eth_getTransactionByHash](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionByHash): Returns a transaction by its hash. +- [eth_getTransactionCount](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionCount): Returns the number of transactions sent from an address (the nonce). Use pending on a Flashblocks endpoint to get the pre-confirmed nonce. +- [eth_getTransactionReceipt](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_getTransactionReceipt): Returns the receipt for a mined transaction. Receipts are only available after a transaction is included in a block. +- [eth_maxPriorityFeePerGas](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_maxPriorityFeePerGas): Returns the suggested EIP-1559 priority fee (tip) per gas. +- [eth_sendRawTransaction](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_sendRawTransaction): Submits a pre-signed transaction to the network. Submit to a Flashblocks preconf endpoint to get 200ms pre-confirmation. +- [eth_subscribe](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_subscribe): Creates a real-time WebSocket subscription. Flashblocks endpoints add three extra subscription types and emit newHeads every ~200ms. +- [eth_syncing](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_syncing): Returns the sync status of the node. +- [eth_unsubscribe](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/eth_unsubscribe): Cancels an active WebSocket subscription. +- [net_version](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/net_version): Returns the current network ID as a string. +- [web3_clientVersion](https://docs.base.org/base-chain/api-reference/ethereum-json-rpc-api/web3_clientVersion): Returns the current client version string. +- [base_transactionStatus](https://docs.base.org/base-chain/api-reference/flashblocks-api/base_transactionStatus): Checks whether a transaction is in the node mempool. Only available on Flashblocks endpoints. +- [eth_simulateV1](https://docs.base.org/base-chain/api-reference/flashblocks-api/eth_simulateV1): Simulates one or more transaction bundles against the current pre-confirmed Flashblock state. Only available on Flashblocks endpoints. +- [Overview](https://docs.base.org/base-chain/api-reference/flashblocks-api/flashblocks-api-overview): Flashblocks-specific RPC methods, WebSocket subscriptions, and the infrastructure stream schema for Base pre-confirmations. +- [newFlashblocks](https://docs.base.org/base-chain/api-reference/flashblocks-api/newFlashblocks): Subscribe to receive full Flashblock payload stream as each pre-confirmed block is built. Only available on Flashblocks WebSocket endpoints. +- [newFlashblockTransactions](https://docs.base.org/base-chain/api-reference/flashblocks-api/newFlashblockTransactions): Subscribe to receive each transaction as it is pre-confirmed into a Flashblock. Only available on Flashblocks WebSocket endpoints. +- [pendingLogs](https://docs.base.org/base-chain/api-reference/flashblocks-api/pendingLogs): Subscribe to logs from pre-confirmed transactions matching an optional filter. Only available on Flashblocks WebSocket endpoints. +- [Base RPC Overview](https://docs.base.org/base-chain/api-reference/rpc-overview): Complete reference for all JSON-RPC and Flashblocks methods available on Base nodes. +- [App Integration](https://docs.base.org/base-chain/flashblocks/app-integration): Integrate Flashblocks into your app for 200ms transaction confirmations using RPC APIs and popular libraries like Ethers, Wagmi and Viem. +- [Flashblocks Architecture](https://docs.base.org/base-chain/flashblocks/architecture): Understand the sequencer architecture and infrastructure components that power Flashblocks on Base. +- [Flashblocks FAQ](https://docs.base.org/base-chain/flashblocks/faq): Frequently asked questions about Flashblocks, including block building, WebSocket data, RPC usage, and node setup. +- [Contract Addresses](https://docs.base.org/base-chain/network-information/base-contracts): A comprehensive list of L2 contract addresses for Base Mainnet and Base Testnet, including links to their respective blockchain explorers. +- [Block Building](https://docs.base.org/base-chain/network-information/block-building): This page outlines how Base blocks are built. +- [Bridges](https://docs.base.org/base-chain/network-information/bridges): Documentation for bridging assets to Base. This page covers how to bridge assets between Ethereum, Solana, Bitcoin, and Base. +- [Configuration Changelog](https://docs.base.org/base-chain/network-information/configuration-changelog): A log of configuration changes to the Base networks. +- [Differences between Ethereum and Base](https://docs.base.org/base-chain/network-information/diffs-ethereum-base) +- [Ecosystem Contracts](https://docs.base.org/base-chain/network-information/ecosystem-contracts) +- [Network Faucets](https://docs.base.org/base-chain/network-information/network-faucets): Documentation for Testnet Faucets on the Base network. +- [Network Fees](https://docs.base.org/base-chain/network-information/network-fees): Documentation about network fees on Base. This page covers details of the two-component cost system involving L2 execution fees and L1 security fees, and offers insights on fee variations and cost-saving strategies. +- [Transaction Finality](https://docs.base.org/base-chain/network-information/transaction-finality): Detailed information about transaction finality on Base. +- [Troubleshooting Transactions](https://docs.base.org/base-chain/network-information/troubleshooting-transactions): Guide to diagnosing and resolving transaction issues on Base. +- [Base Azul Upgrade](https://docs.base.org/base-chain/node-operators/base-v1-upgrade): Migrate your Base node to base-reth-node and base-consensus for Azul. +- [Node Providers](https://docs.base.org/base-chain/node-operators/node-providers): Documentation for Node Providers for the Base network. Including details on their services, supported networks, and pricing plans. +- [Node Performance](https://docs.base.org/base-chain/node-operators/performance-tuning): Hardware specifications, storage requirements, client recommendations, and configuration settings for running a performant Base node. +- [Run a Node](https://docs.base.org/base-chain/node-operators/run-a-base-node): A tutorial that teaches how to set up and run a Base Node. +- [Node Snapshots](https://docs.base.org/base-chain/node-operators/snapshots): Download and restore Base node snapshots to significantly reduce initial sync time for both archive and pruned nodes. +- [Node Troubleshooting](https://docs.base.org/base-chain/node-operators/troubleshooting): Solutions to common issues when setting up and running a Base node, covering sync problems, networking, snapshots, and performance. +- [Base-Solana Bridge](https://docs.base.org/base-chain/quickstart/base-solana-bridge): Bridge tokens and messages between Base and Solana Mainnet +- [Connecting to Base](https://docs.base.org/base-chain/quickstart/connecting-to-base): Documentation about Base Mainnet and Base Testnet. This page covers network information for the Base network, including network names, descriptions, RPC endpoints, chain IDs, currency symbols, and block explorers. +- [Deploy on Base](https://docs.base.org/base-chain/quickstart/deploy-on-base) +- [Why Base?](https://docs.base.org/base-chain/quickstart/why-base) +- [How to avoid getting your app flagged as malicious](https://docs.base.org/base-chain/security/avoid-malicious-flags): The Base bug bounty program and procedures for reporting vulnerabilities. +- [Bug Bounty](https://docs.base.org/base-chain/security/bug-bounty) +- [Reporting Vulnerabilities](https://docs.base.org/base-chain/security/report-vulnerability): The Base procedures for reporting vulnerabilities. +- [Security Council for Base](https://docs.base.org/base-chain/security/security-council): This page outlines the purpose, goals, structure, and responsibilities of the Security Council for Base. +- [BCP-0000: BCP Process](https://docs.base.org/base-chain/specs/bcps/bcp-0000): BCP-0000 defines the Base Change Proposal process, establishing the template and standards for proposing, reviewing, and accepting protocol changes. +- [Batcher](https://docs.base.org/base-chain/specs/protocol/batcher): Specification of the batcher (batch submitter), the component responsible for posting L2 sequencer data to L1 for data availability. +- [Standard Bridges](https://docs.base.org/base-chain/specs/protocol/bridging/bridges): Specification of the standard bridges enabling cross-domain ETH and ERC20 token transfers between L1 and L2 on Base. +- [Deposits](https://docs.base.org/base-chain/specs/protocol/bridging/deposits): Specification of the deposit mechanism for Base, detailing how L1 transactions are converted into L2 deposit transactions. +- [Cross Domain Messengers](https://docs.base.org/base-chain/specs/protocol/bridging/messengers): Specification of the cross-domain messenger contracts, providing a higher-level API for sending messages between L1 and L2 on Base. +- [Withdrawals](https://docs.base.org/base-chain/specs/protocol/bridging/withdrawals): Specification of the withdrawal mechanism for Base, describing how L2 state is proven on L1 and funds are released from the bridge. +- [Derivation](https://docs.base.org/base-chain/specs/protocol/consensus/derivation): Specification of the L2 chain derivation pipeline, describing how L2 blocks are deterministically derived from L1 data and sequencer batches. +- [P2P](https://docs.base.org/base-chain/specs/protocol/consensus/p2p): Specification of the rollup node peer-to-peer network, covering node discovery, gossip protocol, and unsafe block propagation. +- [RPC](https://docs.base.org/base-chain/specs/protocol/consensus/rpc): Specification of the rollup node RPC interface, including the optimism_outputAtBlock method for retrieving L2 output roots. +- [Precompiles](https://docs.base.org/base-chain/specs/protocol/execution/evm/precompiles): Specification of precompiled contracts on Base, including native EVM implementations available at predefined addresses. +- [Predeploys](https://docs.base.org/base-chain/specs/protocol/execution/evm/predeploys): Specification of predeployed smart contracts on Base, including system contracts deployed at predetermined addresses in genesis state. +- [Preinstalls](https://docs.base.org/base-chain/specs/protocol/execution/evm/preinstalls): Specification of preinstalled smart contracts on Base, including utility contracts deployed in genesis state that run directly in the EVM. +- [Multithreaded Cannon Fault Proof Virtual Machine](https://docs.base.org/base-chain/specs/protocol/fault-proof/cannon-fault-proof-vm): Specification of the Cannon Fault Proof Virtual Machine (FPVM), the multithreaded VM used for executing programs in dispute game resolution. +- [Proposer](https://docs.base.org/base-chain/specs/protocol/fault-proof/proposer): Specification of the L2 output proposer, which publishes L2 output roots and withdrawal hashes to L1 for use in the fault proof system. +- [AnchorStateRegistry](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/anchor-state-registry): Specification of the AnchorStateRegistry contract, which stores verified dispute game results as anchor states for new dispute game instances. +- [Bond Incentives](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/bond-incentives): Specification of the bond incentive system for the Fault Dispute Game, adding financial rewards and penalties to enforce honest challenger behavior. +- [Bridge Integration](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/bridge-integration): Specification of how fault proofs integrate with the Base bridge, replacing the trusted proposer withdrawal path with dispute-game-based proof verification. +- [Dispute Game Interface](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/dispute-game-interface): Specification of the dispute game interface, defining the common contract interface for games that resolve contested L2 state claims. +- [Fault Dispute Game](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/fault-dispute-game): Specification of the Fault Dispute Game (FDG), a bisection-based protocol for verifying the validity of L2 output roots via interactive dispute resolution. +- [Honest Challenger (Fault Dispute Game)](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/honest-challenger-fdg): Specification of the honest challenger agent in the Fault Dispute Game, defining correct behavior for supporting valid claims and disputing invalid ones. +- [OptimismPortal](https://docs.base.org/base-chain/specs/protocol/fault-proof/stage-one/optimism-portal): Specification of the OptimismPortal contract, the primary L1 interface for deposits and withdrawals between L1 and L2 on Base. +- [Configuration](https://docs.base.org/base-chain/specs/reference/configurability): Reference for Base Chain configuration parameters across consensus, policy, admin, and sequencer categories. +- [Glossary](https://docs.base.org/base-chain/specs/reference/glossary): Glossary of terms and definitions used throughout the Base Chain protocol specification. +- [Azul: Execution Engine](https://docs.base.org/base-chain/specs/upgrades/azul/exec-engine): Execution engine changes in the Azul hardfork, including the EIP-7825 transaction gas limit cap and secp256r1 precompile cost updates. +- [Azul: Proof System](https://docs.base.org/base-chain/specs/upgrades/azul/proofs): Specification of the Azul multi-proof system, replacing the single output proposer with an AggregateVerifier contract for L2 checkpoint security. +- [Span-batches](https://docs.base.org/base-chain/specs/upgrades/delta/span-batches): Specification of span batches introduced in Delta, a new batch format that compresses sequences of L2 blocks for more efficient L1 data posting. +- [Derivation](https://docs.base.org/base-chain/specs/upgrades/ecotone/derivation): Derivation changes in the Ecotone upgrade, extending the retrieval stage to support EIP-4844 blobs as an additional data availability source. +- [Ecotone L1 Attributes](https://docs.base.org/base-chain/specs/upgrades/ecotone/l1-attributes): L1 attributes transaction changes in the Ecotone upgrade, updating calldata format to support the new blob-based fee calculation model. +- [Fjord L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/fjord/derivation): Derivation changes in the Fjord upgrade, updating protocol parameters for max sequencer drift, channel bank size, and adding brotli compression support. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/fjord/exec-engine): Execution engine changes in the Fjord upgrade, replacing the L1 cost fee estimator with a FastLZ-based compression model. +- [Predeploys](https://docs.base.org/base-chain/specs/upgrades/fjord/predeploys): Predeploy changes in the Fjord upgrade, adding FastLZ fee computation constants to the GasPriceOracle contract. +- [Granite L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/granite/derivation): Derivation changes in the Granite upgrade, updating the CHANNEL_TIMEOUT protocol parameter. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/granite/exec-engine): Execution engine changes in the Granite upgrade, restricting bn256Pairing precompile input size to prevent unbounded gas consumption. +- [Holocene L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/holocene/derivation): Derivation changes in the Holocene upgrade, introducing stricter pipeline rules that simplify derivation and improve fault proof worst-case behavior. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/holocene/exec-engine): Execution engine changes in the Holocene upgrade, enabling dynamic EIP-1559 parameters encoded in block headers and configured via SystemConfig. +- [System Config](https://docs.base.org/base-chain/specs/upgrades/holocene/system-config): SystemConfig changes in the Holocene upgrade, adding dynamic EIP-1559 parameter configuration via ConfigUpdate events. +- [Isthmus L2 Chain Derivation Changes](https://docs.base.org/base-chain/specs/upgrades/isthmus/derivation): Derivation changes in the Isthmus upgrade, specifying network upgrade automation transactions executed at hardfork activation. +- [L2 Execution Engine](https://docs.base.org/base-chain/specs/upgrades/isthmus/exec-engine): Execution engine changes in the Isthmus upgrade, including L2ToL1MessagePasser storage root in block headers and operator fee collection. +- [L1 Block Attributes](https://docs.base.org/base-chain/specs/upgrades/isthmus/l1-attributes): L1 attributes transaction changes in the Isthmus upgrade, extending calldata to include operator fee scalar and constant parameters. +- [Predeploys](https://docs.base.org/base-chain/specs/upgrades/isthmus/predeploys): Predeploy changes in the Isthmus upgrade, including updates to L1Block and the new OperatorFeeVault contract. +- [Isthmus: System Config](https://docs.base.org/base-chain/specs/upgrades/isthmus/system-config): SystemConfig changes in the Isthmus upgrade, adding operatorFeeScalar and operatorFeeConstant configuration variables. +- [Derivation](https://docs.base.org/base-chain/specs/upgrades/jovian/derivation): Derivation changes in the Jovian upgrade, specifying activation block rules and gas computation behavior at hardfork activation. +- [Jovian: Execution Engine](https://docs.base.org/base-chain/specs/upgrades/jovian/exec-engine): Execution engine changes in the Jovian upgrade, introducing a configurable minimum base fee via SystemConfig to reduce priority-fee auction durations. +- [L1 Block Attributes](https://docs.base.org/base-chain/specs/upgrades/jovian/l1-attributes): L1 attributes transaction changes in the Jovian upgrade, extending calldata to include the DA footprint gas scalar. +- [Jovian: System Config](https://docs.base.org/base-chain/specs/upgrades/jovian/system-config): SystemConfig changes in the Jovian upgrade, adding a minimum base fee configuration variable for the EIP-1559 fee market. +- [Pectra Blob Schedule Derivation](https://docs.base.org/base-chain/specs/upgrades/pectra-blob-schedule/derivation): Derivation changes for the Pectra Blob Schedule hardfork, specifying how blob fee parameters are handled in L1 attributes transactions. -These resources give AI assistants direct access to Base documentation and reusable workflows. +## Base Account +- [Capabilities Overview](https://docs.base.org/base-account/reference/core/capabilities/overview): Understand how to use Base Account capabilities with wallet_connect and wallet_sendCalls +- [Basename Transfer Guide](https://docs.base.org/base-account/basenames/basename-transfer): Step-by-step guide for Base App users to transfer their Basenames to new wallet addresses. +- [Basenames FAQ](https://docs.base.org/base-account/basenames/basenames-faq): Frequently asked questions on basenames. +- [Contribute to the Base Account Docs](https://docs.base.org/base-account/contribute/contribute-to-base-account-docs) +- [Security and Bug Bounty](https://docs.base.org/base-account/contribute/security-and-bug-bounty) +- [Coinbase Developer Platform](https://docs.base.org/base-account/framework-integrations/cdp): Build onchain apps supporting both Base Account and CDP Embedded Wallets +- [Auth (Sign In With Base)](https://docs.base.org/base-account/framework-integrations/privy/authentication): Manage user authentication with Privy and Base Account +- [Setup](https://docs.base.org/base-account/framework-integrations/privy/setup): Configure Privy with Base Account for your React application +- [Spend Permissions](https://docs.base.org/base-account/framework-integrations/privy/spend-permissions): Enable trusted spenders to move assets without additional signatures +- [Sub Accounts](https://docs.base.org/base-account/framework-integrations/privy/sub-accounts): Create and manage app-specific wallet accounts with Base Account +- [Wallet Actions](https://docs.base.org/base-account/framework-integrations/privy/wallet-actions): Sign messages, transactions, and typed data with Privy wallets +- [RainbowKit](https://docs.base.org/base-account/framework-integrations/rainbowkit): Integrate Base Account with RainbowKit +- [Reown](https://docs.base.org/base-account/framework-integrations/reown): Integrate Base Account with Reown AppKit for your React application +- [Thirdweb](https://docs.base.org/base-account/framework-integrations/thirdweb): Configure Thirdweb with Base Account for your React application +- [Base Pay](https://docs.base.org/base-account/framework-integrations/wagmi/base-pay): Accept USDC payments with Base Pay in your Wagmi-powered React application +- [Basenames](https://docs.base.org/base-account/framework-integrations/wagmi/basenames): Add support for Base names in your application using Wagmi and Viem +- [Batch Transactions](https://docs.base.org/base-account/framework-integrations/wagmi/batch-transactions): Send multiple onchain calls in a single transaction with Wagmi and Base Account +- [Other Use Cases](https://docs.base.org/base-account/framework-integrations/wagmi/other-use-cases): Access the Base Account provider from Wagmi for advanced functionality like Sub Accounts, Spend Permissions, and more +- [Setup](https://docs.base.org/base-account/framework-integrations/wagmi/setup): Configure Wagmi with Base Account connector for your React application +- [Sign in with Base](https://docs.base.org/base-account/framework-integrations/wagmi/sign-in-with-base): Implement Base Account authentication using the proper SIWE flow with Wagmi +- [Using Sub Accounts](https://docs.base.org/base-account/framework-integrations/wagmi/sub-accounts): Implement Base Account Sub Accounts using Wagmi +- [Accept Payments](https://docs.base.org/base-account/guides/accept-payments): Add one-tap USDC payments to your app with the pay() helper and Base Pay Button. +- [Accept Recurring Payments](https://docs.base.org/base-account/guides/accept-recurring-payments): Enable subscription-based revenue models with automatic USDC payments +- [Authenticate Users](https://docs.base.org/base-account/guides/authenticate-users): Let a user click “Sign in with Base,” prove ownership of their onchain account, and give your server everything it needs to create a session – using open standards and no passwords +- [Migrate from Coinbase Wallet SDK](https://docs.base.org/base-account/guides/migration-guide): A guide to migrating from the Coinbase Wallet SDK to the Base Account SDK +- [Sign and Verify Typed Data](https://docs.base.org/base-account/guides/sign-and-verify-typed-data): EIP-712 structured data signing and verification for Base Account +- [Transaction Simulation Data](https://docs.base.org/base-account/guides/tips/inspect-txn-simulation) +- [Popup Tips](https://docs.base.org/base-account/guides/tips/popup-tips) +- [Verify Social Accounts](https://docs.base.org/base-account/guides/verify-social-accounts): Use Base Verify to let users prove ownership of verified accounts (X, Coinbase, Instagram, TikTok) without sharing credentials, enabling Sybil-resistant airdrops, gated content, and identity-based rewards. +- [Batch Transactions](https://docs.base.org/base-account/improve-ux/batch-transactions) +- [Use Spend Permissions](https://docs.base.org/base-account/improve-ux/spend-permissions): Learn how to use Spend Permissions to allow a trusted spender to spend user assets +- [Pay Gas in ERC20 tokens](https://docs.base.org/base-account/improve-ux/sponsor-gas/erc20-paymasters): Base Account enables users to pay for gas in ERC20 tokens +- [Sponsor Gas](https://docs.base.org/base-account/improve-ux/sponsor-gas/paymasters): Use Paymasters to sponsor your users' transactions +- [Use Sub Accounts](https://docs.base.org/base-account/improve-ux/sub-accounts): Learn how to create and use Sub Accounts using Base Account SDK +- [Base Gasless Campaign](https://docs.base.org/base-account/more/base-gasless-campaign) +- [Telemetry · Base Account](https://docs.base.org/base-account/more/telemetry): Understanding Base Account's anonymous telemetry system and how to configure it. +- [Gas Usage](https://docs.base.org/base-account/more/troubleshooting/usage-details/gas-usage) +- [Popup Tips](https://docs.base.org/base-account/more/troubleshooting/usage-details/popups) +- [Transaction Simulation Data](https://docs.base.org/base-account/more/troubleshooting/usage-details/simulations) +- [Unsupported Calls](https://docs.base.org/base-account/more/troubleshooting/usage-details/unsupported-calls) +- [Wallet Library Support](https://docs.base.org/base-account/more/troubleshooting/usage-details/wallet-library-support) +- [Base Account Overview](https://docs.base.org/base-account/overview/what-is-base-account): What is a Base Account and how the Base Account SDK lets you add universal sign-in and one-tap USDC payments to any app. +- [AI Tools for Base Account Developers](https://docs.base.org/base-account/quickstart/ai-tools-available-for-devs) +- [Mobile (React Native)](https://docs.base.org/base-account/quickstart/mobile-integration) +- [Web (HTML + JS)](https://docs.base.org/base-account/quickstart/web): Integrate Sign in with Base and Base Pay using nothing but HTML and JavaScript. +- [Web (Next.js)](https://docs.base.org/base-account/quickstart/web-react): Quickly add Sign in with Base and Base Pay to any Next.js app +- [subscription.charge](https://docs.base.org/base-account/reference/base-pay/charge): Execute subscription charges from your backend using CDP server wallets +- [subscription.getOrCreateSubscriptionOwnerWallet](https://docs.base.org/base-account/reference/base-pay/getOrCreateSubscriptionOwnerWallet): Create or retrieve a CDP smart wallet to act as subscription owner +- [getPaymentStatus](https://docs.base.org/base-account/reference/base-pay/getPaymentStatus): Check the status of a payment transaction +- [subscription.getStatus](https://docs.base.org/base-account/reference/base-pay/getStatus): Check the status and details of an existing subscription +- [pay](https://docs.base.org/base-account/reference/base-pay/pay): Send USDC payments on the Base network +- [subscription.prepareCharge](https://docs.base.org/base-account/reference/base-pay/prepareCharge): Prepare transaction calls to charge a subscription (advanced) +- [subscription.prepareRevoke](https://docs.base.org/base-account/reference/base-pay/prepareRevoke): Prepare transaction calls to revoke a subscription (advanced) +- [subscription.revoke](https://docs.base.org/base-account/reference/base-pay/revoke): Revoke subscriptions from your backend using CDP server wallets +- [subscription.subscribe](https://docs.base.org/base-account/reference/base-pay/subscribe): Create USDC subscriptions with spend permissions on Base network +- [Subscriptions Overview](https://docs.base.org/base-account/reference/base-pay/subscriptions-overview): Accept recurring USDC payments using spend permissions on Base +- [atomic](https://docs.base.org/base-account/reference/core/capabilities/atomic): Ensures batched transactions are executed atomically and contiguously +- [auxiliaryFunds](https://docs.base.org/base-account/reference/core/capabilities/auxiliaryFunds): Indicates wallet access to funds beyond on-chain balance verification +- [dataCallback](https://docs.base.org/base-account/reference/core/capabilities/datacallback): Base Account allows you to collect personal information like email addresses, physical addresses, phone numbers, and names during transactions. +- [dataSuffix](https://docs.base.org/base-account/reference/core/capabilities/dataSuffix): Append arbitrary data to transaction calldata for attribution tracking +- [flowControl](https://docs.base.org/base-account/reference/core/capabilities/flowControl): Control transaction batch behavior after failed or reverted calls +- [gasLimitOverride](https://docs.base.org/base-account/reference/core/capabilities/gasLimitOverride): Override gas limits for individual calls in a wallet_sendCalls batch +- [paymasterService](https://docs.base.org/base-account/reference/core/capabilities/paymasterService): Enable sponsored transactions using ERC-4337 paymaster web services +- [signInWithEthereum](https://docs.base.org/base-account/reference/core/capabilities/signInWithEthereum): Enable secure authentication using the Sign-In With Ethereum (SIWE) standard +- [createBaseAccountSDK](https://docs.base.org/base-account/reference/core/createBaseAccount): Create a Base Account SDK instance with EIP-1193 compliant provider +- [generateKeyPair](https://docs.base.org/base-account/reference/core/generateKeyPair): Generate a new P256 key pair for use with Base Account +- [getCryptoKeyAccount](https://docs.base.org/base-account/reference/core/getCryptoKeyAccount): Retrieve the current crypto key account associated with the user's session +- [getKeypair](https://docs.base.org/base-account/reference/core/getKeypair): Retrieve an existing P256 key pair from storage +- [getProvider](https://docs.base.org/base-account/reference/core/getProvider): Get an Ethereum provider instance from the Base Account SDK +- [coinbase_fetchPermission](https://docs.base.org/base-account/reference/core/provider-rpc-methods/coinbase_fetchPermission): Retrieve a single permission by its hash +- [coinbase_fetchPermissions](https://docs.base.org/base-account/reference/core/provider-rpc-methods/coinbase_fetchPermissions): Retrieve permissions for a specific spender and chain, optionally filtered by account +- [eth_accounts](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_accounts): Returns a list of addresses owned by the connected wallet without prompting user authorization +- [eth_blockNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_blockNumber): Get the number of the most recent block +- [eth_chainId](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_chainId): Get the currently configured chain ID +- [eth_coinbase](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_coinbase): Get the client coinbase address +- [eth_estimateGas](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_estimateGas): Estimate gas needed for a transaction +- [eth_feeHistory](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_feeHistory): Get historical gas fee information for a range of blocks +- [eth_gasPrice](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_gasPrice): Get the current gas price +- [eth_getBalance](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBalance): Get the balance of an account at a given block +- [eth_getBlockByHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockByHash): Get information about a block by block hash +- [eth_getBlockByNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockByNumber): Get information about a block by block number +- [eth_getBlockTransactionCountByHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockTransactionCountByHash): Get the number of transactions in a block by block hash +- [eth_getBlockTransactionCountByNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getBlockTransactionCountByNumber): Get the number of transactions in a block by block number +- [eth_getCode](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getCode): Get the bytecode at a given address +- [eth_getLogs](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getLogs): Get an array of all logs matching a given filter object +- [eth_getProof](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getProof): Get the Merkle proof for account and storage values +- [eth_getStorageAt](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getStorageAt): Get the value from a storage position at a given address +- [eth_getTransactionByBlockHashAndIndex](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionByBlockHashAndIndex): Get a transaction by block hash and transaction index position +- [eth_getTransactionByBlockNumberAndIndex](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionByBlockNumberAndIndex): Get a transaction by block number and transaction index position +- [eth_getTransactionByHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionByHash): Get transaction details by transaction hash +- [eth_getTransactionCount](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionCount): Get the number of transactions sent from an address +- [eth_getTransactionReceipt](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getTransactionReceipt): Get the receipt of a transaction by transaction hash +- [eth_getUncleCountByBlockHash](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getUncleCountByBlockHash): Get the number of uncles in a block by block hash +- [eth_getUncleCountByBlockNumber](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_getUncleCountByBlockNumber): Get the number of uncles in a block by block number +- [eth_requestAccounts](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_requestAccounts): Request account access and authorization from the user +- [eth_sendRawTransaction](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_sendRawTransaction): Submit a signed transaction to the network +- [eth_sendTransaction](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_sendTransaction): Create and send a new transaction or message call +- [eth_signTypedData_v4](https://docs.base.org/base-account/reference/core/provider-rpc-methods/eth_signTypedData_v4): Sign structured data according to EIP-712 +- [personal_sign](https://docs.base.org/base-account/reference/core/provider-rpc-methods/personal_sign): Sign data using a specific account with Ethereum-specific signature format +- [Overview](https://docs.base.org/base-account/reference/core/provider-rpc-methods/request-overview) +- [SDK Overview](https://docs.base.org/base-account/reference/core/provider-rpc-methods/sdk-overview) +- [Standard RPC Methods](https://docs.base.org/base-account/reference/core/provider-rpc-methods/standard-rpc-methods): Standard Ethereum RPC methods supported by Base Account +- [wallet_addEthereumChain](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_addEthereumChain): Add a new Ethereum chain to the wallet +- [wallet_addSubAccount](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_addSubAccount): Add a sub account to the wallet +- [wallet_connect](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_connect): Connect wallet and request account access +- [wallet_getCallsStatus](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_getCallsStatus): Get the status of a call batch sent via wallet_sendCalls +- [wallet_getCapabilities](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_getCapabilities): Get the wallet's supported capabilities for the given account +- [wallet_getSubAccounts](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_getSubAccounts): Fetch the sub accounts of the wallet +- [wallet_sendCalls](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_sendCalls): Submit a batch of calls to the wallet for execution +- [wallet_switchEthereumChain](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_switchEthereumChain): Switch the wallet to a different Ethereum chain +- [wallet_watchAsset](https://docs.base.org/base-account/reference/core/provider-rpc-methods/wallet_watchAsset): Add a token to the wallet's asset watchlist +- [web3_clientVersion](https://docs.base.org/base-account/reference/core/provider-rpc-methods/web3_clientVersion): Get the current client version +- [SDK Utilities](https://docs.base.org/base-account/reference/core/sdk-utilities): Core utility functions for key management and account access +- [Basenames](https://docs.base.org/base-account/reference/onchain-contracts/basenames): Decentralized naming system that allows users to register human-readable names (like 'alice.base.eth') on Base. +- [Smart Wallet](https://docs.base.org/base-account/reference/onchain-contracts/smart-wallet): ERC-4337 compliant smart contract wallet that serves as the foundation for Base Account. +- [Spend Permissions](https://docs.base.org/base-account/reference/onchain-contracts/spend-permissions) +- [createProlinkUrl](https://docs.base.org/base-account/reference/prolink-utilities/createProlinkUrl): Create a link with a prolink query parameter +- [decodeProlink](https://docs.base.org/base-account/reference/prolink-utilities/decodeProlink): Decode a prolink payload back to a JSON-RPC request +- [encodeProlink](https://docs.base.org/base-account/reference/prolink-utilities/encodeProlink): Encode a JSON-RPC request into a compressed, URL-safe prolink payload +- [fetchPermission](https://docs.base.org/base-account/reference/spend-permission-utilities/fetchPermission): Retrieve a single Spend Permission by its hash +- [fetchPermissions](https://docs.base.org/base-account/reference/spend-permission-utilities/fetchPermissions): Retrieve available Spend Permissions for an account and chain, optionally filtered by spender +- [getPermissionStatus](https://docs.base.org/base-account/reference/spend-permission-utilities/getPermissionStatus): Gets the current status of a Spend Permission +- [prepareRevokeCallData](https://docs.base.org/base-account/reference/spend-permission-utilities/prepareRevokeCallData): Construct calldata so your app's spender can revoke a Spend Permission without user interaction +- [prepareSpendCallData](https://docs.base.org/base-account/reference/spend-permission-utilities/prepareSpendCallData): Prepare calldata to approve (if needed) and spend using a Spend Permission +- [requestRevoke](https://docs.base.org/base-account/reference/spend-permission-utilities/requestRevoke): Request the user's approval to revoke a Spend Permission +- [requestSpendPermission](https://docs.base.org/base-account/reference/spend-permission-utilities/requestSpendPermission): Create and sign an EIP-712 Spend Permission for a user's Base Account +- [BasePayButton](https://docs.base.org/base-account/reference/ui-elements/base-pay-button): Pre-built React component for accepting payments with Base Account +- [Brand Guidelines](https://docs.base.org/base-account/reference/ui-elements/brand-guidelines): Design and brand guidelines for Sign in With Base and Base Pay buttons +- [SignInWithBaseButton](https://docs.base.org/base-account/reference/ui-elements/sign-in-with-base-button): Pre-built React component for user authentication with Base Account -### Base MCP server - -`https://docs.base.org/mcp` - -### Base skills - -AI agents can use Base skills to perform onchain actions directly from their tool loop — no custom integration required. Available skills include: - -[https://github.com/base/skills](https://github.com/base/skills) - -Install Base skills for your AI assistant: - -``` -npx skills add base/base-skills -``` -## Recommended starting points - -Narrow context to a specific type of work: - -- [AI Agents overview](https://docs.base.org/ai-agents) — Overall agent building model on Base -- [Wallet Setup](https://docs.base.org/ai-agents/setup/wallet-setup) — Agent wallets, signing, and funded execution -- [Pay for Services with x402](https://docs.base.org/ai-agents/payments/pay-for-services-with-x402) — x402 payments and onchain transactions -- [Agent Registration](https://docs.base.org/ai-agents/setup/agent-registration) — Verification and trust between agents and services -- [Base Account quickstart for AI tools](https://docs.base.org/base-account/quickstart/ai-tools-available-for-devs) — Agent-assisted wallet and account flows -- [Deploy on Base](https://docs.base.org/base-chain/quickstart/deploy-on-base) — Contract deployment on Base -- [Build a Base app](https://docs.base.org/apps/quickstart/build-app) - -### Docs index - -[https://docs.base.org/llms.txt](https://docs.base.org/llms.txt) - -``` -# Base Docs Index -IMPORTANT: Prefer retrieval-led reasoning. Read relevant docs before generating code. -Base is an Ethereum L2 by Coinbase. Docs for: Base Chain, Smart Wallet, OnchainKit, MiniKit. -[Docs]|root:./docs -|ai-agents:index -|ai-agents/payments:accepting-payments,pay-for-services-with-x402 -|ai-agents/quickstart:payments,trading -|ai-agents/setup:agent-builder-codes,agent-registration,wallet-setup -|ai-agents/skills:index -|ai-agents/skills/payments:cdp-payment-skills,sponge-x402 -|ai-agents/skills/trading:alchemy-agentic-gateway,coingecko,swap-execution -|ai-agents/skills/wallets:bankr,cdp-agentic-wallet,sponge-wallet -|ai-agents/trading:data-fetching,trade-execution -|apps/builder-codes:agent-developers,app-developers,builder-codes,wallet-developers -|apps/growth:rewards -|apps/guides:migrate-to-standard-web-app -|apps/quickstart:build-app -|apps/resources:design-resources,templates -|apps/technical-guides:base-notifications -|base-account/basenames:basename-transfer,basenames-faq -|base-account/contribute:contribute-to-base-account-docs,security-and-bug-bounty -|base-account/framework-integrations:cdp,rainbowkit,reown,thirdweb -|base-account/framework-integrations/privy:authentication,setup,spend-permissions,sub-accounts,wallet-actions -|base-account/framework-integrations/wagmi:base-pay,basenames,batch-transactions,other-use-cases,setup,sign-in-with-base,sub-accounts -|base-account/guides:accept-payments,accept-recurring-payments,authenticate-users,migration-guide,sign-and-verify-typed-data,verify-social-accounts -|base-account/guides/tips:inspect-txn-simulation,popup-tips -|base-account/improve-ux:batch-transactions,spend-permissions,sub-accounts -|base-account/improve-ux/sponsor-gas:erc20-paymasters,paymasters -|base-account/more:base-gasless-campaign,telemetry -|base-account/more/troubleshooting/usage-details:gas-usage,popups,simulations,unsupported-calls,wallet-library-support -|base-account/overview:what-is-base-account -|base-account/quickstart:ai-tools-available-for-devs,mobile-integration,web-react,web -|base-account/reference/base-pay:charge,getOrCreateSubscriptionOwnerWallet,getPaymentStatus,getStatus,pay,prepareCharge,prepareRevoke,revoke,subscribe,subscriptions-overview -|base-account/reference/core:createBaseAccount,generateKeyPair,getCryptoKeyAccount,getKeypair,getProvider,sdk-utilities -|base-account/reference/core/capabilities:atomic,auxiliaryFunds,dataSuffix,datacallback,flowControl,gasLimitOverride,overview,paymasterService,signInWithEthereum -|base-account/reference/core/provider-rpc-methods:coinbase_fetchPermission,coinbase_fetchPermissions,eth_accounts,eth_blockNumber,eth_chainId,eth_coinbase,eth_estimateGas,eth_feeHistory,eth_gasPrice,eth_getBalance,eth_getBlockByHash,eth_getBlockByNumber,eth_getBlockTransactionCountByHash,eth_getBlockTransactionCountByNumber,eth_getCode,eth_getLogs,eth_getProof,eth_getStorageAt,eth_getTransactionByBlockHashAndIndex,eth_getTransactionByBlockNumberAndIndex,eth_getTransactionByHash,eth_getTransactionCount,eth_getTransactionReceipt,eth_getUncleCountByBlockHash,eth_getUncleCountByBlockNumber,eth_requestAccounts,eth_sendRawTransaction,eth_sendTransaction,eth_signTypedData_v4,personal_sign,request-overview,sdk-overview,standard-rpc-methods,wallet_addEthereumChain,wallet_addSubAccount,wallet_connect,wallet_getCallsStatus,wallet_getCapabilities,wallet_getSubAccounts,wallet_sendCalls,wallet_switchEthereumChain,wallet_watchAsset,web3_clientVersion -|base-account/reference/onchain-contracts:basenames,smart-wallet,spend-permissions -|base-account/reference/prolink-utilities:createProlinkUrl,decodeProlink,encodeProlink -|base-account/reference/spend-permission-utilities:fetchPermission,fetchPermissions,getPermissionStatus,prepareRevokeCallData,prepareSpendCallData,requestRevoke,requestSpendPermission -|base-account/reference/ui-elements:base-pay-button,brand-guidelines,sign-in-with-base-button -|base-chain/api-reference:rpc-overview -|base-chain/api-reference/debug-api:debug_traceBlockByHash,debug_traceBlockByNumber,debug_traceTransaction -|base-chain/api-reference/ethereum-json-rpc-api:eth_blockNumber,eth_call,eth_chainId,eth_estimateGas,eth_feeHistory,eth_gasPrice,eth_getBalance,eth_getBlockByHash,eth_getBlockByNumber,eth_getBlockReceipts,eth_getBlockTransactionCountByHash,eth_getBlockTransactionCountByNumber,eth_getCode,eth_getLogs,eth_getStorageAt,eth_getTransactionByBlockHashAndIndex,eth_getTransactionByBlockNumberAndIndex,eth_getTransactionByHash,eth_getTransactionCount,eth_getTransactionReceipt,eth_maxPriorityFeePerGas,eth_sendRawTransaction,eth_subscribe,eth_syncing,eth_unsubscribe,net_version,web3_clientVersion -|base-chain/api-reference/flashblocks-api:base_transactionStatus,eth_simulateV1,flashblocks-api-overview,newFlashblockTransactions,newFlashblocks,pendingLogs -|base-chain/flashblocks:app-integration,architecture,faq,overview -|base-chain/network-information:base-contracts,block-building,bridges,configuration-changelog,diffs-ethereum-base,ecosystem-contracts,network-faucets,network-fees,transaction-finality,troubleshooting-transactions -|base-chain/node-operators:base-v1-upgrade,node-providers,performance-tuning,run-a-base-node,snapshots,troubleshooting -|base-chain/quickstart:base-solana-bridge,connecting-to-base,deploy-on-base,why-base -|base-chain/security:avoid-malicious-flags,bug-bounty,report-vulnerability,security-council -||base-chain/specs:index -||base-chain/specs/protocol:overview,batcher -||base-chain/specs/protocol/bridging:bridges,deposits,messengers,withdrawals -||base-chain/specs/protocol/consensus:index,derivation,p2p,rpc -||base-chain/specs/protocol/execution:index -||base-chain/specs/protocol/execution/evm:precompiles,predeploys,preinstalls,rpc -||base-chain/specs/protocol/fault-proof:index,cannon-fault-proof-vm,proposer -||base-chain/specs/protocol/fault-proof/stage-one:index,anchor-state-registry,bond-incentives,bridge-integration,dispute-game-interface,fault-dispute-game,honest-challenger-fdg,optimism-portal -||base-chain/specs/upgrades/jovian:overview,exec-engine,derivation,l1-attributes,system-config -||base-chain/specs/upgrades/isthmus:overview,exec-engine,derivation,l1-attributes,predeploys,system-config -||base-chain/specs/upgrades/holocene:overview,exec-engine,derivation,system-config -||base-chain/specs/upgrades/granite:overview,exec-engine,derivation -||base-chain/specs/upgrades/fjord:overview,exec-engine,derivation,predeploys -||base-chain/specs/upgrades/ecotone:overview,derivation,l1-attributes -||base-chain/specs/upgrades/delta:overview,span-batches -||base-chain/specs/upgrades/canyon:overview -||base-chain/specs/upgrades/azul:overview,exec-engine,proofs -||base-chain/specs/upgrades/pectra-blob-schedule:overview,derivation -||base-chain/specs/reference:glossary,configurability -||base-chain/specs/bcps:index,bcp-0000 -|get-started:base-mentorship-program,base-services-hub,base,block-explorers,build-app,concepts,country-leads-and-ambassadors,data-indexers,deploy-smart-contracts,docs-llms,docs-mcp,get-funded,launch-token,learning-resources,prompt-library,resources-for-ai-agents -|apps/quickstart:migrate-to-standard-web-app -|apps/growth:rewards -|onchainkit:migrate-from-onchainkit -|root:agents,changes,cookie-policy,privacy-policy,terms-of-service,tone_of_voice -``` +## AI Agents +- [AI Agents on Base](https://docs.base.org/ai-agents/index): Build AI agents that trade, earn, and transact autonomously on Base +- [Overview](https://docs.base.org/ai-agents/skills/index): Installable agent capabilities for wallets, payments, and trading on Base +- [Accepting Payments (x402)](https://docs.base.org/ai-agents/payments/accepting-payments): Gate your agent's endpoints with x402 to charge other agents per request +- [Pay for APIs & Services (x402)](https://docs.base.org/ai-agents/payments/pay-for-services-with-x402): How x402 works, how your agent makes payments, and which networks and tokens are supported +- [Get Started with Payments](https://docs.base.org/ai-agents/quickstart/payments): Build an agent that makes and accepts x402 payments on Base in under 10 minutes +- [Get Started with Trading](https://docs.base.org/ai-agents/quickstart/trading): Build an agent that fetches live market data and executes token swaps on Base +- [Builder Codes for Agents](https://docs.base.org/ai-agents/setup/agent-builder-codes): Register your agent on Base.dev and append a Builder Code to every transaction to measure onchain activity. +- [Agent Registration & Identity](https://docs.base.org/ai-agents/setup/agent-registration): Register your agent's identity onchain, get a Basename, and authenticate with services using Sign In With Agent (SIWA) +- [Wallet Setup for Agents](https://docs.base.org/ai-agents/setup/wallet-setup): Give your AI agent a dedicated wallet on Base to hold funds, send payments, sign messages, and interact with onchain protocols securely. +- [CDP Payment Skills](https://docs.base.org/ai-agents/skills/payments/cdp-payment-skills): Skills for discovering, paying for, and monetizing x402 API services via the CDP Agentic Wallet +- [Sponge x402](https://docs.base.org/ai-agents/skills/payments/sponge-x402): Skill for discovering and paying for x402 services automatically using Sponge Wallet's built-in proxy +- [Alchemy Agentic Gateway](https://docs.base.org/ai-agents/skills/trading/alchemy-agentic-gateway): Skill for accessing Alchemy's blockchain APIs — token balances, NFTs, portfolio data, and prices — via x402 SIWE auth +- [CoinGecko](https://docs.base.org/ai-agents/skills/trading/coingecko): Skill for fetching live crypto price feeds, market cap, and OHLCV data via x402 — no API key required +- [Swap Execution](https://docs.base.org/ai-agents/skills/trading/swap-execution): Skills for executing token swaps on Base using wallet-native tools across Bankr, CDP Agentic Wallet, and Sponge +- [Bankr](https://docs.base.org/ai-agents/skills/wallets/bankr): Skill that gives your AI agent a cross-chain wallet with built-in swaps, gas sponsorship, and token launching +- [CDP Agentic Wallet](https://docs.base.org/ai-agents/skills/wallets/cdp-agentic-wallet): Skill that gives your AI agent an email-authenticated wallet on Base with x402 payments built in +- [Sponge Wallet](https://docs.base.org/ai-agents/skills/wallets/sponge-wallet): Skill that gives your AI agent a multi-chain wallet with native x402 payments, swaps, bridges, and banking +- [Fetching Market Data](https://docs.base.org/ai-agents/trading/data-fetching): Use x402 to access live market data from CoinGecko, Alchemy, and other sources — no API key management required +- [Trade Execution on Base](https://docs.base.org/ai-agents/trading/trade-execution): Base-specific patterns, fee calibration, and onchain signals for trading agents +## Apps +- [Build an app on Base](https://docs.base.org/apps/index): A step-by-step guide to building a Next.js tally app on Base using wagmi and viem, with wallet connection, contract reads and writes, and batch transaction support. +- [Builder Codes for Agent Developers](https://docs.base.org/apps/builder-codes/agent-developers): Attribute your AI agent's onchain transactions to your identity on Base and unlock analytics and leaderboard features. +- [Builder Codes for App Developers](https://docs.base.org/apps/builder-codes/app-developers): Integrate Builder Codes into your app using Wagmi or Viem to attribute onchain activity. +- [Base Builder Codes](https://docs.base.org/apps/builder-codes/builder-codes): Attribute onchain activity to your app, wallet or agent with Builder Codes. +- [Builder Codes for Wallet Developers](https://docs.base.org/apps/builder-codes/wallet-developers): Implement the dataSuffix capability in your wallet to enable Builder Code attribution. +- [Rewards](https://docs.base.org/apps/growth/rewards): Earn financial incentives for building high-quality Apps that drive user engagement and onchain transactions +- [Migrate to a Standard Web App](https://docs.base.org/apps/guides/migrate-to-standard-web-app): Migrate your Farcaster mini-app to work in the Base App. Covers replacing deprecated SDK methods, and registering on Base.dev. +- [Build an app on Base](https://docs.base.org/apps/quickstart/build-app): A step-by-step guide to building a Next.js tally app on Base using wagmi and viem, with wallet connection, contract reads and writes, and batch transaction support. +- [Add notifications](https://docs.base.org/apps/technical-guides/base-notifications): Send in-app notifications to your app's users through the Base Dashboard REST API. +## Optional +- [Base MCP server](https://docs.base.org/mcp): Direct AI access to Base documentation +- [Base skills](https://github.com/base/skills): Installable agent skills (`npx skills add base/base-skills`) +- [Full context (llms-full.txt)](https://docs.base.org/llms-full.txt): Same index plus cross-cutting concept guides diff --git a/githooks/README.md b/githooks/README.md index 37799e31f..f0a31dfea 100644 --- a/githooks/README.md +++ b/githooks/README.md @@ -1,13 +1,101 @@ # Hooks -To enable git hooks for this repo, run the following from the repo root: +Repo-local git hooks. Installation is scoped to **this clone only** — `git config --local` is used, so your global git config and other repos are untouched. + +## Install + +From the repo root: ```sh -# 1. Register the hooks directory -git config core.hooksPath githooks +./githooks/install.sh +``` + +Idempotent — safe to re-run. The script sets `core.hooksPath=githooks` (local to this `.git/config` only) and marks the hooks executable. + +These hooks are scoped to this repo only: +- `--local` writes to `.git/config`, not your global `~/.gitconfig`. +- `githooks` is a relative path — it only resolves inside this repo. +- Every hook script `cd`s into the repo root and only modifies files under it. -# 2. Make the post-commit hook executable -chmod +x githooks/post-commit +Verify after install: + +```sh +git config --local --get core.hooksPath # should print: githooks +git config --global --get core.hooksPath # should print nothing ``` -Once installed, any commit message containing `agents.md` will automatically regenerate `docs/agents.md`. +## Configuration + +Triggers, scripts, and outputs live in [`githooks/config.json`](./config.json). The hook logic itself never changes — to wire a new keyword to your own script, just add an entry: + +```json +{ + "skipToken": "[skip-docs]", + "generators": [ + { "name": "agents", "trigger": "agents.md", "script": "scripts/agents.js", "outputs": ["docs/agents.md"] }, + { "name": "llms", "trigger": "llms.txt", "script": "scripts/llms.js", "outputs": ["docs/llms.txt", "docs/llms-full.txt"] }, + { "name": "myindex", "trigger": "myindex.md", "script": "scripts/myindex.js", "outputs": ["docs/myindex.md"] } + ] +} +``` + +Fields per generator: +- `name` — short label used in logs and the auto-commit subject +- `trigger` — case-insensitive substring matched against the commit message +- `script` — path (from repo root) to a node script that writes the outputs +- `outputs` — files the script writes; used to (a) detect a real diff vs `HEAD` and (b) exclude these files from structural-change detection so editing a generated file never auto-fires the hook + +If `jq` isn't installed or `config.json` is missing/malformed, the hook falls back to built-in defaults equivalent to the two entries above. The hook never errors out just because the config layer is unavailable. + +## post-commit + +Regenerates docs index files when either: + +1. **Auto** — the commit added, deleted, or renamed any `.md`/`.mdx` file under `docs/` (excluding the generated indexes themselves). Both generators run. +2. **Opt-in** — the commit message contains a trigger token (case-insensitive substring): + + | Token in commit message | Regenerates | Generator | + |-------------------------|-------------|-----------| + | `agents.md` | `docs/agents.md` | `scripts/agents.js` | + | `llms.txt` | `docs/llms.txt` + `docs/llms-full.txt` | `scripts/llms.js` | + +Both tokens may appear in the same message; both generators run. The auto path covers the "I added a new doc page and forgot the keyword" failure mode; the opt-in path covers content-only edits that affect `llms.txt` extraction without changing file structure. + +If a regeneration produces a real diff vs `HEAD`, a single follow-up commit is created: + +``` +chore: regenerate docs/agents.md (post-commit of ) +``` + +The `(post-commit of )` suffix links the auto-commit back to the commit that triggered it. Recursion is guarded so the follow-up commit doesn't re-trigger the hook. + +## post-merge + +Runs after `git pull` / `git merge`. **Does not modify the working tree** — it only prints a warning when the merge brought in structural docs changes (A/D/R), pointing you at `/agents` and `/llms` so you can regenerate when ready. The next docs commit will also auto-regenerate via `post-commit`. + +This is intentional: regenerating files mid-pull would surprise you with uncommitted changes. + +## Bypass + +| When | How | +|------|-----| +| One commit (env) | `SKIP_DOCS_HOOK=1 git commit ...` | +| One commit (in message) | include literal `[skip-docs]` token | +| One pull/merge | `SKIP_DOCS_HOOK=1 git pull ...` | + +Useful when you legitimately need to mention `agents.md` or `llms.txt` in a commit message without triggering regeneration ("fix link to agents.md"). + +## Debug + +Set `DEBUG_DOCS_HOOK=1` for verbose logging on either hook: + +```sh +DEBUG_DOCS_HOOK=1 git commit ... +DEBUG_DOCS_HOOK=1 git pull ... +``` + +## Uninstall + +```sh +git config --local --unset core.hooksPath +``` diff --git a/githooks/_lib.sh b/githooks/_lib.sh new file mode 100644 index 000000000..1c1d9620a --- /dev/null +++ b/githooks/_lib.sh @@ -0,0 +1,70 @@ +# shellcheck shell=sh +# Shared loader for the docs hooks. Sourced by post-commit and post-merge. +# +# Reads githooks/config.json (via jq) and exposes: +# SKIP_TOKEN literal string that, when present in a commit msg, skips the hook +# GENERATORS_TSV one line per generator: nametriggerscriptoutputs +# where outputs is a space-separated list +# EXCLUDE_REGEX ERE matching any generator output (used to exclude generated +# files from structural-change detection) +# ALL_OUTPUTS space-separated list of every output across all generators +# +# Falls back to built-in defaults if jq is missing or config.json is absent / +# malformed, so the hook never breaks just because someone uninstalled jq. + +_lib_log() { [ -n "$DEBUG_DOCS_HOOK" ] && echo "[hooks-lib] $*" >&2; } + +_use_defaults() { + SKIP_TOKEN='[skip-docs]' + GENERATORS_TSV=$(printf '%s\n%s\n' \ + 'agents agents.md scripts/agents.js docs/agents.md' \ + 'llms llms.txt scripts/llms.js docs/llms.txt docs/llms-full.txt') + EXCLUDE_REGEX='^docs/agents\.md$|^docs/llms(-full)?\.txt$' + ALL_OUTPUTS='docs/agents.md docs/llms.txt docs/llms-full.txt' +} + +load_hooks_config() { + CONFIG_FILE="${REPO_ROOT:-$(git rev-parse --show-toplevel)}/githooks/config.json" + + if ! command -v jq >/dev/null 2>&1; then + _lib_log "jq not installed; using built-in defaults" + _use_defaults + return + fi + if [ ! -f "$CONFIG_FILE" ]; then + _lib_log "$CONFIG_FILE missing; using built-in defaults" + _use_defaults + return + fi + if ! jq empty "$CONFIG_FILE" >/dev/null 2>&1; then + echo "[hooks-lib] WARN: $CONFIG_FILE is not valid JSON; falling back to defaults" >&2 + _use_defaults + return + fi + + SKIP_TOKEN=$(jq -r '.skipToken // "[skip-docs]"' "$CONFIG_FILE") + + # TSV: name \t trigger \t script \t (outputs joined by space) + GENERATORS_TSV=$(jq -r '.generators[] + | [(.name // "?"), (.trigger // ""), (.script // ""), (.outputs // [] | join(" "))] + | @tsv' "$CONFIG_FILE") + + ALL_OUTPUTS=$(jq -r '[.generators[].outputs[]] | join(" ")' "$CONFIG_FILE") + + # Build an ERE that matches any output path exactly. Escapes . and / (the only + # regex metachars likely to appear in real output paths). + EXCLUDE_REGEX=$(jq -r ' + [.generators[].outputs[] + | gsub("\\."; "\\.") + | "^" + . + "$" + ] | join("|") + ' "$CONFIG_FILE") + + if [ -z "$GENERATORS_TSV" ]; then + echo "[hooks-lib] WARN: $CONFIG_FILE has no generators; falling back to defaults" >&2 + _use_defaults + return + fi + + _lib_log "loaded $(echo "$GENERATORS_TSV" | wc -l | tr -d ' ') generator(s) from config" +} diff --git a/githooks/config.json b/githooks/config.json new file mode 100644 index 000000000..75b88faff --- /dev/null +++ b/githooks/config.json @@ -0,0 +1,18 @@ +{ + "_comment": "Trigger config for githooks/post-commit and githooks/post-merge. Edit to add your own triggers — the hook logic stays the same. Each generator: 'name' for the auto-commit subject; 'trigger' is a case-insensitive substring matched against the commit message; 'script' is run when triggered (or when a structural change is detected); 'outputs' are the files the script writes (used to detect real diffs and to exclude from structural-change detection).", + "skipToken": "[skip-docs]", + "generators": [ + { + "name": "agents", + "trigger": "agents.md", + "script": "scripts/agents.js", + "outputs": ["docs/agents.md"] + }, + { + "name": "llms", + "trigger": "llms.txt", + "script": "scripts/llms.js", + "outputs": ["docs/llms.txt", "docs/llms-full.txt"] + } + ] +} diff --git a/githooks/install.sh b/githooks/install.sh new file mode 100755 index 000000000..0dbb84ba8 --- /dev/null +++ b/githooks/install.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Local install for this repo's git hooks. +# Scope: this clone only — never touches global git config or your $HOME. +# +# Usage: ./githooks/install.sh +set -e + +REPO_ROOT=$(git rev-parse --show-toplevel) +cd "$REPO_ROOT" + +# --local is the default for `git config`, but pass it explicitly so it's +# obvious from a code-read that this does NOT modify --global or --system. +git config --local core.hooksPath githooks +chmod +x githooks/post-commit githooks/post-merge + +if ! command -v jq >/dev/null 2>&1; then + echo "Note: 'jq' not installed — hooks will use built-in defaults instead of githooks/config.json." + echo " Install with: brew install jq (or: apt-get install jq)" +fi + +echo "Installed hooks for this repo (scope: --local, this clone only):" +echo " core.hooksPath = $(git config --local --get core.hooksPath)" +echo +echo "Hooks:" +echo " post-commit → regenerates docs indexes after a commit (auto on docs/ A/D/R, opt-in via 'agents.md' / 'llms.txt' keyword)" +echo " post-merge → warns when a pull/merge brought changes that drift docs indexes" +echo +echo "Bypass once: SKIP_DOCS_HOOK=1 git commit ... (or include [skip-docs] in the message)" +echo "Verify scope: git config --global --get core.hooksPath → should print nothing" diff --git a/githooks/post-commit b/githooks/post-commit index d25e2a1b5..d524e61ea 100755 --- a/githooks/post-commit +++ b/githooks/post-commit @@ -1,59 +1,173 @@ #!/bin/sh -# Regenerates docs/agents.md after each commit (when commit message contains "agents.md"). -# If the index changed, creates a follow-up commit. +# Regenerates docs index files after a commit. Two trigger paths: # -# Debug: DEBUG_AGENTS_HOOK=1 git commit ... (or export it for the session) +# AUTO — if the commit added/deleted/renamed any docs/**/*.{md,mdx} file +# (excluding the generated outputs themselves), ALL configured +# generators run. +# +# OPT-IN — if the commit message mentions a generator's trigger keyword, +# that generator runs even when no structural change happened +# (useful for content-only edits that affect llms.txt extraction). +# +# Triggers and generators are defined in githooks/config.json. Add your own +# entry there to wire a custom keyword to your own script — the hook logic +# below stays the same. +# +# If anything actually changed, a single follow-up commit is created with +# the regenerated files. Subject includes the short SHA of the triggering +# commit for traceability. +# +# Bypass once: SKIP_DOCS_HOOK=1 git commit ... +# Bypass via message: include the literal SKIP_TOKEN from config (default "[skip-docs]") +# Debug: DEBUG_DOCS_HOOK=1 git commit ... log() { - [ -n "$DEBUG_AGENTS_HOOK" ] && echo "[post-commit] $*" >&2 + [ -n "$DEBUG_DOCS_HOOK" ] && echo "[post-commit] $*" >&2 } log "fired (pid=$$)" -# Guard against recursion: this hook re-fires on the follow-up commit below. -if [ -n "$AGENTS_MD_HOOK_RUNNING" ]; then +# User-facing skip — useful when you legitimately need to mention a trigger +# token in a commit message ("fix link to agents.md") without regenerating. +if [ -n "$SKIP_DOCS_HOOK" ]; then + log "SKIP_DOCS_HOOK set; exiting" + exit 0 +fi + +# Internal recursion guard: this hook re-fires on the follow-up commit below. +if [ -n "$DOCS_HOOK_RUNNING" ]; then log "recursion guard hit; exiting" exit 0 fi -export AGENTS_MD_HOOK_RUNNING=1 +export DOCS_HOOK_RUNNING=1 REPO_ROOT=$(git rev-parse --show-toplevel) || exit 0 cd "$REPO_ROOT" || exit 0 log "repo root: $REPO_ROOT" -# Only run when the commit message opts in with the trigger token (case-insensitive). +# Load triggers + outputs from githooks/config.json (with safe fallback). +# shellcheck source=githooks/_lib.sh +. "$REPO_ROOT/githooks/_lib.sh" +load_hooks_config + +# Capture the SHA of the commit that triggered us, before we make any new +# commits ourselves. Used in the follow-up subject for traceability. +TRIGGER_SHA=$(git rev-parse --short HEAD) MSG=$(git log -1 --pretty=%B) log "last commit msg: $MSG" -if ! printf '%s' "$MSG" | grep -qi 'agents\.md'; then - log "trigger 'agents.md' NOT in commit message; exiting" + +# Message-level skip token. Lets a single commit opt out without setting env. +if printf '%s' "$MSG" | grep -qiF "$SKIP_TOKEN"; then + log "skip token '$SKIP_TOKEN' in commit message; exiting" exit 0 fi -log "trigger matched" -if [ ! -f scripts/agents.js ]; then - log "scripts/agents.js NOT FOUND; exiting" +# Build a same-order list of generators we want to run, indexed by line number +# in GENERATORS_TSV. -F treats trigger as a literal string (no regex surprises +# if a config entry contains . / [ etc.). +WANTED=$( + i=0 + echo "$GENERATORS_TSV" | while IFS=$(printf '\t') read -r _name trigger _script _outputs; do + i=$((i + 1)) + if [ -n "$trigger" ] && printf '%s' "$MSG" | grep -qiF -- "$trigger"; then + echo "$i" + fi + done | tr '\n' ' ' +) + +# Auto path: structural changes (added / deleted / renamed) to .md/.mdx under +# docs/, excluding the configured generator outputs themselves so a manual +# edit to docs/agents.md never auto-triggers another regen. M (modified) is +# NOT a structural change — content-only edits should use the keyword opt-in. +if [ -z "$WANTED" ]; then + if git rev-parse --verify HEAD~1 >/dev/null 2>&1; then + structural=$(git diff-tree -r --no-commit-id --name-status --diff-filter=ADR HEAD~1 HEAD -- 'docs/*.md' 'docs/*.mdx' 'docs/**/*.md' 'docs/**/*.mdx' \ + | awk -v excl="$EXCLUDE_REGEX" '$2 !~ excl { print }') + if [ -n "$structural" ]; then + log "structural docs changes detected; auto-triggering all generators" + log "$structural" + # Want every generator (1..N). + n=$(echo "$GENERATORS_TSV" | wc -l | tr -d ' ') + WANTED=$(seq 1 "$n" | tr '\n' ' ') + fi + fi +fi + +if [ -z "$WANTED" ]; then + log "no trigger (keyword or structural); exiting" exit 0 fi -log "running: node scripts/agents.js" -if [ -n "$DEBUG_AGENTS_HOOK" ]; then - node scripts/agents.js - rc=$? -else - node scripts/agents.js >/dev/null 2>&1 - rc=$? +if ! command -v node >/dev/null 2>&1; then + echo "post-commit: node not found; skipping docs regeneration." >&2 + exit 0 fi -if [ $rc -ne 0 ]; then - echo "post-commit: agents.js failed (exit $rc); skipping" >&2 + +regenerated_files="" + +# Run each wanted generator in config order. +for idx in $WANTED; do + line=$(echo "$GENERATORS_TSV" | sed -n "${idx}p") + name=$(printf '%s' "$line" | awk -F'\t' '{print $1}') + script=$(printf '%s' "$line" | awk -F'\t' '{print $3}') + outputs=$(printf '%s' "$line" | awk -F'\t' '{print $4}') + + if [ ! -f "$script" ]; then + log "[$name] $script NOT FOUND; skipping" + continue + fi + log "[$name] running: node $script" + if [ -n "$DEBUG_DOCS_HOOK" ]; then + node "$script" + else + node "$script" >/dev/null 2>&1 + fi + rc=$? + if [ $rc -ne 0 ]; then + echo "post-commit: [$name] $script failed (exit $rc); skipping" >&2 + continue + fi + regenerated_files="$regenerated_files $outputs" +done + +regenerated_files=$(echo "$regenerated_files" | sed 's/^ *//;s/ *$//') +if [ -z "$regenerated_files" ]; then + log "no generators ran successfully; nothing to commit" exit 0 fi -if git diff --quiet -- docs/agents.md 2>/dev/null; then - log "docs/agents.md unchanged; nothing to commit" +# Compare against HEAD (not the index) so a pre-staged generated file can't +# fool the check into thinking nothing changed. +# shellcheck disable=SC2086 +changed_files=$(git diff --name-only HEAD -- $regenerated_files) +if [ -z "$changed_files" ]; then + log "regenerated files unchanged; nothing to commit" exit 0 fi -log "docs/agents.md changed; creating follow-up commit" +log "regenerated files changed: $(echo "$changed_files" | tr '\n' ' ')" + +# Subject lists the actual files that changed — accurate regardless of which +# generators are configured. Falls back to a generic subject if the list is +# unexpectedly empty. +files_one_line=$(echo "$changed_files" | tr '\n' ',' | sed 's/,$//;s/,/, /g') +if [ -z "$files_one_line" ]; then + subject="chore: regenerate docs indexes (post-commit of $TRIGGER_SHA)" +else + subject="chore: regenerate $files_one_line (post-commit of $TRIGGER_SHA)" +fi + +# Stage only the files that actually changed (xargs handles newline separator). +echo "$changed_files" | xargs git add -- + +# --no-verify is intentional: this commit is generated content, not human +# work. Skipping pre-commit / commit-msg hooks here avoids (a) re-running +# linters or formatters against generated files and (b) any future +# conventional-commit / signoff hooks rejecting our chore: subject. The +# DOCS_HOOK_RUNNING env guard above prevents this commit from re-firing +# THIS hook regardless. +git commit -m "$subject" --no-verify >/dev/null +log "follow-up commit created: $subject" -git add docs/agents.md -git commit -m "chore: regenerate docs/agents.md" --no-verify >/dev/null -log "follow-up commit created" +# Visible signal so the user sees the hook actually did work without +# needing to enable DEBUG_DOCS_HOOK or scroll through `git log`. +echo "[docs] $subject" >&2 diff --git a/githooks/post-merge b/githooks/post-merge new file mode 100755 index 000000000..4fe4fde86 --- /dev/null +++ b/githooks/post-merge @@ -0,0 +1,63 @@ +#!/bin/sh +# Warns when a merge / pull brought in structural docs changes (A/D/R on +# .md/.mdx under docs/) that may have drifted the generated indexes. +# +# By design this hook does NOT modify the working tree or auto-commit: +# regenerating files mid-pull would surprise the user with uncommitted +# changes. It only prints a heads-up. +# +# Triggers and outputs come from githooks/config.json (same source as +# post-commit), so adding a custom generator there automatically extends +# this hook's exclusion list and warning. +# +# Bypass once: SKIP_DOCS_HOOK=1 git pull / git merge ... +# Debug: DEBUG_DOCS_HOOK=1 git pull / git merge ... + +log() { + [ -n "$DEBUG_DOCS_HOOK" ] && echo "[post-merge] $*" >&2 +} + +log "fired (pid=$$)" + +if [ -n "$SKIP_DOCS_HOOK" ]; then + log "SKIP_DOCS_HOOK set; exiting" + exit 0 +fi + +REPO_ROOT=$(git rev-parse --show-toplevel) || exit 0 +cd "$REPO_ROOT" || exit 0 + +# shellcheck source=githooks/_lib.sh +. "$REPO_ROOT/githooks/_lib.sh" +load_hooks_config + +# ORIG_HEAD is set by merge to the pre-merge tip — comparing it to HEAD shows +# what the merge brought in. +if ! git rev-parse --verify ORIG_HEAD >/dev/null 2>&1; then + log "no ORIG_HEAD; nothing to compare; exiting" + exit 0 +fi + +structural=$(git diff --name-status --diff-filter=ADR ORIG_HEAD HEAD -- 'docs/*.md' 'docs/*.mdx' 'docs/**/*.md' 'docs/**/*.mdx' \ + | awk -v excl="$EXCLUDE_REGEX" '$2 !~ excl { print }') + +if [ -z "$structural" ]; then + log "no structural docs changes in this merge; exiting quietly" + exit 0 +fi + +# Build a "regenerate with: X, Y" suggestion list from configured generators. +suggest=$(echo "$GENERATORS_TSV" | awk -F'\t' '{ printf "/%s ", $1 }' | sed 's/ $//') + +{ + echo + echo "[docs] heads-up: this merge added/deleted/renamed docs files:" + echo "$structural" | sed 's/^/ /' + echo + echo " Generated indexes ($ALL_OUTPUTS) may now be stale." + if [ -n "$suggest" ]; then + echo " Regenerate with: $suggest" + fi + echo " (Or just make your next docs commit — post-commit will auto-regenerate.)" + echo +} >&2 diff --git a/scripts/README.md b/scripts/README.md index 18a441a27..79df94826 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -46,3 +46,33 @@ node scripts/lint-mdx.js all # Fail CI if linting errors exist node scripts/lint-mdx.js all || exit 1 ``` + +## Docs index generators + +Two generators emit AI-facing site indexes from the `docs/` tree. Both share helpers in `lib/docs-utils.js` (frontmatter parser, `.mintignore` loader, file walker, section discovery). + +### `agents.js` → `docs/agents.md` + +Compact pipe-delimited directory index plus a featured-pages section. Run via `/agents` or directly: + +```bash +node scripts/agents.js +``` + +The repo's `githooks/post-commit` hook re-runs this automatically after any commit whose message contains the substring `agents.md` (case-insensitive). + +### `llms.js` → `docs/llms.txt` + `docs/llms-full.txt` + +Spec-conformant [llms.txt](https://llmstxt.org) index plus a full-context variant. + +```bash +node scripts/llms.js +``` + +- `llms.txt` is fully regenerated each run: H1, blockquote summary, one H2 per top-level section with `- [title](url): description` bullets, and a single `## Optional` H2 for MCP/skills pointers. +- `llms-full.txt` has two regions delimited by HTML comment markers: + - `LLMS_EXTRAS_*` wraps hand-written cross-cutting concept guides — preserved verbatim across runs. + - `LLMS_AUTOGEN_*` wraps the per-page index — regenerated from the current docs tree. + - First-run migration: if the file has no markers yet, everything after the first blockquote is captured as extras automatically. + +The repo's `githooks/post-commit` hook re-runs this automatically after any commit whose message contains the substring `llms.txt` (case-insensitive). If the regenerated files differ from what was committed, the hook creates a follow-up `chore: regenerate docs/llms.txt` commit. See `githooks/README.md` to enable. diff --git a/scripts/agents.js b/scripts/agents.js index d3f9a6de0..566e3139c 100755 --- a/scripts/agents.js +++ b/scripts/agents.js @@ -29,6 +29,15 @@ const fs = require('fs'); const path = require('path'); +const { + CONSTANTS, + humanize, + stripNumericPrefixes, + parseFrontmatter, + loadMintIgnore, + discoverTopLevelSections, + walkDocFiles, +} = require('./lib/docs-utils'); const CONFIG = { docsDir: './docs', @@ -39,153 +48,8 @@ const CONFIG = { mcpUrl: 'https://docs.base.org/mcp', skillsRepoUrl: 'https://github.com/base/skills', skillsInstallCmd: 'npx skills add base/base-skills', - - // Acronyms preserved as upper-case when humanizing directory names. - acronyms: new Set(['AI', 'MCP', 'API', 'SDK', 'L2', 'EVM', 'NFT', 'DAO', 'P2P', 'RPC']), - - // Files searched (in order) for a section's description. Looked up directly - // inside the section dir; if none match, the script falls back to the first - // file inside
/quickstart/. - sectionIndexFiles: ['index.mdx', 'index.md', 'overview.mdx', 'overview.md'], - sectionFallbackDirs: ['quickstart'], - - skipFiles: [ - 'README.md', 'CHANGELOG.md', 'LICENSE.md', '.DS_Store', - 'docs.json', 'package-lock.json', 'llms.txt', 'llms-full.txt', - 'iframe-theme.js', 'style.css', 'instructions.md', 'writing.md', 'CLAUDE.md' - ], - - skipFilePatterns: [/-vid$/, /-video$/, /-sbs$/], - - skipDirs: [ - 'node_modules', '.git', 'dist', 'build', 'coverage', - '.next', 'images', 'videos', 'logo', 'openapi', '.claude', 'snippets' - ], - - extensions: ['.md', '.mdx'] }; -function humanize(name) { - const cleaned = name.replace(/^\d+-/, ''); - return cleaned.split('-').map(word => { - if (!word) return ''; - const upper = word.toUpperCase(); - if (CONFIG.acronyms.has(upper)) return upper; - return word.charAt(0).toUpperCase() + word.slice(1); - }).join(' '); -} - -function stripNumericPrefixes(relPath) { - return relPath.split('/').map(seg => seg.replace(/^\d+-/, '')).join('/'); -} - -function parseFrontmatter(content) { - const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/); - if (!match) return { frontmatter: {}, body: content }; - - const fm = {}; - for (const line of match[1].split(/\r?\n/)) { - const m = line.match(/^([a-zA-Z_][a-zA-Z0-9_-]*):\s*(.*)$/); - if (!m) continue; - let value = m[2].trim(); - if ((value.startsWith('"') && value.endsWith('"')) || - (value.startsWith("'") && value.endsWith("'"))) { - value = value.slice(1, -1); - } - if (value === 'true') value = true; - else if (value === 'false') value = false; - else if (/^-?\d+$/.test(value)) value = Number(value); - fm[m[1]] = value; - } - return { frontmatter: fm, body: match[2] }; -} - -function loadMintIgnore(mintignorePath) { - const ignored = { dirs: new Set(), files: new Set(), bareFiles: new Set() }; - if (!fs.existsSync(mintignorePath)) return ignored; - - for (const line of fs.readFileSync(mintignorePath, 'utf8').split('\n')) { - const trimmed = line.trim(); - if (!trimmed || trimmed.startsWith('#')) continue; - if (trimmed.endsWith('/*')) { - ignored.dirs.add(trimmed.slice(1, -2)); - } else if (trimmed.startsWith('/')) { - ignored.files.add(trimmed.slice(1)); - } else { - ignored.bareFiles.add(trimmed.replace(/\.mdx?$/, '')); - } - } - return ignored; -} - -function descriptionFromFile(file) { - if (!fs.existsSync(file)) return ''; - const { frontmatter } = parseFrontmatter(fs.readFileSync(file, 'utf8')); - return frontmatter.description ? String(frontmatter.description).trim() : ''; -} - -function firstDocFileIn(dir) { - if (!fs.existsSync(dir)) return ''; - const candidates = fs.readdirSync(dir, { withFileTypes: true }) - .filter(e => e.isFile() - && CONFIG.extensions.includes(path.extname(e.name).toLowerCase()) - && !CONFIG.skipFiles.includes(e.name)) - .map(e => e.name) - .sort(); - return candidates.length ? path.join(dir, candidates[0]) : ''; -} - -function readSectionDescription(sectionDir) { - // 1. Section-level index/overview file - for (const candidate of CONFIG.sectionIndexFiles) { - const desc = descriptionFromFile(path.join(sectionDir, candidate)); - if (desc) return desc; - } - // 2. First file inside a known fallback subdir (e.g. quickstart/) - for (const sub of CONFIG.sectionFallbackDirs) { - const first = firstDocFileIn(path.join(sectionDir, sub)); - if (first) { - const desc = descriptionFromFile(first); - if (desc) return desc; - } - } - return ''; -} - -function discoverTopLevelSections() { - if (!fs.existsSync(CONFIG.docsDir)) return []; - return fs.readdirSync(CONFIG.docsDir, { withFileTypes: true }) - .filter(e => e.isDirectory() - && !CONFIG.skipDirs.includes(e.name) - && !e.name.startsWith('.')) - .map(e => { - const cleanName = e.name.replace(/^\d+-/, ''); - return { - slug: cleanName, - title: humanize(e.name), - description: readSectionDescription(path.join(CONFIG.docsDir, e.name)), - llmsPath: `./${cleanName}/llms.txt`, - }; - }) - .sort((a, b) => a.title.localeCompare(b.title)); -} - -function walkDocFiles(dir, results = []) { - if (!fs.existsSync(dir)) return results; - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - if (entry.name.startsWith('.')) continue; - if (CONFIG.skipFiles.includes(entry.name)) continue; - const full = path.join(dir, entry.name); - if (entry.isDirectory()) { - if (CONFIG.skipDirs.includes(entry.name)) continue; - walkDocFiles(full, results); - } else if (CONFIG.extensions.includes(path.extname(entry.name).toLowerCase())) { - results.push(full); - } - } - return results; -} - function discoverFeaturedPages() { const featured = []; for (const file of walkDocFiles(CONFIG.docsDir)) { @@ -212,17 +76,17 @@ function scanDocs(dir, basePath = '', ignored) { const files = []; for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - if (CONFIG.skipFiles.includes(entry.name) || entry.name.startsWith('.')) continue; + if (CONSTANTS.skipFiles.includes(entry.name) || entry.name.startsWith('.')) continue; const fullPath = path.join(dir, entry.name); if (entry.isDirectory()) { - if (CONFIG.skipDirs.includes(entry.name)) continue; + if (CONSTANTS.skipDirs.includes(entry.name)) continue; Object.assign(index, scanDocs(fullPath, basePath ? `${basePath}/${entry.name}` : entry.name, ignored)); } else { const ext = path.extname(entry.name).toLowerCase(); - if (!CONFIG.extensions.includes(ext)) continue; + if (!CONSTANTS.extensions.includes(ext)) continue; const baseName = entry.name.replace(/\.mdx?$/, ''); - if (CONFIG.skipFilePatterns.some(p => p.test(baseName))) continue; + if (CONSTANTS.skipFilePatterns.some(p => p.test(baseName))) continue; if (ignored.bareFiles.has(baseName)) continue; if (ignored.files.has(basePath ? `${basePath}/${baseName}` : baseName)) continue; files.push(baseName); @@ -239,7 +103,8 @@ function scanDocs(dir, basePath = '', ignored) { function buildEntryPointSection(sections) { const bullets = sections.map(s => { const desc = s.description ? ` — ${s.description}` : ''; - return `- [${s.title}](${s.llmsPath})${desc}`; + const llmsPath = `./${s.slug}/llms.txt`; + return `- [${s.title}](${llmsPath})${desc}`; }).join('\n'); return `## Base Documentation — LLM Entry Point @@ -298,7 +163,7 @@ function generateAgentsMd() { throw new Error(`agents.md description exceeds 200 chars (${description.length})`); } - const sections = discoverTopLevelSections(); + const sections = discoverTopLevelSections(CONFIG.docsDir); const featured = discoverFeaturedPages(); const blocks = [ diff --git a/scripts/lib/docs-utils.js b/scripts/lib/docs-utils.js new file mode 100644 index 000000000..18fe80471 --- /dev/null +++ b/scripts/lib/docs-utils.js @@ -0,0 +1,169 @@ +/** + * Shared primitives for docs-tree generators (agents.js, llms.js). + * + * Pure helpers + a base CONSTANTS object with the file/dir skiplists, file + * extensions, acronym set, and section-discovery fallback lists. Each generator + * imports CONSTANTS and the helpers it needs; generator-specific config (output + * paths, hardcoded URLs, etc.) stays in the generator script. + */ + +const fs = require('fs'); +const path = require('path'); + +const CONSTANTS = { + // Acronyms preserved as upper-case when humanizing directory names. + acronyms: new Set(['AI', 'MCP', 'API', 'SDK', 'L2', 'EVM', 'NFT', 'DAO', 'P2P', 'RPC']), + + // Files searched (in order) for a section's description. Looked up directly + // inside the section dir; if none match, the script falls back to the first + // file inside
/quickstart/. + sectionIndexFiles: ['index.mdx', 'index.md', 'overview.mdx', 'overview.md'], + sectionFallbackDirs: ['quickstart'], + + skipFiles: [ + 'README.md', 'CHANGELOG.md', 'LICENSE.md', '.DS_Store', + 'docs.json', 'package-lock.json', 'llms.txt', 'llms-full.txt', + 'iframe-theme.js', 'style.css', 'instructions.md', 'writing.md', 'CLAUDE.md' + ], + + skipFilePatterns: [/-vid$/, /-video$/, /-sbs$/], + + skipDirs: [ + 'node_modules', '.git', 'dist', 'build', 'coverage', + '.next', 'images', 'videos', 'logo', 'openapi', '.claude', 'snippets' + ], + + extensions: ['.md', '.mdx'], +}; + +function humanize(name) { + const cleaned = name.replace(/^\d+-/, ''); + return cleaned.split('-').map(word => { + if (!word) return ''; + const upper = word.toUpperCase(); + if (CONSTANTS.acronyms.has(upper)) return upper; + return word.charAt(0).toUpperCase() + word.slice(1); + }).join(' '); +} + +function stripNumericPrefixes(relPath) { + return relPath.split('/').map(seg => seg.replace(/^\d+-/, '')).join('/'); +} + +function parseFrontmatter(content) { + const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/); + if (!match) return { frontmatter: {}, body: content }; + + const fm = {}; + for (const line of match[1].split(/\r?\n/)) { + const m = line.match(/^([a-zA-Z_][a-zA-Z0-9_-]*):\s*(.*)$/); + if (!m) continue; + let value = m[2].trim(); + if ((value.startsWith('"') && value.endsWith('"')) || + (value.startsWith("'") && value.endsWith("'"))) { + value = value.slice(1, -1); + } + if (value === 'true') value = true; + else if (value === 'false') value = false; + else if (/^-?\d+$/.test(value)) value = Number(value); + fm[m[1]] = value; + } + return { frontmatter: fm, body: match[2] }; +} + +function loadMintIgnore(mintignorePath) { + const ignored = { dirs: new Set(), files: new Set(), bareFiles: new Set() }; + if (!fs.existsSync(mintignorePath)) return ignored; + + for (const line of fs.readFileSync(mintignorePath, 'utf8').split('\n')) { + const trimmed = line.trim(); + if (!trimmed || trimmed.startsWith('#')) continue; + if (trimmed.endsWith('/*')) { + ignored.dirs.add(trimmed.slice(1, -2)); + } else if (trimmed.startsWith('/')) { + ignored.files.add(trimmed.slice(1)); + } else { + ignored.bareFiles.add(trimmed.replace(/\.mdx?$/, '')); + } + } + return ignored; +} + +function descriptionFromFile(file) { + if (!fs.existsSync(file)) return ''; + const { frontmatter } = parseFrontmatter(fs.readFileSync(file, 'utf8')); + return frontmatter.description ? String(frontmatter.description).trim() : ''; +} + +function firstDocFileIn(dir) { + if (!fs.existsSync(dir)) return ''; + const candidates = fs.readdirSync(dir, { withFileTypes: true }) + .filter(e => e.isFile() + && CONSTANTS.extensions.includes(path.extname(e.name).toLowerCase()) + && !CONSTANTS.skipFiles.includes(e.name)) + .map(e => e.name) + .sort(); + return candidates.length ? path.join(dir, candidates[0]) : ''; +} + +function readSectionDescription(sectionDir) { + for (const candidate of CONSTANTS.sectionIndexFiles) { + const desc = descriptionFromFile(path.join(sectionDir, candidate)); + if (desc) return desc; + } + for (const sub of CONSTANTS.sectionFallbackDirs) { + const first = firstDocFileIn(path.join(sectionDir, sub)); + if (first) { + const desc = descriptionFromFile(first); + if (desc) return desc; + } + } + return ''; +} + +function discoverTopLevelSections(docsDir) { + if (!fs.existsSync(docsDir)) return []; + return fs.readdirSync(docsDir, { withFileTypes: true }) + .filter(e => e.isDirectory() + && !CONSTANTS.skipDirs.includes(e.name) + && !e.name.startsWith('.')) + .map(e => { + const cleanName = e.name.replace(/^\d+-/, ''); + return { + slug: cleanName, + dirName: e.name, + title: humanize(e.name), + description: readSectionDescription(path.join(docsDir, e.name)), + }; + }) + .sort((a, b) => a.title.localeCompare(b.title)); +} + +function walkDocFiles(dir, results = []) { + if (!fs.existsSync(dir)) return results; + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + if (entry.name.startsWith('.')) continue; + if (CONSTANTS.skipFiles.includes(entry.name)) continue; + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + if (CONSTANTS.skipDirs.includes(entry.name)) continue; + walkDocFiles(full, results); + } else if (CONSTANTS.extensions.includes(path.extname(entry.name).toLowerCase())) { + results.push(full); + } + } + return results; +} + +module.exports = { + CONSTANTS, + humanize, + stripNumericPrefixes, + parseFrontmatter, + loadMintIgnore, + descriptionFromFile, + firstDocFileIn, + readSectionDescription, + discoverTopLevelSections, + walkDocFiles, +}; diff --git a/scripts/llms.js b/scripts/llms.js new file mode 100644 index 000000000..ed885635c --- /dev/null +++ b/scripts/llms.js @@ -0,0 +1,273 @@ +#!/usr/bin/env node + +/** + * Generates docs/llms.txt and docs/llms-full.txt — the LLM-facing site indexes + * defined by https://llmstxt.org. + * + * llms.txt Strict-spec index. H1 = project name, blockquote summary, + * H2 per top-level section with `- [title](url): description` + * bullets, and a single `## Optional` for skippable extras + * (MCP server, skills, full-context pointer). + * + * llms-full.txt Spec-aligned but with two regions: + * - LLMS_EXTRAS markers wrap hand-written cross-cutting + * guides (auth, networks, errors, etc.). The script reads + * and re-emits this region verbatim. + * - LLMS_AUTOGEN markers wrap the per-page index. Always + * regenerated from the current docs/ tree. + * First-run migration: if no markers are found in the existing + * file, everything after the first blockquote is captured as + * extras so hand-written content survives. + * + * Usage: node scripts/llms.js + */ + +const fs = require('fs'); +const path = require('path'); +const { + CONSTANTS, + humanize, + stripNumericPrefixes, + parseFrontmatter, + loadMintIgnore, + walkDocFiles, +} = require('./lib/docs-utils'); + +const CONFIG = { + docsDir: './docs', + llmsFile: './docs/llms.txt', + llmsFullFile: './docs/llms-full.txt', + + docsUrl: 'https://docs.base.org', + mcpUrl: 'https://docs.base.org/mcp', + skillsRepoUrl: 'https://github.com/base/skills', + skillsInstallCmd: 'npx skills add base/base-skills', + + projectTitle: 'Base Documentation', + fullProjectTitle: 'Base Documentation — Full Context', + + summary: "Build on Base — Coinbase's Ethereum L2. Smart Wallet, OnchainKit, MiniKit, Base Chain RPCs, and AI Agents. This index points AI assistants at the canonical page for each topic; follow the links for full context.", + + fullSummary: "Full context for AI agents working with Base. Cross-cutting concept guides (networks, auth, errors, rate limits) sit above an exhaustive per-page index of every documentation file. Follow page URLs for source content.", + + // Canonical display order for top-level sections. Unknown sections appear + // after these in alphabetical order. + sectionOrder: ['get-started', 'base-chain', 'base-account', 'ai-agents', 'apps'], + + // Frontmatter keys whose truthy value excludes a page from llms output. + hiddenFrontmatterKeys: ['hidden', 'draft'], + + extrasStartMarker: '', + extrasEndMarker: '', + autogenStartMarker: '', + autogenEndMarker: '', +}; + +// ---------- Page discovery ---------- + +function isHidden(frontmatter) { + return CONFIG.hiddenFrontmatterKeys.some(k => frontmatter[k] === true); +} + +function pageRecord(absPath) { + const rel = path.relative(CONFIG.docsDir, absPath).replace(/\\/g, '/'); + const baseName = path.basename(rel).replace(/\.mdx?$/, ''); + if (CONSTANTS.skipFilePatterns.some(p => p.test(baseName))) return null; + + const { frontmatter } = parseFrontmatter(fs.readFileSync(absPath, 'utf8')); + if (isHidden(frontmatter)) return null; + + const cleanRel = stripNumericPrefixes(rel.replace(/\.mdx?$/, '')); + const segments = cleanRel.split('/'); + const section = segments[0]; + const subPath = segments.slice(1).join('/'); + + const title = frontmatter.title + ? String(frontmatter.title) + : humanize(baseName); + const description = frontmatter.description + ? String(frontmatter.description).trim() + : ''; + + return { + section, + subPath, + cleanRel, + title, + description, + url: `${CONFIG.docsUrl}/${cleanRel}`, + isIndex: /^(index|overview)$/i.test(baseName), + }; +} + +function discoverPages(ignored) { + const pages = []; + for (const file of walkDocFiles(CONFIG.docsDir)) { + const rel = path.relative(CONFIG.docsDir, file).replace(/\\/g, '/'); + const baseName = path.basename(rel).replace(/\.mdx?$/, ''); + const dirPath = path.dirname(rel); + const dirSegments = dirPath === '.' ? [] : dirPath.split('/'); + if (ignored.bareFiles.has(baseName)) continue; + if (ignored.files.has(rel.replace(/\.mdx?$/, ''))) continue; + if (dirSegments.some(seg => ignored.dirs.has(seg))) continue; + + // Top-level files (no parent section) are skipped — llms*.txt indexes + // describe sectioned docs, not root-level meta files like agents.md. + if (dirSegments.length === 0) continue; + + const record = pageRecord(file); + if (record) pages.push(record); + } + return pages; +} + +function groupBySection(pages) { + const groups = new Map(); + for (const page of pages) { + if (!groups.has(page.section)) groups.set(page.section, []); + groups.get(page.section).push(page); + } + for (const list of groups.values()) { + list.sort((a, b) => { + // Section index/overview first, then alphabetical by subPath. + if (a.isIndex !== b.isIndex) return a.isIndex ? -1 : 1; + return a.subPath.localeCompare(b.subPath); + }); + } + return groups; +} + +function orderedSectionEntries(groups) { + const order = new Map(CONFIG.sectionOrder.map((s, i) => [s, i])); + return [...groups.entries()].sort(([a], [b]) => { + const ai = order.has(a) ? order.get(a) : 1000; + const bi = order.has(b) ? order.get(b) : 1000; + if (ai !== bi) return ai - bi; + return a.localeCompare(b); + }); +} + +// ---------- Rendering ---------- + +function bulletFor(page) { + return page.description + ? `- [${page.title}](${page.url}): ${page.description}` + : `- [${page.title}](${page.url})`; +} + +function renderSection(sectionSlug, pages) { + const heading = humanize(sectionSlug); + const lines = [`## ${heading}`, ...pages.map(bulletFor)]; + return lines.join('\n'); +} + +function renderOptionalSection(includeFullPointer) { + const bullets = [ + `- [Base MCP server](${CONFIG.mcpUrl}): Direct AI access to Base documentation`, + `- [Base skills](${CONFIG.skillsRepoUrl}): Installable agent skills (\`${CONFIG.skillsInstallCmd}\`)`, + ]; + if (includeFullPointer) { + bullets.push(`- [Full context (llms-full.txt)](${CONFIG.docsUrl}/llms-full.txt): Same index plus cross-cutting concept guides`); + } else { + bullets.push(`- [Index (llms.txt)](${CONFIG.docsUrl}/llms.txt): Strict-spec section index without the full-context extras`); + } + return [`## Optional`, ...bullets].join('\n'); +} + +function renderLlmsTxt(groups) { + const sectionBlocks = orderedSectionEntries(groups) + .map(([slug, pages]) => renderSection(slug, pages)); + + return [ + `# ${CONFIG.projectTitle}`, + `> ${CONFIG.summary}`, + ...sectionBlocks, + renderOptionalSection(true), + ].join('\n\n') + '\n'; +} + +function renderAutogenBody(groups) { + const sectionBlocks = orderedSectionEntries(groups) + .map(([slug, pages]) => renderSection(slug, pages)); + return [...sectionBlocks, renderOptionalSection(false)].join('\n\n'); +} + +// ---------- llms-full.txt: extras preservation ---------- + +/** + * Returns the verbatim bytes between EXTRAS markers in the existing file. + * If markers are missing, falls back to "everything after the first blockquote + * and before the AUTOGEN region" so hand-written content survives the first run. + * Returns '' if there's nothing to preserve. + */ +function extractExtras(existing) { + if (!existing) return ''; + + const startIdx = existing.indexOf(CONFIG.extrasStartMarker); + const endIdx = existing.indexOf(CONFIG.extrasEndMarker); + if (startIdx !== -1 && endIdx !== -1 && endIdx > startIdx) { + const inner = existing.slice(startIdx + CONFIG.extrasStartMarker.length, endIdx); + return inner.trim(); + } + + // Migration path: take everything after the first blockquote up to the + // AUTOGEN start marker (or EOF). + const blockquoteMatch = existing.match(/^>[^\n]*(\n>[^\n]*)*\n+/m); + if (!blockquoteMatch) return existing.trim(); + const afterBlockquote = existing.slice(blockquoteMatch.index + blockquoteMatch[0].length); + const autogenIdx = afterBlockquote.indexOf(CONFIG.autogenStartMarker); + const sliced = autogenIdx === -1 ? afterBlockquote : afterBlockquote.slice(0, autogenIdx); + return sliced.trim(); +} + +function renderLlmsFullTxt(existing, groups) { + const extras = extractExtras(existing); + const autogenBody = renderAutogenBody(groups); + + const extrasBlock = [ + CONFIG.extrasStartMarker, + extras || '', + CONFIG.extrasEndMarker, + ].join('\n\n'); + + const autogenBlock = [ + CONFIG.autogenStartMarker, + autogenBody, + CONFIG.autogenEndMarker, + ].join('\n\n'); + + return [ + `# ${CONFIG.fullProjectTitle}`, + `> ${CONFIG.fullSummary}`, + extrasBlock, + autogenBlock, + ].join('\n\n') + '\n'; +} + +// ---------- Entry point ---------- + +function generate() { + const ignored = loadMintIgnore(`${CONFIG.docsDir}/.mintignore`); + const pages = discoverPages(ignored); + const groups = groupBySection(pages); + + const llms = renderLlmsTxt(groups); + fs.writeFileSync(CONFIG.llmsFile, llms); + + const existingFull = fs.existsSync(CONFIG.llmsFullFile) + ? fs.readFileSync(CONFIG.llmsFullFile, 'utf8') + : ''; + const llmsFull = renderLlmsFullTxt(existingFull, groups); + fs.writeFileSync(CONFIG.llmsFullFile, llmsFull); + + const sectionCount = groups.size; + const sizeKb = (n) => (Buffer.byteLength(n, 'utf8') / 1024).toFixed(2); + + console.log(`Generated: ${CONFIG.llmsFile} (${sizeKb(llms)} KB)`); + console.log(`Generated: ${CONFIG.llmsFullFile} (${sizeKb(llmsFull)} KB)`); + console.log(`Sections: ${sectionCount}, pages: ${pages.length}`); + console.log(''); + console.log(`Review changes with: git diff ${CONFIG.llmsFile} ${CONFIG.llmsFullFile}`); +} + +generate();