A lightweight and elegant command-line tool to retrieve a blockchain's chainId from any RPC endpoint.
- ✨ Elegant Interface: A clean, minimal UI with an interactive loading spinner.
- ⚡ Dual Mode: Run with a URL argument for instant results (Direct Mode), or without for an interactive prompt (Interactive Mode).
- ✔ Dual-Protocol Support: Seamlessly works with
http://,https://,ws://, andwss://endpoints. - 🚀 Smart Defaults: Automatically prefixes URLs with
https://if no protocol is specified. - 🔄 Automatic Fallback: If an
https://connection fails, it automatically retries withhttp://. - ⏱️ Timeout Protection: Includes a 5-second timeout to prevent indefinite hanging.
- ⚙️ Zero-Configuration: No setup or API keys needed.
For quick, one-time use.
git clone https://github.com/viixixciv/chainid.git && cd chainid
npm install
npm startFor easy access from anywhere in your terminal.
npm install -g @viixixciv/chainidThis tool can be run in two modes:
Pass the RPC URL directly as an argument for a quick, non-interactive result.
chainid <rpc-url>chainid https://ethereum-rpc.publicnode.comRun the command without any arguments to enter the interactive prompt.
chainidThe tool will then ask you to enter the RPC URL.
$ chainid ethereum-rpc.publicnode.com
⠋ Fetching Chain ID...
✅ Success! Chain ID: 1 (0x1)$ chainid
🔗 RPC Chain ID Checker
========================
Enter an RPC URL or run with an argument:
e.g., chainid https://ethereum-rpc.publicnode.com
🌐 RPC URL: https://ethereum-rpc.publicnode.com
⠋ Fetching Chain ID...
✅ Success! Chain ID: 1 (0x1)This project is licensed under the MIT License. See the LICENSE file for details.
Like this tool? Consider supporting its development:
- EVM:
0xDeAd22Bd5024B8982c99Ecf0F961abD37969afca