synor/docs/PLAN/PHASE2-CLIWallet/01-Milestone-02-CLICommands.md
Gulshan Yadav 48949ebb3f Initial commit: Synor blockchain monorepo
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
2026-01-08 05:22:17 +05:30

4.7 KiB

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

  • synor wallet create - Generate new wallet
  • synor wallet recover - Recover from mnemonic
  • synor wallet info - Display wallet info
  • synor wallet addresses - List addresses
  • synor wallet new-address - Generate new address
  • synor wallet export - Export wallet backup
  • synor wallet import - Import wallet backup

Files:

  • apps/cli/src/commands/wallet.rs

Validation:

./target/release/synor wallet create
./target/release/synor wallet info
./target/release/synor wallet addresses

Task 2.2: Balance & Transaction Commands

  • synor balance - Query UTXO balance
  • synor send <address> <amount> - Send SYNOR
  • synor tx <hash> - View transaction details
  • synor mempool - View pending transactions
  • synor utxos - List UTXOs

Files:

  • apps/cli/src/commands/balance.rs
  • apps/cli/src/commands/send.rs
  • apps/cli/src/commands/tx.rs

Validation:

./target/release/synor balance
./target/release/synor send synor:qz... 1.0
./target/release/synor tx <hash>

Task 2.3: Block Commands

  • synor block <hash|height> - Fetch block
  • synor tips - Get current DAG tips
  • synor info - Chain information

Files:

  • apps/cli/src/commands/block.rs
  • apps/cli/src/commands/info.rs

Validation:

./target/release/synor block 0
./target/release/synor tips
./target/release/synor info

Task 2.4: Network Commands

  • synor peers - List connected peers
  • synor peer add <addr> - Add peer
  • synor peer ban <peer_id> - Ban peer

Files:

  • apps/cli/src/commands/peers.rs

Validation:

./target/release/synor peers

Task 2.5: Mining Commands

  • synor mining start - Start mining
  • synor mining stop - Stop mining
  • synor mining status - Mining status
  • synor mining set-address - Set coinbase address

Files:

  • apps/cli/src/commands/mining.rs

Validation:

./target/release/synor mining status

Task 2.6: Smart Contract Commands

  • synor contract deploy <wasm> - Deploy contract
  • synor contract call <id> <method> - Call contract
  • synor contract query <id> <method> - Query contract (read-only)

Files:

  • apps/cli/src/commands/contract.rs

Validation:

./target/release/synor contract deploy ./contract.wasm
./target/release/synor contract call <id> transfer --args '...'

Task 2.7: Governance Commands

  • synor gov propose - Create proposal
  • synor gov vote - Vote on proposal
  • synor gov list - List proposals
  • synor gov info - Governance info

Files:

  • apps/cli/src/commands/governance.rs

Validation:

./target/release/synor gov list
./target/release/synor gov info

Validation

Validation Commands

# 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)
./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