melonask/evm-balance-skills
Overview
This skill is a concise, hands-on guide for the EVM Balance project, covering the SDK, CLI, and development workflow. It explains how to fetch native and ERC20 balances across multiple EVM chains using Multicall3, generate addresses, and run the local test environment. Use it to get started quickly or integrate high-performance balance fetching into your tools.
How this skill works
The project exposes a core SDK for programmatic balance queries and a CLI for interactive or scriptable use. Both use Multicall3 encoding/decoding to batch requests across chains, support native and ERC20 token balances, and offer address generation modes (XPUB/BIP-44 and CREATE2/factory). The SDK accepts ranges of indices, token lists, and chain configs to return compact balance results.
When to use it
- Integrating fast, batched balance checks into a backend or analytics pipeline.
- Exploring balances across many addresses generated from an XPUB or factory contract.
- Running ad-hoc multi-chain balance audits from your terminal.
- Filtering large address sets by minimum balance before further processing.
- Developing or testing Multicall3-based logic locally with Solidity contracts.
Best practices
- Use Multicall3 and the SDK’s batch options to minimize RPC calls and reduce cost.
- Prefer index ranges and XPUB mode for deterministic address generation at scale.
- Filter by minimum balance client-side to avoid storing irrelevant results.
- Choose output format (json/csv/table) to match downstream tooling; use json for programmatic workflows.
- Run local tests with Anvil and deploy test contracts via forge for reproducible development.
Example use cases
- Generate 0–100 addresses from an XPUB and fetch native + USDC balances across mainnet and optimisim.
- Run a nightly job that queries balances for many addresses and writes JSON to storage for analytics.
- Quick CLI check to list addresses with >0.1 token balance before initiating token sweeps.
- Integrate the SDK into a dashboard backend to show aggregated token holdings per address range.
- Develop and validate Multicall3 contract interactions locally using Anvil and Forge deployment.
FAQ
XPUB (BIP-44 deterministic addresses) and factory/CREATE2-style generation are supported via the CLI and SDK.
How do I run tests locally?
Install bun and Foundry, start Anvil, deploy test contracts with forge script, then run bun test as documented in the workflow.