Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This skill provides AI agents with deep knowledge of the MegaETH development eco
- **Gas Model**: MegaEVM-specific costs and estimation strategies
- **Debugging**: mega-evme CLI for transaction replay and gas profiling
- **Security**: MegaETH-specific considerations and audit checklists
- **SDK Payments**: `@moldy/mega-mpp-sdk` for MPP `charge` and `session` flows on MegaETH
- **Meridian**: x402 payments on MegaETH for seller/server and buyer/agent flows
- **MegaNames**: .mega naming service — registration, resolution, subdomains, subdomain marketplace
- **VRF / Randomness**: drand quicknet verifier integration for lotteries, reveals, and game mechanics
Expand Down Expand Up @@ -52,6 +53,7 @@ clawdhub install megaeth-developer
├── security.md # Vulnerabilities and prevention
├── erc7710-delegations.md # ERC-7710 delegation framework, caveats, permissions
├── smart-accounts.md # MetaMask Smart Accounts Kit, signers, user operations
├── mega-mpp-sdk.md # @moldy/mega-mpp-sdk paid route integration guide
├── meridian.md # Meridian x402 payments on MegaETH
├── meganames.md # MegaNames (.mega) — registration, resolution, subdomains, marketplace
├── warren.md # Warren Protocol — on-chain website hosting
Expand All @@ -69,6 +71,7 @@ Once installed, your AI agent will automatically use this skill when you ask abo
- Storage optimization and gas costs
- Real-time WebSocket subscriptions
- Debugging failed transactions
- Machine Payments Protocol paid routes on MegaETH
- Replaying or locally debugging MegaETH transactions with mega-evme
- Understanding when to use Foundry vs mega-evme for diagnosis

Expand All @@ -89,6 +92,9 @@ Once installed, your AI agent will automatically use this skill when you ask abo
"Create a MetaMask Smart Account on MegaETH"
"Set up spending limits and time-bound permissions"
"Implement redelegation chains"
"Add a paid API with MPP (Machine Payments Protocol) on MegaETH"
"Protect a Cloudflare Worker route on MegaETH with MPP (Machine Payments Protocol)"
"Use reusable session payments with MPP (Machine Payments Protocol) on MegaETH"
"Build a lottery or reveal flow with drand VRF on MegaETH"
"How should I safely integrate randomness on MegaETH?"
"Protect an API route with Meridian on MegaETH"
Expand Down
10 changes: 9 additions & 1 deletion SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: megaeth-developer
description: End-to-end MegaETH development playbook (Feb 2026). Covers Foundry project setup with MegaETH-specific config, wallet operations, token swaps (Kyber Network), eth_sendRawTransactionSync (EIP-7966) for instant receipts, JSON-RPC batching, real-time mini-block subscriptions, storage-aware contract patterns (Solady RedBlackTreeLib, transient storage), MegaEVM multidimensional gas model, WebSocket keepalive, bridging from Ethereum, Privy headless signing for ultra-low latency, debugging with mega-evme, x402 Permit2 payments on MegaETH (standard flow via x402ExactPermit2Proxy/x402UptoPermit2Proxy at canonical addresses), legacy Meridian x402 payments, and Warren Protocol for on-chain website hosting. Use when building on MegaETH, using Foundry, managing wallets, sending transactions, deploying contracts, integrating Privy embedded wallets, ERC-7710 delegation framework for scoped on-chain permissions, MetaMask Smart Accounts Kit for smart account creation and delegation management, integrating x402 Permit2 payments or Meridian/x402 paid APIs or agent actions, hosting websites on-chain with Warren, or integrating MegaNames (.mega naming service) for name registration, resolution, subdomains, subdomain marketplace (selling/buying subdomains with token gating), and text records.
description: End-to-end MegaETH development playbook (Feb 2026). Covers Foundry project setup with MegaETH-specific config, wallet operations, token swaps (Kyber Network), eth_sendRawTransactionSync (EIP-7966) for instant receipts, JSON-RPC batching, real-time mini-block subscriptions, storage-aware contract patterns (Solady RedBlackTreeLib, transient storage), MegaEVM multidimensional gas model, WebSocket keepalive, bridging from Ethereum, Privy headless signing for ultra-low latency, debugging with mega-evme, @moldy/mega-mpp-sdk for Machine Payments Protocol paid routes on MegaETH (`charge` and `session`), x402 Permit2 payments on MegaETH (standard flow via x402ExactPermit2Proxy/x402UptoPermit2Proxy at canonical addresses), legacy Meridian x402 payments, and Warren Protocol for on-chain website hosting. Use when building on MegaETH, using Foundry, managing wallets, sending transactions, deploying contracts, integrating Privy embedded wallets, integrating @moldy/mega-mpp-sdk, ERC-7710 delegation framework for scoped on-chain permissions, MetaMask Smart Accounts Kit for smart account creation and delegation management, integrating x402 Permit2 payments or Meridian/x402 paid APIs or agent actions, hosting websites on-chain with Warren, or integrating MegaNames (.mega naming service) for name registration, resolution, subdomains, subdomain marketplace (selling/buying subdomains with token gating), and text records.
---

# MegaETH Development Skill
Expand All @@ -23,6 +23,7 @@ Use this Skill when the user asks for:
- WebSocket subscriptions and mini-block streaming
- Bridging ETH from Ethereum to MegaETH
- Privy integration for headless/automated signing
- Machine Payments Protocol integrations with `@moldy/mega-mpp-sdk`
- x402 payments on MegaETH (Permit2 — preferred)
- Meridian / x402 legacy payments on MegaETH
- Ultra-low latency transaction patterns
Expand All @@ -32,6 +33,12 @@ Use this Skill when the user asks for:
- MegaNames (.mega naming service) — registration, resolution, subdomains, subdomain marketplace, text records
- Verifiable randomness with drand VRF (`DrandOracleQuicknet`) for lotteries, reveals, and game mechanics

## Payment routing

- Use [x402-payments.md](x402-payments.md) for raw Permit2 / x402 proxy integrations without the SDK.
- Use [meridian.md](meridian.md) when settlement goes through Meridian's facilitator and `/v1/settle` API.
- Use [mega-mpp-sdk.md](mega-mpp-sdk.md) when the user explicitly names `@moldy/mega-mpp-sdk`, wants Machine Payments Protocol paid routes, or needs reusable `session` payment channels.

## Chain Configuration

| Network | Chain ID | RPC | Explorer |
Expand Down Expand Up @@ -117,6 +124,7 @@ When implementing changes, provide:
- Wallet operations: [wallet-operations.md](wallet-operations.md)
- Frontend patterns: [frontend-patterns.md](frontend-patterns.md)
- Privy integration: [privy-integration.md](privy-integration.md)
- MPP SDK integrations: [mega-mpp-sdk.md](mega-mpp-sdk.md)
- x402 payments (Permit2): [x402-payments.md](x402-payments.md)
- Meridian payments (legacy): [meridian.md](meridian.md)
- RPC methods reference: [rpc-methods.md](rpc-methods.md)
Expand Down
69 changes: 69 additions & 0 deletions mega-mpp-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# `@moldy/mega-mpp-sdk`

Thin integration guide for a MegaETH Machine Payments Protocol SDK.

Use this file when the user:
- explicitly names `@moldy/mega-mpp-sdk`
- wants MPP-compatible paid routes on MegaETH
- needs reusable `session` payment channels, not just one-shot x402

Do not use this file for every paid API task:
- use [x402-payments.md](x402-payments.md) for raw Permit2 / x402 proxy integrations without this SDK
- use [meridian.md](meridian.md) when settlement goes through Meridian's facilitator and `/v1/settle`

This file covers the current `@moldy/mega-mpp-sdk` integration path. If the
MegaETH / MPP ecosystem later standardizes on a different recommended SDK,
update this routing.

## Public package entrypoints

Use only these imports:

```ts
import { Mppx, Store, megaeth } from "@moldy/mega-mpp-sdk/server";
import { Mppx as ClientMppx, megaeth as megaethClient } from "@moldy/mega-mpp-sdk/client";
import { megaethMainnet, megaethTestnet } from "@moldy/mega-mpp-sdk/chains";
```

Do not import internal files from the SDK repo.

## Choose the flow

- Default to `charge` for one payment per protected request.
- Use `session` only when the caller explicitly needs a reusable funded channel across many requests.
- For `charge`, keep `submissionMode` omitted unless the user needs `sync` or `sendAndWait`. Omitted means `realtime`.
- For server-broadcast `charge` and all `session` flows, keep the settlement wallet and `recipient` aligned.

## What must stay explicit

Always keep these values explicit:
- `chainId`
- `recipient`

Use published values instead of guessing:

| Network | Chain ID | RPC | Charge Token | Permit2 | Session Escrow |
| --- | --- | --- | --- | --- | --- |
| Mainnet | `4326` | `https://mainnet.megaeth.com/rpc` | USDm `0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7` | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | bring your own |
| Testnet | `6343` | `https://carrot.megaeth.com/rpc` | USDC `0x75139a9559c9cd1ad69b7e239c216151d2c81e6f` | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `0xD83A68408539868e5f48D0E93537f56afBB9d512` |
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update these to the new testnet deployments of USDm?


Do not invent a mainnet session escrow address. Mainnet `session` requires a deployed or user-provided escrow contract.

## Cloudflare Worker path

Cloudflare Workers are a first-class supported runtime for this SDK.

When the integration target already lives on Cloudflare:
- keep the payment backend inside the Worker boundary
- keep replay and session state in a shared store such as Durable Objects
- do not create a fresh in-memory store per request for live paid routes
- do not add a separate non-Cloudflare backend unless the user explicitly asks

## Canonical docs

Use the SDK repo as source of truth:
- Agent guide: <https://github.com/ifavo/mega-mpp-sdk/blob/main/docs/agent-integration.md>
- Charge docs: <https://github.com/ifavo/mega-mpp-sdk/blob/main/docs/methods/charge.md>
- Session docs: <https://github.com/ifavo/mega-mpp-sdk/blob/main/docs/methods/session.md>
- Worker demo guide: <https://github.com/ifavo/mega-mpp-sdk/blob/main/demo/README.md>
- Repository overview: <https://github.com/ifavo/mega-mpp-sdk/blob/main/README.md>