ethskills

repository·master·Indexed 42 days ago

https://github.com/austintgriffith/ethskills

A collection of specialized markdown files and verified onchain context designed to correct LLM hallucinations and outdated knowledge in Ethereum development. Covers topics including gas costs, EIPs, Solidity security patterns, ERC standards (ERC-20, ERC-721, ERC-8004), Layer 2 deployments, and verified contract addresses for major protocols like Uniswap, Aave, and Chainlink. Includes plugins for Claude Code and OpenClaw agents.

Tokens
59.6K
Snippets
131
Records
224
Agent score
55%

What's inside ethskills

  1. What the ethskills OpenClaw skill provides

    master

    The ethskills skill acts as a real-time documentation fetcher for AI agents. When an agent is assigned an Ethereum, Solidity, or dApp-related task, this skill instructs the agent to fetch relevant documentation from ethskills.com.

    This helps correct common LLM errors regarding:

    • Gas costs
    • Tooling
    • Layer 2 (L2) implementations
    • Deployment patterns

    Topics covered include:

    • Scaffold-ETH 2 project setup
    • Solidity security patterns
    • Gas costs (correcting stale training data)
    • Layer 2 deployment
    • ERC standards (ERC-20, ERC-721, ERC-8004, x402)
    • DeFi composability
    • Testing with Foundry
    • Frontend UX patterns
    • Production deployment & QA
  2. Use the EVM Smart Contract Audit skill

    master

    The audit skill is a deep EVM smart contract security audit system designed for systematically reviewing contracts you did not write. It uses parallel sub-agents to run specialized checklists across 19 vulnerability domains, synthesizes findings, and can file GitHub issues.

    Note: This is distinct from the security skill, which is intended for teaching defensive coding. Use audit for finding vulnerabilities and reviewing existing code.

  3. Use Poseidon for in-circuit hashing

    master

    Do not use SHA256 for hashing inside Noir circuits, as it is extremely expensive (~30,000 gates vs ~600 for Poseidon).

    Note that Poseidon has been removed from the Noir standard library. You must add it as an external dependency in your Nargo.toml and use the following import syntax:

    use poseidon::poseidon::bn254::hash_2;

    Warning: Poseidon and Poseidon2 are different algorithms with different outputs. Do not mix them between your circuit, offchain tree, and smart contracts.

  4. Design smart contracts event-first

    master

    To enable efficient offchain querying, every state change in your smart contract should emit a Solidity event. Events are the primary way indexers, frontends, and block explorers track historical activity.

    Best Practices:

    • Index searchable fields: Use the indexed keyword for fields you will frequently filter by (e.g., address, id, owner). You are limited to 3 indexed topics per event.
    • Avoid indexing large values: Do not index data that you won't use for filtering to save gas.
    • Use events for history: Do not rely on eth_call for historical state; use events to reconstruct history offchain.
    // ✅ Good — every action emits a queryable event
    contract Marketplace {
        event Listed(
            uint256 indexed listingId,
            address indexed seller,
            address indexed tokenContract,
            uint256 tokenId,
            uint256 price
        );
        event Sold(uint256 indexed listingId, address indexed buyer, uint256 price);
        event Cancelled(uint256 indexed listingId);
    
        function list(address token, uint256 tokenId, uint256 price) external {
            uint256 id = nextListingId++;
            listings[id] = Listing(msg.sender, token, tokenId, price, true);
            emit Listed(id, msg.sender, token, tokenId, price);
        }
    
        function buy(uint256 listingId) external payable {
            // ... transfer logic ...
            emit Sold(listingId, msg.sender, msg.value);
        }
    }
  5. Ensure Hash Parity Across Layers

    master

    If your circuit uses a specific hash (e.g., poseidon::poseidon::bn254::hash_2), every other layer in your stack must use the exact same algorithm and input ordering. This includes:

    • Commitment creation
    • Merkle parent hashing
    • Offchain tree mirrors
    • Onchain tree contracts

    Warning: Do not mix different hash types (e.g., Poseidon vs Poseidon2 vs Keccak). poseidon2Hash is not a substitute for poseidon::poseidon::bn254::hash_2.

  6. Avoid common CROPS failure modes in dApp design

    master

    When designing or reviewing dApps, avoid these common misconceptions that undermine the CROPS pillars:

    • "It works" is not enough: A functional dApp can still be broken if it relies on a censorable frontend, closed indexer, invisible RPC, or custodial wallet.
    • Decentralization is more than just contracts: A permissionless contract does not make a dApp decentralized if the user experience depends on a single hosted frontend, API, relayer, paymaster, sequencer, bridge, or wallet vendor.
    • Verified contracts $ eq$ Open dApp: Etherscan verification only ties bytecode to source for that specific contract. An "Open" dApp requires the whole stack to be public, and "Free" requires OSI-permissive or copyleft licenses (not just source-available).
    • Privacy must be architected early: Do not wait until after the architecture is set to check privacy. Evaluate exposure of addresses, balances, counterparties, timing data, IP metadata, and wallet fingerprints during the design phase.
    • Security is more than code bugs: Beyond reentrancy and oracle manipulation, you must account for custody, upgrades, admin keys, recovery, emergency powers, and vendor liveness (whether the app works if the team disappears).
    • List trust tradeoffs for all options: When presenting architecture choices (e.g., Embedded Wallet vs. Safe vs. EOA, or Vercel vs. IPFS), explicitly label the CROPS impact and recommend the most CROPS-aligned default.
  7. Use The Graph for historical data indexing

    master

    The Graph is a decentralized protocol used to turn contract events into a queryable GraphQL API. It is the standard for dApps requiring activity feeds, transaction history, or analytics.

    Workflow:

    1. Define a schema: Specify the entities you want to query using GraphQL.
    2. Write mappings: Create TypeScript handlers that process events and update entities.
    3. Deploy: Use the Graph CLI to build and deploy your subgraph.
    # Example schema.graphql
    type Token @entity {
      id: ID!
      tokenId: BigInt!
      owner: Bytes!
      mintedAt: BigInt!
      transfers: [Transfer!]! @derivedFrom(field: "token")
    }
    
    type Transfer @entity {
      id: ID!
      token: Token!
      from: Bytes!
      to: Bytes!
      timestamp: BigInt!
      blockNumber: BigInt!
    }
  8. Build an Autonomous Agent Economy with ERC-8004 and x402

    master

    You can combine ERC-8004 (Identity) and x402 (Payments) to create a fully autonomous economic loop for agents. This allows agents to discover services, verify reputation, pay for access, and provide feedback without human intervention.

    The Autonomous Loop:

    1. Discovery: Agent finds a service via the ERC-8004 registry.
    2. Verification: Agent checks the service's reputation via ERC-8004.
    3. Request: Agent calls the service endpoint.
    4. Payment: Service returns 402 Payment Required; Agent pays via x402 (using an EIP-3009 signature).
    5. Execution: Agent receives the requested service.
    6. Feedback: Agent posts reputation feedback to ERC-8004.
    1. Agent discovers service (ERC-8004 registry)
    2. Agent checks reputation (ERC-8004)
    3. Agent calls endpoint → 402 Payment Required
    4. Agent pays via x402 (EIP-3009 signature)
    5. Agent receives service
    6. Agent posts feedback to ERC-8004
  9. Avoid dApp Development Anti-Patterns

    master

    To ensure a scalable and secure dApp, avoid these common mistakes:

    • Kitchen sink contract: Avoid creating one massive contract that handles everything (swap, lend, stake, etc.). Split responsibilities into multiple specialized contracts.
    • Factory nobody asked for: Do not build a factory contract unless your protocol actually requires deploying multiple unique instances for different users.
    • Onchain everything: Only store ownership and value transfers onchain. Use offchain storage for user profiles, activity logs, images, and analytics.
    • Admin crutch: Avoid relying on a single admin account for maintenance. Design permissionless alternatives with proper incentives.
    • Premature multi-chain: Do not launch on multiple chains simultaneously. Prove product-market fit on one chain first.
    • Reinventing audited primitives: Do not write your own ERC-20, access control, or math libraries. Always use battle-tested libraries like OpenZeppelin.
    • Ignoring the frontend: A working contract with a broken UI is useless. Budget approximately 40% of your development time for frontend polish.
  10. Plan dApp architecture with the CROPS Gate

    master

    Before finalizing your dApp architecture, perform a CROPS check to identify critical tradeoffs. This ensures you don't accidentally design a system that is centralized or insecure.

    Evaluate your design against these four pillars:

    • Censorship Resistance: Identify who can block users or critical application paths.
    • Open Source and Free: Ensure the full stack can be inspected, forked, self-hosted, and legally reused.
    • Privacy: Determine what user activity or identity data becomes public or visible to third parties.
    • Security: Define who controls funds, permissions, upgrades, emergency powers, recovery, and exit paths.

    When performing this check, explicitly name your chosen default, your main compromise, and the user's escape path.

  11. Understand the EIP and Fork lifecycle

    master

    Ethereum protocol changes follow a specific lifecycle from proposal to implementation. Understanding these states is critical for determining how close a feature is to being live.

    EIP Lifecycle (Specification Phase)

    • Draft: Initial written proposal; no indication of likelihood of inclusion.
    • Review: The proposal is under discussion.
    • Last Call: The specification is frozen; this is the final period for objections.
    • Final: The specification is complete. For non-fork EIPs (like ERCs), it is official. For fork EIPs, it is ready but not yet scheduled.

    Fork Inclusion States (Implementation Phase)

    • CFI (Considered for Inclusion): Core devs are evaluating the EIP for a specific fork; implementation work has begun.
    • SFI (Scheduled for Inclusion): The EIP is confirmed for a fork and is being tested on devnets.
    • DFI (Declined for Inclusion): The EIP was rejected for a specific fork but may be reconsidered later.
    Draft → Review → Last Call → Final
                        ↓
                (for hard forks)
             CFI → SFI → Included
  12. Understand Robinhood Chain mechanics and censorship risks

    master

    Robinhood Chain (Chain ID 4663) is an Arbitrum Orbit rollup that settles directly to Ethereum (not an L3). It uses Ethereum blob DA and ETH for gas.

    Stock Token Mechanics:

    • Tokens are plain ERC-20s (18 decimals) representing economic exposure to debt securities.
    • Not available to US, Canada, UK, Switzerland, or UAE persons.
    • Uses a Blocklist (not allowlist) via a shared AccessControlsRegistry.
    • Implements ERC-8056 "Scaled UI Amount" for handling splits/dividends via a uiMultiplier() display; raw balances do not rebase.
    • USDG (Paxos) stablecoin uses 6 decimals, not 18.

    ⚠️ Critical Censorship Warning: Robinhood Chain uses ArbOS 61 transaction filtering. An authorized filterer can register any tx hash in a precompile (0x…0074), causing the state transition function to reject it—even if the transaction was force-included via L1. Force inclusion is NOT a censorship escape hatch here. Run crops/SKILL.md before building censorship-sensitive applications.