> For the complete documentation index, see [llms.txt](https://docs.palliora.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.palliora.org/build/palliora-cli.md).

# Palliora-cli

### 1 - Overview

Palliora CLI (`palliora-cli`) is a command-line tool for interacting with the Palliora ecosystem: uploading models and datasets, managing accounts and keys, and interacting with on-chain storage and staking features. The codebase is implemented in TypeScript and compiled to a single executable script in `dist/palliora-cli.js`.

Primary capabilities (examples):

* Create/import/show account keys and info (see `src/account/*`).
* Join the network as a guardian or validator (see `src/join/*`).
* Manage staking operations (add, reduce, remove, withdraw) under `src/stake/*`.
* On-chain interactions and Palliora-specific utilities under `src/palliora/*` and `src/paliCrypto/*`.

Common commands (high level)

* Account management: create/import/show/info - manage keys and account metadata (see `src/account`).
* Join network: guardian/validator - join as a guardian or validator and submit relevant transactions (`src/join`).
* Stake operations: add/new/reduce/remove/withdraw - staking flows and helpers (`src/stake`).

See [Commands List](#command-reference)

Examples

* Create an account (example):

  `pnpm start account-create`
* Show account info:

  `pnpm start account-show`

## Command Reference

This file is a concise command cheat-sheet for the `palliora-cli`. Use `pnpm dev <command>` while developing or `palliora-cli <command>` after installation.

#### Global flags

* \--help - show help
* \--version - show CLI version

#### Account commands

* account-show
  * Description: Show local account information
  * Options: --secret (show private key material)
  * Examples:
    * palliora-cli account-show
    * palliora-cli account-show --secret
* account-create
  * Description: Create a new account and save it locally
  * Options: --dry (dry run)
  * Examples:
    * palliora-cli account-create
    * palliora-cli account-create --dry
* account-import
  * Description: Import an account from private key / mnemonic / derived
  * Options:
    * \--private-key \<hex|string>
    * \--mnemonic
    * \--derived
    * \--dry
  * Notes: private-key, mnemonic and derived flags conflict with each other (only one allowed)
  * Examples:
    * palliora-cli account-import --private-key 0xabc...
    * palliora-cli account-import --mnemonic "seed phrase"
* account-info
  * Description: Show on-chain account details (balances, ledger)
  * Example: palliora-cli account-info
* account-remove
  * Description: Delete the locally saved account file
  * Example: palliora-cli account-remove

#### Funding

* fund
  * Description: Fund an account (developer/test helper)
  * Options:
    * \--amount (coerced to bigint; default: 1000000)
    * \--address
  * Example: palliora-cli fund --amount 5000000 --address 5F...

#### Staking

* stake-new
  * Description: Create a new stake (bond)
  * Options:
    * \--amount (required)
    * \--reward-destination
  * Example: palliora-cli stake-new --amount 1000000
* stake-add
  * Description: Add tokens to an existing stake
  * Options: --amount (required)
  * Example: palliora-cli stake-add --amount 500000
* stake-reduce
  * Description: Unbond a portion of stake
  * Options: --amount (required)
  * Example: palliora-cli stake-reduce --amount 200000
* stake-remove
  * Description: Unbond the entire staked amount
  * Example: palliora-cli stake-remove
* stake-withdraw
  * Description: Withdraw unbonded funds
  * Example: palliora-cli stake-withdraw

#### Uploads (placeholders)

* upload-model
  * Description: Upload a model (handler currently TODO)
  * Example: palliora-cli upload-model
* upload-dataset
  * Description: Upload a dataset (handler currently TODO)
  * Example: palliora-cli upload-dataset

#### Join network

* join-guardian
  * Description: Join as a guardian
  * Options:
    * \--standard (boolean)
    * \--verifier (boolean)
    * \--compute - comma-separated compute prefs from: trusted,tee,mpc,fhe,zkp
  * Example: palliora-cli join-guardian --standard --compute trusted,tee
* join-validator
  * Description: Join as a validator
  * Options: --commission (default 0)
  * Example: palliora-cli join-validator --commission 5
* join-idle
  * Description: Join as an idle staker (chill)
  * Example: palliora-cli join-idle

***Notes & caveats***

* The CLI uses `milliPALI` units for token amounts and coerces values to `bigint` using helpers in `src/utils/helper.ts` - supply integer values (no decimals).
* `upload-model` and `upload-dataset` are TODO placeholders in code and currently have no implemented behavior or options.
