Skip to content
Star

Local lab

View as MarkdownOpen in ClaudeOpen in ChatGPT

The repository ships an example agent built with the Vercel AI SDK. It pays a vendor, then tries a withdrawal that reverts, and both transactions show up in its trace. It runs against a local Anvil chain and a scripted model, so it needs no API key.

You need Node.js 22.18 or later, pnpm and Docker. With nvm, nvm install reads the repository’s .nvmrc (Node.js 24), installs it if needed and switches to it. The packages themselves only need Node.js 22.3; the higher version is for the repository’s build tools.

Terminal window
git clone https://github.com/selimaytac/hashspan && cd hashspan
nvm install && corepack enable pnpm && pnpm install
make lab-up # Jaeger UI on http://localhost:16686, OTLP on :4317/:4318
make demo # runs the agent against a fresh local chain

For the metrics, make lab-metrics also starts Prometheus and Grafana with a dashboard for the send, confirmation and fee histograms, on http://localhost:3000; run make demo after it. The backends page explains the dashboard and how to use it elsewhere.

Open Jaeger, pick the treasury-agent service and expand withdraw_from_vault. The second confirm 31337 span is marked as an error and carries blockchain.tx.revert.reason. This post walks through the same trace, span by span.

The same agent also runs on Base Sepolia with a test account of your own: make demo-base-sepolia. Its spans are named send 84532 and confirm 84532, and each transaction gets a Basescan link. How to set up and fund the account, and keep its key out of the repository, is in the example’s README.

This is one run of make demo-base-sepolia with hashspan 0.8.0, on 2026-10-02. The values come from the confirm spans and match the receipts on chain:

Transaction Status Gas used Execution fee L1 data fee Total fee (blockchain.tx.fee)
Payment success 21,000 126,000,000,000 wei 7,351,065,046 wei 133,351,065,046 wei
Withdrawal reverted 21,630 129,780,000,000 wei 7,351,065,046 wei 137,131,065,046 wei

The withdrawal’s confirm span carries blockchain.tx.revert.reason WithdrawalLimitExceeded(10000000000000, 20000000000000). On the local chain there is no L1 data fee; on Base Sepolia it is about 5.5% of the payment’s total fee. Every setup run so far is listed on Tested setups.

Terminal window
make lab-pause # stop, keep state
make lab-nuke # remove containers, images, tools and build output

The example’s code is in examples/ai-sdk-agent.