@viixixciv/chainid
v1.0.5
Published
An elegant CLI tool to retrieve a blockchain's chainId from any RPC endpoint (supports HTTP/S and WebSocket).
Downloads
4
Maintainers
Readme
RPC Chain ID Checker
A lightweight and elegant command-line tool to retrieve a blockchain's chainId from any RPC endpoint.
Features
- ✨ 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.
Installation
Local Usage
For quick, one-time use.
git clone https://github.com/viixixciv/chainid.git && cd chainid
npm install
npm startGlobal Installation (Recommended)
For easy access from anywhere in your terminal.
npm install -g @viixixciv/chainidUsage
This tool can be run in two modes:
Direct Mode (Recommended)
Pass the RPC URL directly as an argument for a quick, non-interactive result.
chainid <rpc-url>Examples:
chainid https://ethereum-rpc.publicnode.comInteractive Mode
Run the command without any arguments to enter the interactive prompt.
chainidThe tool will then ask you to enter the RPC URL.
Sample Outputs
Direct Mode
$ chainid ethereum-rpc.publicnode.com
⠋ Fetching Chain ID...
✅ Success! Chain ID: 1 (0x1)Interactive Mode
$ 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)License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
Like this tool? Consider supporting its development:
- EVM:
0xDeAd22Bd5024B8982c99Ecf0F961abD37969afca
