> ## Documentation Index
> Fetch the complete documentation index at: https://cheetahai.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Web3 Development

> Write, compile, test, and deploy smart contracts and Solana programs from your IDE

## What You Can Do

If you're a web3 developer, you no longer need to juggle Remix, MetaMask, terminal windows, and block explorers. Everything lives inside the editor:

* Write Solidity contracts or Anchor/Rust programs
* Compile with Foundry (EVM) or Anchor (Solana)
* Spin up a local blockchain (Anvil or solana-test-validator) with one command
* Deploy to local, testnet, or mainnet
* Interact with deployed contracts (read/write functions, token transfers)
* Audit contracts for security vulnerabilities
* Manage your wallet, switch chains, check balances

All of this happens through the AI chat. You describe what you want, and the AI executes each step using built-in tools. No CLI commands, no deployment scripts, no context switching.

## How It Works (The Mental Model)

Traditional web3 development looks like this:

1. Write contract in VS Code
2. Open terminal, run `forge build`
3. Open another terminal, run `anvil`
4. Write a deployment script
5. Run `forge script`
6. Copy the contract address
7. Open Etherscan or use `cast` to interact

Here, the workflow is conversational:

1. Write your contract (or ask the AI to generate it)
2. Say "compile and deploy this contract"
3. The AI compiles it, starts a local node, funds your wallet, deploys, and gives you the contract address
4. Say "call the mint function" and it does it

The AI handles compilation, deployment, chain switching, gas estimation, and ABI encoding internally. You focus on the logic.

## Supported Chains

### EVM Networks

| Network           | Type       | Native Token |
| ----------------- | ---------- | ------------ |
| Ethereum          | Mainnet    | ETH          |
| Sepolia           | Testnet    | ETH          |
| Polygon           | Mainnet    | POL          |
| Polygon Amoy      | Testnet    | POL          |
| BNB Smart Chain   | Mainnet    | BNB          |
| BSC Testnet       | Testnet    | tBNB         |
| Arbitrum One      | L2 Mainnet | ETH          |
| Arbitrum Sepolia  | L2 Testnet | ETH          |
| Optimism          | L2 Mainnet | ETH          |
| Optimism Sepolia  | L2 Testnet | ETH          |
| Base              | L2 Mainnet | ETH          |
| Base Sepolia      | L2 Testnet | ETH          |
| Avalanche C-Chain | Mainnet    | AVAX         |
| Avalanche Fuji    | Testnet    | AVAX         |
| Local EVM (Anvil) | Local      | ETH          |

### Solana Networks

| Network      | Cluster      | Native Token |
| ------------ | ------------ | ------------ |
| Mainnet Beta | mainnet-beta | SOL          |
| Testnet      | testnet      | SOL          |
| Local Solana | localhost    | SOL          |

## The Development Workflow

Here's the typical flow for a web3 developer, step by step.

### EVM Contract: Write → Compile → Test → Deploy → Interact

