crpc
Chain-aware RPC CLI — cast but better.
Auto ABI encode/decode, 2600+ chains via chainlist.org, Etherscan V2 integration with RPC fallback, built-in token registry, batch Multicall3, event logs with block range shortcuts, trace, bytecode inspection, and formatted output.
Install
Commands
| Command | Description |
|---|---|
call |
eth_call with auto ABI encode/decode |
balance |
ERC-20 token balance query |
allowance |
ERC-20 allowance check |
abi |
Fetch contract ABI from Etherscan (--raw for JSON) |
verify |
Batch verify contract addresses (code on-chain) |
pools |
Discover pools from factory contract events |
code |
Get contract bytecode size/existence |
slot |
Read contract storage slot |
block |
Get block info |
tx |
Transaction details + receipt + decoded logs |
logs |
Query and decode event logs |
trace |
Debug trace a transaction (requires archive node) |
multi |
Batch calls via Multicall3 |
diff |
Compare on-chain values across blocks |
gas |
Current gas prices (Etherscan + RPC fallback) |
history |
Transaction history (Etherscan + RPC fallback) |
transfers |
ERC-20 token transfer history |
chains |
List or search 2600+ chains from chainlist.org |
encode |
ABI-encode a function call (offline) |
decode |
ABI-decode hex data (offline) |
config |
Manage persistent configuration (set/get) |
Global flags
--rpc <URL> Override RPC URL (highest priority)
--provider <NAME> Select named provider from config
--json Output as JSON
Usage
crpc call — eth_call with auto decode
# [0] string = Wrapped Ether
# [0] uint8 = 18
# Negative int arg
# Raw hex output
# Historical query at specific block
crpc balance — ERC-20 balance
# Balance: 871000000000000000
# Human: 0.871 WETH
# Token address directly
crpc allowance — ERC-20 allowance check
# Token: USDC
# Owner: 0xOwner
# Spender: 0xSpender
# Allowance: unlimited (max uint256)
# With token address
crpc code — Contract bytecode check
# Address: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
# Type: Contract
# Size: 1852 bytes
# Code: 0x60806040...060c0033
# Type: EOA (no bytecode)
Useful for verifying if an address is a contract or EOA during DEX investigation.
crpc abi — Fetch contract ABI
# transfer(address,uint256) -> (bool)
# approve(address,uint256) -> (bool)
# event Transfer(address indexed,address indexed,uint256)
# ...
# Raw JSON ABI output
# [{ "type": "function", "name": "transfer", ... }]
# Also works with --json global flag
Requires ETHERSCAN_API_KEY (via env var or crpc config set).
crpc verify — Batch verify addresses
# Address Status Size
# 0xdAC17F958D2ee523a2206206994597C13D831ec7 CONTRACT 10.8 KB
# 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 EOA -
# [{"address":"0x...","is_contract":true,"code_size":11075}, ...]
crpc pools — Discover pools from factory events
# Uniswap V2 factory (default: PairCreated event)
# Pool Token0 Token1
# 0xDe05cb...b744 0xC02aaA...6Cc2 (WETH) 0xF385fc...049a
# Uniswap V3 factory with custom event
# JSON output
crpc slot — Storage slot read
# Slot 0: 0x577261707065642045746865720000000000000000000000000000000000001a
# As uint256: 3955331089...
crpc block — Block info
# Number: 43432032
# Hash: 0xe5a982...
# Timestamp: 1773653411
# Gas used: 51663520
# Transactions: 190
crpc tx — Transaction + receipt
# From: 0x...
# To: 0x...
# Value: 0
# Status: true
# Gas used: 21000
# Log count: 3
crpc logs — Query event logs
# Last 1000 blocks from a contract (no --from/--to needed)
# Filter and decode Transfer events
# Filter by raw topic0 hash (for unknown/custom events)
# Explicit block range
crpc trace — Debug trace a transaction
# CALL 0xFrom -> 0xTo value: 0
# STATICCALL 0xTo -> 0xContract1
# output: 0x... (32 bytes)
Requires an archive/debug node (Alchemy, QuickNode, etc).
crpc diff — Compare values across blocks
crpc gas — Gas price oracle
# Gas Prices (Gwei):
# Safe: 20
# Standard: 25
# Fast: 30
# Base fee: 18.5
# Works on L2s too — falls back to RPC when Etherscan unavailable
# Gas Price (via RPC):
# Gas price: 0.006 Gwei
# Priority: 0.001 Gwei
Uses Etherscan gas oracle when available, falls back to eth_gasPrice / eth_maxPriorityFeePerGas RPC calls on chains where Etherscan requires a paid plan (Base, Arbitrum, etc).
crpc history — Transaction history
# Works on L2s — falls back to recent block scanning via RPC
Uses Etherscan when available, falls back to scanning recent blocks via RPC.
crpc transfers — Token transfer history
# All ERC-20 transfers
# Filter by token contract
Requires ETHERSCAN_API_KEY.
crpc chains — Browse 2600+ chains
Any chain from chainlist.org works automatically — no config needed:
crpc encode / crpc decode — Offline ABI tools
# 0xa9059cbb000000000000000000000000...00000000000000000000000000000f4240
# Decode with function signature — typed output
# [0] address = 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
# [1] bool = true
# [2] int256 = 100
# [3] uint160 = 200
# Decode raw tuple
crpc multi — Batch calls via Multicall3
calls.json:
All calls execute in a single RPC request.
Chain Support
Built-in aliases
| Alias | Chain ID |
|---|---|
eth / ethereum |
1 |
base |
8453 |
arb / arbitrum |
42161 |
bsc |
56 |
polygon / matic |
137 |
op / optimism |
10 |
avax / avalanche |
43114 |
linea |
59144 |
scroll |
534352 |
zksync / zksync-era |
324 |
You can use chain IDs directly: crpc block 8453.
Beyond built-in chains, crpc supports 2600+ chains via chainlist.org. Run crpc chains to browse.
Built-in tokens
| Chain | Tokens |
|---|---|
| eth | WETH, USDC, USDT, DAI, WBTC |
| base | WETH, USDC, USDbC, cbETH |
| arb | WETH, USDC, USDC.e, USDT, WBTC, ARB |
Etherscan Integration
Commands abi, gas, history, and transfers use the Etherscan V2 API — a single unified endpoint supporting 60+ chains. On L2 chains where Etherscan requires a paid plan, gas and history automatically fall back to RPC methods.
# Option 1: persistent config (recommended)
# Option 2: environment variable
# free at etherscan.io/apis
JSON Output
All commands support --json for machine-readable output:
RPC Provider Selection
Resolution priority
--rpc <url>flag — use directlyCRPC_{CHAIN}_RPCenv var (e.g.CRPC_ETH_RPC=https://...)--provider <name>flag — named provider from configdefault_providerfrom config fileprioritylist — first provider whose env vars resolve- Chainlist.org public RPCs
- Built-in fallback RPCs
When a chain has multiple providers, crpc automatically tries the next on transport errors (timeout, connection refused). Contract-level errors (reverts) do not trigger fallback.
crpc config — Manage persistent configuration
# YOUR_KEY
Settings are stored in ~/.crpc.toml. Environment variables override config values.
Configuration
~/.crpc.toml:
= "alchemy"
[]
= 1
= ["alchemy", "llamarpc"]
[]
= "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
= "https://eth.llamarpc.com"
[]
= 8453
= ["alchemy", "base"]
[]
= "https://base-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
= "https://mainnet.base.org"
[]
= "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"
URLs support ${VAR_NAME} environment variable expansion. Providers with unresolvable variables are automatically skipped.
Function Signature Format
functionName(paramTypes)(returnTypes)
Examples: balanceOf(address)(uint256), name()(string), transfer(address,uint256)(bool)
Return types are optional — omit for raw hex word output.