A complete blockchain implementation featuring: - synord: Full node with GHOSTDAG consensus - explorer-web: Modern React blockchain explorer with 3D DAG visualization - CLI wallet and tools - Smart contract SDK and example contracts (DEX, NFT, token) - WASM crypto library for browser/mobile
208 lines
4.7 KiB
Markdown
208 lines
4.7 KiB
Markdown
# Phase 2, Milestone 2: CLI Commands
|
|
|
|
> Complete CLI command implementation
|
|
|
|
**Status**: ✅ Complete
|
|
**Priority**: High
|
|
**Application**: `synor-cli`
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
Implement all 23 CLI commands for wallet management, transactions, block queries, and smart contract interaction.
|
|
|
|
---
|
|
|
|
## Tasks
|
|
|
|
### Task 2.1: Wallet Commands
|
|
- [x] `synor wallet create` - Generate new wallet
|
|
- [x] `synor wallet recover` - Recover from mnemonic
|
|
- [x] `synor wallet info` - Display wallet info
|
|
- [x] `synor wallet addresses` - List addresses
|
|
- [x] `synor wallet new-address` - Generate new address
|
|
- [x] `synor wallet export` - Export wallet backup
|
|
- [x] `synor wallet import` - Import wallet backup
|
|
|
|
**Files:**
|
|
- `apps/cli/src/commands/wallet.rs`
|
|
|
|
**Validation:**
|
|
```bash
|
|
./target/release/synor wallet create
|
|
./target/release/synor wallet info
|
|
./target/release/synor wallet addresses
|
|
```
|
|
|
|
### Task 2.2: Balance & Transaction Commands
|
|
- [x] `synor balance` - Query UTXO balance
|
|
- [x] `synor send <address> <amount>` - Send SYNOR
|
|
- [x] `synor tx <hash>` - View transaction details
|
|
- [x] `synor mempool` - View pending transactions
|
|
- [x] `synor utxos` - List UTXOs
|
|
|
|
**Files:**
|
|
- `apps/cli/src/commands/balance.rs`
|
|
- `apps/cli/src/commands/send.rs`
|
|
- `apps/cli/src/commands/tx.rs`
|
|
|
|
**Validation:**
|
|
```bash
|
|
./target/release/synor balance
|
|
./target/release/synor send synor:qz... 1.0
|
|
./target/release/synor tx <hash>
|
|
```
|
|
|
|
### Task 2.3: Block Commands
|
|
- [x] `synor block <hash|height>` - Fetch block
|
|
- [x] `synor tips` - Get current DAG tips
|
|
- [x] `synor info` - Chain information
|
|
|
|
**Files:**
|
|
- `apps/cli/src/commands/block.rs`
|
|
- `apps/cli/src/commands/info.rs`
|
|
|
|
**Validation:**
|
|
```bash
|
|
./target/release/synor block 0
|
|
./target/release/synor tips
|
|
./target/release/synor info
|
|
```
|
|
|
|
### Task 2.4: Network Commands
|
|
- [x] `synor peers` - List connected peers
|
|
- [x] `synor peer add <addr>` - Add peer
|
|
- [x] `synor peer ban <peer_id>` - Ban peer
|
|
|
|
**Files:**
|
|
- `apps/cli/src/commands/peers.rs`
|
|
|
|
**Validation:**
|
|
```bash
|
|
./target/release/synor peers
|
|
```
|
|
|
|
### Task 2.5: Mining Commands
|
|
- [x] `synor mining start` - Start mining
|
|
- [x] `synor mining stop` - Stop mining
|
|
- [x] `synor mining status` - Mining status
|
|
- [x] `synor mining set-address` - Set coinbase address
|
|
|
|
**Files:**
|
|
- `apps/cli/src/commands/mining.rs`
|
|
|
|
**Validation:**
|
|
```bash
|
|
./target/release/synor mining status
|
|
```
|
|
|
|
### Task 2.6: Smart Contract Commands
|
|
- [x] `synor contract deploy <wasm>` - Deploy contract
|
|
- [x] `synor contract call <id> <method>` - Call contract
|
|
- [x] `synor contract query <id> <method>` - Query contract (read-only)
|
|
|
|
**Files:**
|
|
- `apps/cli/src/commands/contract.rs`
|
|
|
|
**Validation:**
|
|
```bash
|
|
./target/release/synor contract deploy ./contract.wasm
|
|
./target/release/synor contract call <id> transfer --args '...'
|
|
```
|
|
|
|
### Task 2.7: Governance Commands
|
|
- [x] `synor gov propose` - Create proposal
|
|
- [x] `synor gov vote` - Vote on proposal
|
|
- [x] `synor gov list` - List proposals
|
|
- [x] `synor gov info` - Governance info
|
|
|
|
**Files:**
|
|
- `apps/cli/src/commands/governance.rs`
|
|
|
|
**Validation:**
|
|
```bash
|
|
./target/release/synor gov list
|
|
./target/release/synor gov info
|
|
```
|
|
|
|
---
|
|
|
|
## Validation
|
|
|
|
### Validation Commands
|
|
|
|
```bash
|
|
# List all commands
|
|
./target/release/synor --help
|
|
|
|
# Test each command category
|
|
./target/release/synor wallet --help
|
|
./target/release/synor mining --help
|
|
./target/release/synor contract --help
|
|
./target/release/synor gov --help
|
|
|
|
# Run CLI tests
|
|
cargo test -p synor-cli
|
|
```
|
|
|
|
### Validation Agents
|
|
|
|
| Agent | Purpose |
|
|
|-------|---------|
|
|
| `code-reviewer` | Review command implementations |
|
|
| `Explore` | Verify all commands exist |
|
|
|
|
### Command Matrix
|
|
|
|
| Command | Args | Output | RPC Method |
|
|
|---------|------|--------|------------|
|
|
| `balance` | - | Amount | `synor_getBalance` |
|
|
| `send` | addr, amt | TxHash | `synor_submitTransaction` |
|
|
| `block` | hash/height | Block | `synor_getBlock` |
|
|
| `tips` | - | Hash[] | `synor_getTips` |
|
|
| `info` | - | NodeInfo | `synor_getInfo` |
|
|
| `peers` | - | Peer[] | `synor_getPeerInfo` |
|
|
| `mempool` | - | Tx[] | `synor_getMempool` |
|
|
|
|
### Security Checks
|
|
|
|
- [ ] Sensitive data (keys, mnemonic) not logged
|
|
- [ ] Password input hidden
|
|
- [ ] RPC connection uses timeout
|
|
- [ ] Invalid addresses rejected early
|
|
- [ ] Amount overflow checked
|
|
|
|
### UX Validation
|
|
|
|
- [ ] Help text for all commands
|
|
- [ ] Error messages are helpful
|
|
- [ ] Progress indicators for long operations
|
|
- [ ] Confirmation prompts for destructive actions
|
|
|
|
---
|
|
|
|
## Output Formats
|
|
|
|
All commands support:
|
|
- Human-readable (default)
|
|
- JSON (`--format json`)
|
|
- Compact (`--format compact`)
|
|
|
|
```bash
|
|
./target/release/synor balance --format json
|
|
```
|
|
|
|
---
|
|
|
|
## Acceptance Criteria
|
|
|
|
1. All 23 commands implemented
|
|
2. Help text for every command
|
|
3. JSON output format supported
|
|
4. Error handling complete
|
|
5. All commands tested
|
|
|
|
---
|
|
|
|
*Completed: January 2025*
|