johnalbertini14-glitch/openclaw-skills / skills/0xbreadguy/megaeth-ai-developer-skills
megaeth-developer
VerifiedEnd-to-end MegaETH development playbook (Feb 2026). Covers 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), MegaEVM gas model, WebSocket keepalive, bridging from Ethereum, and debugging with mega-evme. Use when building on MegaETH, managing wallets, sending transactions, or deploying contracts.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.5 KB |
| _meta.json | config | 300 B |
| frontend-patterns.md | markdown | 6.4 KB |
| gas-model.md | markdown | 3.6 KB |
| resources.md | markdown | 5.4 KB |
| rpc-methods.md | markdown | 9.0 KB |
| security.md | markdown | 4.5 KB |
| smart-contracts.md | markdown | 10.3 KB |
| storage-optimization.md | markdown | 3.4 KB |
| testing.md | markdown | 3.8 KB |
| wallet-operations.md | markdown | 7.6 KB |
testing.md
View on GitHub# Debugging Guide
## mega-evme CLI
The official debugging tool for MegaETH transactions.
### Installation
```bash
git clone https://github.com/megaeth-labs/mega-evm
cd mega-evm/bin/mega-evme
cargo build --release
```
### Replay Transactions
```bash
# Basic replay
mega-evme replay <txhash> --rpc https://mainnet.megaeth.com/rpc
# With execution trace
mega-evme replay <txhash> --trace --trace.output trace.json --rpc <endpoint>
# With call tracer
mega-evme replay <txhash> --trace --tracer call --trace.output calls.json
```
**Docs:** https://github.com/megaeth-labs/mega-evm/tree/main/bin/mega-evme
## Gas Profiling
### Opcode-Level Analysis
```bash
# 1. Get debug trace
cast run <txhash> --rpc-url <vip-endpoint> > trace.json
# 2. Profile opcodes
python scripts/trace_opcode_gas.py trace.json
```
**Script:** https://github.com/megaeth-labs/mega-evm/blob/main/scripts/trace_opcode_gas.py
### Example Output
```
op count total avg min max
SSTORE 29 85400 2944.8 100 22100
SLOAD 473 121300 256.4 100 2100
LOG2 25 598601 23944.0 14257 25521
KECCAK256 288 12108 42.0 36 60
```
## Common Issues
### "Intrinsic Gas Too Low"
Local gas estimation uses standard EVM costs. MegaEVM differs.
**Fix:**
```bash
# Foundry: skip local simulation
forge script Deploy.s.sol --gas-limit 5000000 --skip-simulation
# Or use higher hardcoded limit
```
### "Nonce Too Low"
With `eth_sendRawTransactionSync`, this can mean:
1. Tx already executed (check receipt)
2. Race condition with pending tx
**Debug:**
```bash
# Check current nonce
cast call --rpc-url <endpoint> \
--method eth_getTransactionCount \
<address> pending
```
### "Block Pruned" on eth_call
Public endpoint only keeps ~15 days of state.
**Solutions:**
- Use Alchemy/QuickNode for historical calls
- Run archive node
- Use VIP endpoint with longer retention
### WebSocket Disconnections
Connection drops after idle period.
**Fix:** Send keepalive every 30s:
```javascript
setInterval(() => {
ws.send(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_chainId',
params: [],
id: Date.now()
}));
}, 30000);
```
### Volatile Data Access Limit
Error after using `block.timestamp` + heavy computation.
**Cause:** 20M gas limit after accessing block metadata.
**Fix:** Restructure contract to access metadata late, or use oracle.
## Cast Commands
```bash
# Estimate gas
cast estimate --from <addr> --to <addr> --value 0.001ether \
--rpc-url https://mainnet.megaeth.com/rpc
# Call at specific block
cast call --block <number> <contract> "method(args)" \
--rpc-url https://mainnet.megaeth.com/rpc
# Get transaction details
cast tx <txhash> --rpc-url https://mainnet.megaeth.com/rpc
# Decode calldata
cast 4byte-decode <calldata>
```
## HAR Analysis
For debugging frontend RPC patterns:
```bash
# Export HAR from browser devtools, then:
python parse_eth_rpc_har.py export.har > calls.csv
python method_activity_timeline.py calls.csv
```
Identifies:
- Unnecessary RPC calls
- Batching opportunities
- Slow methods blocking UX
## Monitoring Latency
```bash
# Detailed timing breakdown
curl -i -X POST https://mainnet.megaeth.com/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' \
-w "dns: %{time_namelookup} | connect: %{time_connect} | total: %{time_total}\n"
```
## Block Explorers
| Network | Explorer |
|---------|----------|
| Mainnet | https://mega.etherscan.io |
| Testnet | https://megaeth-testnet-v2.blockscout.com |
Etherscan may lag a few blocks behind real-time.
## Getting Help
1. Check transaction on explorer
2. Replay with mega-evme locally
3. Profile gas by opcode
4. Contact MegaETH team with:
- Transaction hash
- Error message
- Reproduction steps
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |