A command-line tool for interacting with ERC20 tokens on multiple blockchain networks.
- Query ERC20 token information (name, symbol, decimals, total supply)
- Check token balances for any address
- Support for multiple chains: Ethereum, Polygon, BSC, Arbitrum, Optimism, and Base
- Simple and intuitive CLI interface
go build -o erc20-cli .Use the included build script to create binaries for multiple platforms:
./build.sh 1.0.0This will create binaries in the build/ directory for:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
Download the appropriate binary for your platform from the Releases page.
Note: The binary you build will only work on the same operating system and architecture it was built for. For example:
- A Linux binary won't work on macOS or Windows
- A 64-bit binary won't work on 32-bit systems
- An ARM binary won't work on x86 systems
To share the binary with others, either:
- Build it for their specific platform
- Share the source code and let them build it
- Use the build script to create binaries for all platforms
balance <address>- Get token balance for an addressinfo- Get all token information (name, symbol, decimals, total supply)name- Get token namesymbol- Get token symboldecimals- Get token decimalstotal-supply- Get total token supplyhelp- Show help message
-chain-id <id>- Chain ID (required)1= Ethereum137= Polygon56= BSC (Binance Smart Chain)42161= Arbitrum10= Optimism8453= Base
-token <address>- Token contract address (required)
Get token balance:
./erc20-cli balance 0x1234567890123456789012345678901234567890 \
-chain-id 1 \
-token 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48Get all token information:
./erc20-cli info \
-chain-id 137 \
-token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174Get token name:
./erc20-cli name -chain-id 1 -token 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48erc20-cli/
├── main.go # CLI interface
├── internal/
│ ├── rpc/
│ │ └── client.go # RPC client for Ethereum calls
│ └── erc20/
│ └── token.go # ERC20 token functions
└── go.mod # Go module dependencies
- The CLI uses Ethereum RPC calls (
eth_call) to interact with ERC20 token contracts - Function signatures are encoded using Keccak256 hashing (first 4 bytes)
- Parameters are ABI-encoded and appended to the function selector
- Responses are decoded from hex format to human-readable values
The tool uses public RPC endpoints from publicnode.com:
- Ethereum Mainnet
- Polygon
- Binance Smart Chain
- Arbitrum
- Optimism
- Base
MIT