foundry-cast

A read-only command-line tool for inspecting blockchain data and smart contracts. It can read contract state, decode transaction data, query logs, and prepare call data without using private keys or sending transactions.

In plain words
What is it for?
Use it to inspect deployed contracts, read balances and storage, decode transactions and errors, look up function or event signatures, resolve ENS names, and simulate read-only calls.
Why use it?
It removes the need to write scripts or run a separate service for common blockchain lookups. It also lowers the risk of changing the blockchain while investigating it.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/hirama/solidity-agentic-stack/foundry-cast
Any agent
npx skills add Hirama/solidity-agentic-stack --skill foundry-cast
Clone the repo
git clone --depth 1 https://github.com/Hirama/solidity-agentic-stack

Made for: Claude Code, Codex.

Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,759 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00075 $0.01759
Opus 5 $0.00037 $0.00879
Sonnet 5 $0.00015 $0.00352
Haiku 4.5 $0.00007 $0.00176

Measured 3d ago against content hash 1acd90940bf5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

foundry-cast scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/foundry-cast/SKILL.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cast — Foundry's Chain CLI

cast is the read-side counterpart to forge. Every chain operation an agent might want from an MCP server is already a cast subcommand. No server, no daemon, no shebang bugs — just the binary that ships with Foundry.

Full reference: https://getfoundry.sh/cast

When to use this skill

  • Inspecting a deployed contract (bytecode, storage, ABI)
  • Decoding a transaction's calldata or revert reason
  • Looking up a 4-byte selector or event signature
  • Fetching balance, nonce, code at an address
  • Reading state via eth_call without writing a Forge test
  • Resolving ENS names
  • Encoding calldata for a script

Setup

cast needs an RPC. Either pass --rpc-url per command or set ETH_RPC_URL:

export ETH_RPC_URL=https://eth.blockscout.com/api/eth-rpc   # free, no key
# or
export ETH_RPC_URL=$RPC_MAINNET                              # from .env

Blockscout's public RPC is the simplest no-key fallback for read-only ops.

Read-only cheat sheet

Account state

cast balance vitalik.eth                                 # ETH balance (wei)
cast balance vitalik.eth --ether                         # in ETH
cast nonce 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045    # tx count
cast code 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48     # runtime bytecode
cast codesize 0xa0b8...eb48
cast storage 0xa0b8...eb48 0                             # slot 0
cast proof 0xa0b8...eb48 0                               # merkle proof for slot

Block / chain

cast block-number
cast block latest
cast gas-price
cast chain-id
cast base-fee
cast age <block>                                         # human time
cast find-block <timestamp>                              # block at unix time

Transactions

cast tx <hash>                                           # tx envelope
cast receipt <hash>                                      # receipt + logs
cast run <hash>                                          # re-execute & trace
cast trace <hash>                                        # full call trace
cast decode-transaction <raw-hex>
cast 4byte-calldata 0xa9059cbb...                        # match selector → sig

Read the full file on GitHub · 196 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 196 lines · 75 tokens per session scan A 1acd90940bf5

Subscribe to this mod's changes

foundry-cast is a skill published in the GitHub repository Hirama/solidity-agentic-stack (5 stars, last pushed 2mo ago), licensed MIT. It adds 75 tokens to every session and 1,759 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.