Skip to main content
The NEXUS CLI provides a comprehensive command-line interface for interacting with the NEXUS protocol.

Installation

# From source
cargo install --path crates/cli

# Or build locally
cargo build --release -p nexus-cli

Global Options

nexus [OPTIONS] <COMMAND>

Options:
  --network <NETWORK>    Network to connect to [default: regtest]
  --rpc <RPC>            Primary RPC endpoint [default: http://localhost:8545]
  --rpc-fallback <URLS>  Fallback RPC endpoints (comma-separated)
  -v, --verbose          Verbose output
  -h, --help             Print help
  -V, --version          Print version

Commands

Quick Examples

Create a Wallet

nexus wallet new my-wallet

Deploy a Contract

nexus contract deploy \
  --wasm ./target/wasm32-unknown-unknown/release/my_contract.wasm \
  --name my_contract \
  --from my-wallet

Call a Contract

# View call (read-only)
nexus contract call \
  --contract <CONTRACT_ID> \
  --function get_balance \
  --args "0x1234..." \
  --from my-wallet

# State-changing call
nexus contract call \
  --contract <CONTRACT_ID> \
  --function transfer \
  --args "0x1234...,1000" \
  --from my-wallet \
  --commit

Query Block Height

nexus query height

Validate Contract

nexus dev validate ./my_contract.wasm

Configuration

Wallets are stored in ~/.nexus/wallets/ as JSON files:
{
  "name": "my-wallet",
  "secret_key": "...",
  "public_key": "...",
  "address": "bcrt1p..."
}
Keep your wallet files secure! The secret key provides full access to your funds.

Network Selection

# Regtest (local development)
nexus --network regtest query height

# Testnet
nexus --network testnet query height

# Mainnet
nexus --network mainnet query height

Output Formatting

The CLI supports multiple output formats for contract call results:
# Auto-detect format
nexus contract call --contract ... --function get_name --from wallet

# Force specific format
nexus contract call --contract ... --function get_balance --from wallet --format u64
nexus contract call --contract ... --function get_owner --from wallet --format address
nexus contract call --contract ... --function get_data --from wallet --format hex
nexus contract call --contract ... --function get_name --from wallet --format utf8

Next Steps