Using the CLI
The ashen CLI provides tools for interacting with the Ashen chain, managing contracts, and automating workflows.
Quick Start
Section titled “Quick Start”# Check chain statusashen status
# Query an accountashen account --address 0x1234...
# Call a contract method (read-only)ashen view 0xCONTRACT balanceOf '["0xUSER"]'
# Execute a transactionashen call 0xCONTRACT transfer '["0xTO", 100]' --key $KEY --waitEnvironment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
NODE_RPC_URL | RPC endpoint (default: http://127.0.0.1:3030) |
NODE_AUTH_TOKEN | Optional authentication token |
ASHEN_PRIVATE_KEY | Private key for signing transactions |
Core Commands
Section titled “Core Commands”ashen status
Section titled “ashen status”Get chain status including tip height, epoch, and finalized block.
ashen statusashen status --rpc-url http://custom:3030ashen account
Section titled “ashen account”Query account information including balance and nonce lanes.
ashen account --address 0x1234...ashen view
Section titled “ashen view”Execute a read-only contract call (no transaction, no gas cost).
# Basic view callashen view 0xCONTRACT methodName '["arg1", "arg2"]'
# With explicit IDL pathashen view 0xCONTRACT balanceOf '["0xUSER"]' --idl ./token.idl
# Multi-interface contractashen view 0xCONTRACT totalSupply --interface IERC20IDLs are auto-fetched from the chain and cached for 1 hour. Use --idl to override.
ashen call
Section titled “ashen call”Execute a state-changing transaction.
# Basic call (simulates only)ashen call 0xCONTRACT transfer '["0xTO", 100]' --key $KEY
# Submit and wait for inclusionashen call 0xCONTRACT transfer '["0xTO", 100]' --key $KEY --wait
# Custom gas/feeashen call 0xCONTRACT mint '["0xTO", 1000]' --key $KEY \ --gas-limit 500000 --max-fee 2000000 --waitashen abi
Section titled “ashen abi”Display a contract’s IDL/ABI.
# Pretty-printedashen abi 0xCONTRACT
# Raw IDL textashen abi 0xCONTRACT --rawContract Commands
Section titled “Contract Commands”ashen contract inspect
Section titled “ashen contract inspect”Inspect a local IDL file without connecting to the chain.
ashen contract inspect --idl ./mycontract.idlashen contract view
Section titled “ashen contract view”Detailed view call with more options.
ashen contract view \ --contract 0x1234... \ --method balanceOf \ --args '["0xUSER"]' \ --idl ./token.idl \ --origin 0xCALLERashen contract call
Section titled “ashen contract call”Detailed call with simulation and submission options.
# Simulate only (default)ashen contract call \ --contract 0x1234... \ --method transfer \ --args '["0xTO", 100]' \ --key $KEY
# Simulate and submitashen contract call ... --wait
# Force submit even on simulation failureashen contract call ... --force --waitTransaction Commands
Section titled “Transaction Commands”ashen tx by-hash
Section titled “ashen tx by-hash”Query a transaction by its hash.
# Get statusashen tx by-hash --tx-hash 0xABCD...
# Wait for inclusionashen tx by-hash --tx-hash 0xABCD... --wait --wait-timeout-s 120IDL Commands
Section titled “IDL Commands”ashen idl fetch
Section titled “ashen idl fetch”Fetch a contract’s IDL from the chain.
ashen idl fetch --contract 0x1234...ashen idl fetch --contract 0x1234... --output ./contract.idlashen idl generate
Section titled “ashen idl generate”Generate a manifest from a local IDL file (selectors, methods, types).
ashen idl generate --idl ./mycontract.idlashen idl generate --idl ./mycontract.idl --output ./manifest.jsonashen idl validate
Section titled “ashen idl validate”Validate IDL syntax and semantics.
ashen idl validate ./mycontract.idlashen idl diff
Section titled “ashen idl diff”Compare two IDL versions and report breaking changes.
ashen idl diff old.idl new.idlashen idl diff old.idl new.idl --jsonashen idl codegen
Section titled “ashen idl codegen”Generate client code from an IDL file.
# TypeScriptashen idl codegen ./token.idl --lang ts --output-dir ./generated
# Rustashen idl codegen ./token.idl --lang rust --output-dir ./generatedSupported languages: ts/typescript, rust, go, c
Keystore Commands
Section titled “Keystore Commands”ashen keystore init
Section titled “ashen keystore init”Initialize a new keystore.
ashen keystore initashen keystore init --path ~/.ashen/keystore.jsonashen keystore list
Section titled “ashen keystore list”List keys in the keystore.
ashen keystore listashen keystore add
Section titled “ashen keystore add”Add a new key.
# Generate new keyashen keystore add --label my-key
# Import existingashen keystore add --label imported --secret 0x...ashen keystore export
Section titled “ashen keystore export”Export a key’s public address.
ashen keystore export --label my-keyInteractive TUI
Section titled “Interactive TUI”Launch the interactive terminal UI for visual exploration.
# Launch TUIashen
# Or explicitlyashen tuiThe TUI provides:
- Block Explorer — Browse blocks and transactions
- Account Viewer — Check balances and nonces
- Contract Caller — Execute view and call operations
- Transaction History — Track your submitted transactions
- Favorites — Quick access to frequently used contract methods
- RPC Explorer — Dynamic RPC method discovery
TUI Screens
Section titled “TUI Screens”| Screen | Key | Description |
|---|---|---|
| Home | h | Main menu |
| Block Explorer | b | Browse recent blocks |
| Account Viewer | a | Check account details |
| Contracts | c | Manage contract addresses |
| IDLs | i | Manage IDL files |
| Favorites | f | Quick access methods |
| Transaction History | t | Your submitted txs |
| Settings | s | Configure RPC, keys |
| Help | ? | Keyboard shortcuts |
TUI Configuration
Section titled “TUI Configuration”Configuration is stored in ~/.config/ashen/config.toml:
rpc_url = "http://127.0.0.1:3030"auth_token = ""default_key = ""block_buffer_limit = 100tx_history_limit = 64
[idls]sft = { path = "/path/to/sft.idl" }amm = { path = "/path/to/amm.idl", namespace = "v1" }
[contracts]token = "0x1234..."pool = "0x5678..."Robot Mode (Agent Automation)
Section titled “Robot Mode (Agent Automation)”The ashen tui subcommand provides headless commands with JSON output, designed for AI agents and automation.
How Robot Mode Works
Section titled “How Robot Mode Works”- All
ashen tuicommands output JSON when:--jsonflag is provided, OR- stdout is not a TTY (piped or redirected)
- Human-readable output when run interactively without
--json
JSON Response Schema
Section titled “JSON Response Schema”Success:
{ "ok": true, "data": { ... }, "warnings": ["optional warning messages"]}Error:
{ "ok": false, "code": "invalid_args", "message": "Description of what went wrong", "suggestions": ["possible fix 1", "possible fix 2"]}Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | Success |
1 | Not found |
2 | Invalid arguments |
3 | Authentication error |
4 | Conflict |
5 | Internal error |
Robot Mode Commands
Section titled “Robot Mode Commands”Chain Status
Section titled “Chain Status”# Get chain statusashen tui status --json# Returns: tip_height, tip_hash, epoch, finalized_height, chain_id
# Get account infoashen tui account 0x1234... --json# Returns: address, balance, nonce_lanes, has_codeContract Interaction
Section titled “Contract Interaction”# View call (read-only)ashen tui view --contract 0x... --method balanceOf --args '["0xUSER"]' --json
# Call with simulation onlyashen tui call --contract 0x... --method transfer \ --args '["0xTO", 100]' --key $KEY --json
# Submit transactionashen tui call --contract 0x... --method transfer \ --args '["0xTO", 100]' --key $KEY --submit --json
# Submit and wait for inclusionashen tui call --contract 0x... --method transfer \ --args '["0xTO", 100]' --key $KEY --submit --wait --jsonTransaction Operations
Section titled “Transaction Operations”# Get transaction detailsashen tui tx details 0xHASH... --json
# Wait for tx inclusionashen tui tx wait 0xHASH... --timeout 120 --json
# List transactions (with filters)ashen tui tx list --limit 50 --jsonashen tui tx list --sender 0x... --jsonashen tui tx list --contract 0x... --before 1000 --json
# Local tx historyashen tui tx history --limit 20 --jsonBlock Operations
Section titled “Block Operations”# List recent blocksashen tui blocks list --limit 20 --jsonashen tui blocks list --before 1000 --limit 50 --json
# Get block detailsashen tui blocks get 100 --jsonMempool
Section titled “Mempool”# List pending transactionsashen tui mempool --limit 50 --jsonConfiguration Management
Section titled “Configuration Management”# Get/set config valuesashen tui config get rpc-url --jsonashen tui config set rpc-url http://node:3030 --json
# Manage IDLsashen tui config idls list --jsonashen tui config idls add --name sft --path ./sft.idl --jsonashen tui config idls remove sft --json
# Manage contractsashen tui config contracts list --jsonashen tui config contracts add --name token --address 0x... --jsonashen tui config contracts remove token --json
# Manage favoritesashen tui config favorites list --jsonashen tui config favorites add --contract 0x... --idl sft --method mint --jsonashen tui config favorites remove 0 --jsonContract Methods Discovery
Section titled “Contract Methods Discovery”# List contract methodsashen tui contract methods --contract 0x... --jsonashen tui contract methods --contract 0x... --idl ./custom.idl --jsonDynamic RPC
Section titled “Dynamic RPC”# List all RPC methodsashen tui rpc methods --json
# Get method signatureashen tui rpc method chain_status --json
# Execute RPC callashen tui rpc call chain_status --jsonashen tui rpc call account '{"address": "0x..."}' --jsonAgent Workflow Example
Section titled “Agent Workflow Example”#!/bin/bash# Agent workflow: check balance, transfer, wait for confirmation
# 1. Check balanceBALANCE=$(ashen tui account 0xFROM... --json | jq -r '.data.balance')echo "Current balance: $BALANCE"
# 2. Check if sufficientif [ "$BALANCE" -lt 1000 ]; then echo "Insufficient balance" exit 1fi
# 3. Execute transfer and waitRESULT=$(ashen tui call \ --contract 0xTOKEN... \ --method transfer \ --args '["0xTO...", 100]' \ --key "$ASHEN_PRIVATE_KEY" \ --submit --wait --json)
# 4. Check resultif echo "$RESULT" | jq -e '.ok' > /dev/null; then TX_HASH=$(echo "$RESULT" | jq -r '.data.tx_hash') echo "Transfer successful: $TX_HASH"else ERROR=$(echo "$RESULT" | jq -r '.message') echo "Transfer failed: $ERROR" exit 1fiDebug Commands
Section titled “Debug Commands”ashen debug trace
Section titled “ashen debug trace”Trace a transaction’s execution.
ashen debug trace --tx-hash 0x...ashen debug replay
Section titled “ashen debug replay”Replay a transaction with debugging.
ashen debug replay --tx-hash 0x... --breakpoint pc:0x1000Backup Commands
Section titled “Backup Commands”ashen backup export
Section titled “ashen backup export”Export a chain snapshot.
ashen backup export --data-dir ./node-data --output ./snapshot.tarashen backup import
Section titled “ashen backup import”Import a chain snapshot.
ashen backup import --data-dir ./node-data --input ./snapshot.tarBLS Commands (Validators)
Section titled “BLS Commands (Validators)”ashen bls keygen
Section titled “ashen bls keygen”Generate a BLS keypair.
ashen bls keygenashen bls verify
Section titled “ashen bls verify”Verify a BLS signature.
ashen bls verify --pubkey 0x... --message 0x... --signature 0x...