The Polkadot CLI Tool is a command-line interface designed to streamline the development process for Polkadot and Substrate-based projects. It provides developers with essential commands to set up their environment, create new projects, run local nodes, query the chain state, monitor for suspicious activities, and install development templates.
- Setup: Quickly set up your development environment with all necessary dependencies
- Create New Projects: Scaffold new Polkadot projects (runtimes, parachains, or dApps)
- Node Management: Build and run a local Polkadot node for development
- Chain Interaction: Query blockchain data and monitor network activity
- Security Monitoring: Advanced monitoring for suspicious activities and potential threats
- Development Tools: Comprehensive utilities for Polkadot/Substrate development
Ensure the following dependencies are installed on your system:
- Node.js (v16 or higher)
- Git
- Rust with
rustup(will be installed by setup if not present) - Cargo (Rust's package manager)
-
Clone this repository:
git clone https://github.com/CoachCoe/polkadot-cli-tool.git
-
Navigate to the project directory:
cd polkadot-cli-tool -
Install dependencies:
npm install
-
Link the CLI globally:
npm link
Set up your development environment:
polkadot-cli setupThis command will:
- Install Rust and required toolchains if not present
- Configure Rust for Substrate development
- Install necessary system dependencies
Create a new project:
polkadot-cli new <type>Replace <type> with:
runtime: Create a new runtime moduleparachain: Create a new parachain projectdApp: Create a new decentralized application
-
Install and build a Polkadot node:
polkadot-cli install-node-template
-
Run the local node:
polkadot-cli run
The node will be accessible at:
- RPC: http://127.0.0.1:9933
- WebSocket: ws://127.0.0.1:9933
Query the blockchain state:
polkadot-cli queryMonitor the chain for suspicious activities:
polkadot-cli monitorThis includes monitoring for:
- Suspicious transactions
- Contract vulnerabilities
- Governance attacks
- Cross-chain security issues
polkadot-cli-tool/
├── bin/
│ └── dot-cli.js # CLI entry point
├── src/
│ ├── commands/ # CLI command implementations
│ │ ├── monitor.js
│ │ ├── new.js
│ │ ├── run.js
│ │ ├── query.js
│ │ ├── setup.js
│ │ └── installNodeTemplate.js
│ ├── monitoring/ # Security monitoring modules
│ │ ├── baseMonitor.js
│ │ ├── contractMonitor.js
│ │ ├── accountMonitor.js
│ │ ├── crossChainMonitor.js
│ │ ├── governanceMonitor.js
│ │ └── types.js
│ └── utils/ # Shared utilities
│ ├── config.js
│ ├── helpers.js
│ ├── logger.js
│ └── connectionManager.js
- If
setupfails, ensure you have proper system permissions - For node build issues, ensure you have sufficient disk space (10GB+ recommended)
- For runtime errors, check the logs in the chain-data directory
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request with a detailed description
This project is licensed under the MIT License. See the LICENSE file for details.