<Steps>
  <Step title="Write Your Contract">
    Create a Solidity file in your project. You can write it yourself or ask the AI:

    ```
    "Create an ERC-20 token called MyToken with minting and burning"
    ```

    The AI generates a contract using OpenZeppelin, creates the file, and sets up a Foundry project structure (`foundry.toml`, `src/`, `test/`).
  </Step>

  <Step title="Compile">
    ```
    "Compile my contract"
    ```

    Under the hood, this uses Foundry's `forge` compiler. You get back the bytecode and ABI. If there are errors, the AI shows them and suggests fixes.

    Two compilation modes:

    * **Project mode** — if you have a `foundry.toml`, it compiles the entire project
    * **Single file mode** — for quick one-off contracts, pass the source code directly
  </Step>

  <Step title="Write and Run Tests">
    ```
    "Write tests for MyToken and run them"
    ```

    The AI creates Foundry test files (`test/MyToken.t.sol`) using `forge-std`, then runs them. You see pass/fail results, gas usage, and stack traces for failures.

    ```solidity theme={null}
    function testMint() public {
        token.mint(user, 1000);
        assertEq(token.balanceOf(user), 1000);
    }
    ```
  </Step>

  <Step title="Start a Local Node">
    ```
    "Start a local EVM node"
    ```

    This spins up Anvil at `http://127.0.0.1:8545` with pre-funded accounts and instant block confirmations. Zero gas costs. The AI then switches your wallet to the Local EVM network and funds your account.
  </Step>

  <Step title="Deploy">
    ```
    "Deploy MyToken to local"
    ```

    The AI takes the compiled bytecode, deploys it to your local Anvil node, and returns the contract address and transaction hash.

    For contracts with constructor arguments:

    ```
    "Deploy with constructor args ['MyToken', 'MTK', 1000000]"
    ```
  </Step>

  <Step title="Interact with Your Contract">
    ```
    "Call mint(0x..., 1000) on the deployed contract"
    ```

    ```
    "Read totalSupply from the contract"
    ```

    Read operations are free. Write operations cost gas (free on local). The AI handles ABI encoding automatically — you never need to manually construct calldata.
  </Step>

  <Step title="Deploy to Testnet or Mainnet">
    When you're ready:

    ```
    "Switch to Sepolia and deploy"
    ```

    Same workflow, real network. Make sure you have testnet ETH (get from a faucet) or real ETH for mainnet.
  </Step>
</Steps>

### Solana Program: Write → Compile → Deploy → Interact

<Steps>
  <Step title="Write Your Program">
    Create an Anchor project or ask the AI:

    ```
    "Create a Solana program that stores a counter"
    ```

    The AI scaffolds an Anchor project with `Anchor.toml`, `programs/`, and `tests/`.
  </Step>

  <Step title="Install Toolchain (First Time Only)">
    ```
    "Install the Anchor toolchain"
    ```

    This installs Rust, Solana CLI, and Anchor. Takes 5-10 minutes. You only need to do this once.
  </Step>

  <Step title="Compile">
    ```
    "Compile my Anchor program"
    ```

    Produces a `.so` binary, an IDL file, and TypeScript bindings.
  </Step>

  <Step title="Start Local Validator and Deploy">
    ```
    "Start a local Solana node and deploy my program"
    ```

    Starts `solana-test-validator` at `http://127.0.0.1:8899`, funds your wallet with SOL, and deploys the compiled program.
  </Step>

  <Step title="Interact">
    ```
    "Call the increment instruction on my program"
    ```
  </Step>
</Steps>

## Local Development vs Testnets vs Mainnet

| Environment                           | Cost                 | Speed            | When to Use                             |
| ------------------------------------- | -------------------- | ---------------- | --------------------------------------- |
| Local (Anvil / solana-test-validator) | Free                 | Instant          | Day-to-day development, rapid iteration |
| Testnet (Sepolia, Solana Testnet)     | Free (faucet tokens) | Real block times | Integration testing, pre-production     |
| Mainnet                               | Real money           | Real block times | Production deployment                   |

The default workflow always starts local. You only move to testnet or mainnet when you explicitly ask.

## Security Auditing

```
"Audit my contract for vulnerabilities"
```

This runs Aderyn, a static analyzer that checks for 90+ vulnerability patterns including reentrancy, access control issues, and gas optimizations. Works with Foundry and Hardhat projects.

## What's Next

<CardGroup cols={2}>
  <Card title="Wallet" href="/docs/web3/wallet">
    Set up your wallet, manage keys, switch chains, send transactions.
  </Card>

  <Card title="Smart Contracts" href="/docs/web3/smart-contracts">
    Deep dive into Solidity compilation, testing, and deployment with Foundry.
  </Card>

  <Card title="Solana Development" href="/docs/web3/solana">
    Build Solana programs with Anchor, deploy to devnet and mainnet.
  </Card>
</CardGroup>
