Guide
CLI
The chains command. Six subcommands and what each prints. Which ones exit 1.
Run it
pnpm add -g @agntn/chains
chains info matic
Polygon PoS (polygon)
symbol POL
decimals 18
type evm
bip44 60
chainId 0x89
caip2 eip155:137
explorer https://polygonscan.com
rpc https://polygon-bor-rpc.publicnode.com
| Command | Description |
|---|---|
chains info [chain] | Canonical metadata, Ethereum when no chain is given. --json for a machine |
chains resolve <input> | The canonical key for a name, symbol or alias, one line |
chains validate <chain> <address> | Check an address against one chain's format |
chains identify <address> | Which registered chains accept the address. --json for { matches, unchecked } |
chains list | Every registered chain, --type <family> to narrow, --json for a machine |
chains mcp | Run the MCP server over stdio |
Examples
chains list --type evm # every registered EVM chain
chains info matic # canonical metadata, add --json for a machine
chains resolve btc # bitcoin
chains validate eth 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984
chains identify 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 # which chains accept this format
chains list --json | jq -r '.[] | select(.type == "utxo") | .key'
chain is anything getChain accepts: matic, btc, Arbitrum One. Families for --type are the eleven type values: evm, utxo, solana, stellar, xrpl, move, ton, tron, octra, arweave, monero.
Exit codes
resolve, info and validate print a message and exit 1 when they fail: unknown chain, address that doesn't fit. list warns and exits 0 when a --type filter matches nothing, so don't use it as a check in a script. identify exits 0 even when nothing matches, because that's an answer too, and prints a warning line instead of a match list.
chains validate btc bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 && echo fits
chains validate btc bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5 || echo nope
An address the CLI rejects comes back quoted, so a newline or a terminal escape inside one can't forge a line under the error. validate passes the address through as typed, spaces included; the tools trim, the CLI doesn't.