Skip to content

Using the CLI

The ashen CLI provides tools for interacting with the Ashen chain, managing contracts, and automating workflows.

Terminal window
# Check chain status
ashen status
# Query an account
ashen account --address 0x1234...
# Call a contract method (read-only)
ashen view 0xCONTRACT balanceOf '["0xUSER"]'
# Execute a transaction
ashen call 0xCONTRACT transfer '["0xTO", 100]' --key $KEY --wait
VariableDescription
NODE_RPC_URLRPC endpoint (default: http://127.0.0.1:3030)
NODE_AUTH_TOKENOptional authentication token
ASHEN_PRIVATE_KEYPrivate key for signing transactions

Get chain status including tip height, epoch, and finalized block.

Terminal window
ashen status
ashen status --rpc-url http://custom:3030

Query account information including balance and nonce lanes.

Terminal window
ashen account --address 0x1234...

Execute a read-only contract call (no transaction, no gas cost).

Terminal window
# Basic view call
ashen view 0xCONTRACT methodName '["arg1", "arg2"]'
# With explicit IDL path
ashen view 0xCONTRACT balanceOf '["0xUSER"]' --idl ./token.idl
# Multi-interface contract
ashen view 0xCONTRACT totalSupply --interface IERC20

IDLs are auto-fetched from the chain and cached for 1 hour. Use --idl to override.

Execute a state-changing transaction.

Terminal window
# Basic call (simulates only)
ashen call 0xCONTRACT transfer '["0xTO", 100]' --key $KEY
# Submit and wait for inclusion
ashen call 0xCONTRACT transfer '["0xTO", 100]' --key $KEY --wait
# Custom gas/fee
ashen call 0xCONTRACT mint '["0xTO", 1000]' --key $KEY \
--gas-limit 500000 --max-fee 2000000 --wait

Display a contract’s IDL/ABI.

Terminal window
# Pretty-printed
ashen abi 0xCONTRACT
# Raw IDL text
ashen abi 0xCONTRACT --raw

Inspect a local IDL file without connecting to the chain.

Terminal window
ashen contract inspect --idl ./mycontract.idl

Detailed view call with more options.

Terminal window
ashen contract view \
--contract 0x1234... \
--method balanceOf \
--args '["0xUSER"]' \
--idl ./token.idl \
--origin 0xCALLER

Detailed call with simulation and submission options.

Terminal window
# Simulate only (default)
ashen contract call \
--contract 0x1234... \
--method transfer \
--args '["0xTO", 100]' \
--key $KEY
# Simulate and submit
ashen contract call ... --wait
# Force submit even on simulation failure
ashen contract call ... --force --wait

Query a transaction by its hash.

Terminal window
# Get status
ashen tx by-hash --tx-hash 0xABCD...
# Wait for inclusion
ashen tx by-hash --tx-hash 0xABCD... --wait --wait-timeout-s 120

Fetch a contract’s IDL from the chain.

Terminal window
ashen idl fetch --contract 0x1234...
ashen idl fetch --contract 0x1234... --output ./contract.idl

Generate a manifest from a local IDL file (selectors, methods, types).

Terminal window
ashen idl generate --idl ./mycontract.idl
ashen idl generate --idl ./mycontract.idl --output ./manifest.json

Validate IDL syntax and semantics.

Terminal window
ashen idl validate ./mycontract.idl

Compare two IDL versions and report breaking changes.

Terminal window
ashen idl diff old.idl new.idl
ashen idl diff old.idl new.idl --json

Generate client code from an IDL file.

Terminal window
# TypeScript
ashen idl codegen ./token.idl --lang ts --output-dir ./generated
# Rust
ashen idl codegen ./token.idl --lang rust --output-dir ./generated

Supported languages: ts/typescript, rust, go, c


Initialize a new keystore.

Terminal window
ashen keystore init
ashen keystore init --path ~/.ashen/keystore.json

List keys in the keystore.

Terminal window
ashen keystore list

Add a new key.

Terminal window
# Generate new key
ashen keystore add --label my-key
# Import existing
ashen keystore add --label imported --secret 0x...

Export a key’s public address.

Terminal window
ashen keystore export --label my-key

Launch the interactive terminal UI for visual exploration.

Terminal window
# Launch TUI
ashen
# Or explicitly
ashen tui

The 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
ScreenKeyDescription
HomehMain menu
Block ExplorerbBrowse recent blocks
Account VieweraCheck account details
ContractscManage contract addresses
IDLsiManage IDL files
FavoritesfQuick access methods
Transaction HistorytYour submitted txs
SettingssConfigure RPC, keys
Help?Keyboard shortcuts

Configuration is stored in ~/.config/ashen/config.toml:

rpc_url = "http://127.0.0.1:3030"
auth_token = ""
default_key = ""
block_buffer_limit = 100
tx_history_limit = 64
[idls]
sft = { path = "/path/to/sft.idl" }
amm = { path = "/path/to/amm.idl", namespace = "v1" }
[contracts]
token = "0x1234..."
pool = "0x5678..."

The ashen tui subcommand provides headless commands with JSON output, designed for AI agents and automation.

  • All ashen tui commands output JSON when:
    • --json flag is provided, OR
    • stdout is not a TTY (piped or redirected)
  • Human-readable output when run interactively without --json

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"]
}
CodeMeaning
0Success
1Not found
2Invalid arguments
3Authentication error
4Conflict
5Internal error
Terminal window
# Get chain status
ashen tui status --json
# Returns: tip_height, tip_hash, epoch, finalized_height, chain_id
# Get account info
ashen tui account 0x1234... --json
# Returns: address, balance, nonce_lanes, has_code
Terminal window
# View call (read-only)
ashen tui view --contract 0x... --method balanceOf --args '["0xUSER"]' --json
# Call with simulation only
ashen tui call --contract 0x... --method transfer \
--args '["0xTO", 100]' --key $KEY --json
# Submit transaction
ashen tui call --contract 0x... --method transfer \
--args '["0xTO", 100]' --key $KEY --submit --json
# Submit and wait for inclusion
ashen tui call --contract 0x... --method transfer \
--args '["0xTO", 100]' --key $KEY --submit --wait --json
Terminal window
# Get transaction details
ashen tui tx details 0xHASH... --json
# Wait for tx inclusion
ashen tui tx wait 0xHASH... --timeout 120 --json
# List transactions (with filters)
ashen tui tx list --limit 50 --json
ashen tui tx list --sender 0x... --json
ashen tui tx list --contract 0x... --before 1000 --json
# Local tx history
ashen tui tx history --limit 20 --json
Terminal window
# List recent blocks
ashen tui blocks list --limit 20 --json
ashen tui blocks list --before 1000 --limit 50 --json
# Get block details
ashen tui blocks get 100 --json
Terminal window
# List pending transactions
ashen tui mempool --limit 50 --json
Terminal window
# Get/set config values
ashen tui config get rpc-url --json
ashen tui config set rpc-url http://node:3030 --json
# Manage IDLs
ashen tui config idls list --json
ashen tui config idls add --name sft --path ./sft.idl --json
ashen tui config idls remove sft --json
# Manage contracts
ashen tui config contracts list --json
ashen tui config contracts add --name token --address 0x... --json
ashen tui config contracts remove token --json
# Manage favorites
ashen tui config favorites list --json
ashen tui config favorites add --contract 0x... --idl sft --method mint --json
ashen tui config favorites remove 0 --json
Terminal window
# List contract methods
ashen tui contract methods --contract 0x... --json
ashen tui contract methods --contract 0x... --idl ./custom.idl --json
Terminal window
# List all RPC methods
ashen tui rpc methods --json
# Get method signature
ashen tui rpc method chain_status --json
# Execute RPC call
ashen tui rpc call chain_status --json
ashen tui rpc call account '{"address": "0x..."}' --json
#!/bin/bash
# Agent workflow: check balance, transfer, wait for confirmation
# 1. Check balance
BALANCE=$(ashen tui account 0xFROM... --json | jq -r '.data.balance')
echo "Current balance: $BALANCE"
# 2. Check if sufficient
if [ "$BALANCE" -lt 1000 ]; then
echo "Insufficient balance"
exit 1
fi
# 3. Execute transfer and wait
RESULT=$(ashen tui call \
--contract 0xTOKEN... \
--method transfer \
--args '["0xTO...", 100]' \
--key "$ASHEN_PRIVATE_KEY" \
--submit --wait --json)
# 4. Check result
if 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 1
fi

Trace a transaction’s execution.

Terminal window
ashen debug trace --tx-hash 0x...

Replay a transaction with debugging.

Terminal window
ashen debug replay --tx-hash 0x... --breakpoint pc:0x1000

Export a chain snapshot.

Terminal window
ashen backup export --data-dir ./node-data --output ./snapshot.tar

Import a chain snapshot.

Terminal window
ashen backup import --data-dir ./node-data --input ./snapshot.tar

Generate a BLS keypair.

Terminal window
ashen bls keygen

Verify a BLS signature.

Terminal window
ashen bls verify --pubkey 0x... --message 0x... --signature 0x...