# CLI

#### [The zen-cli comes bundled together with the zen-node package. So start by installing and running the zen-node package in headless mode.](/apps/headless/headless.md)

Open your terminal and run `zen-node`

Now you can open another tab and your terminal and run `zen-cli` commands

```
USAGE: zen-cli [--help] [--port <port>] [--test] [<subcommand> [<options>]]

SUBCOMMANDS:

    balance <options>            get wallet balance
    history <options>            list wallet transactions
    address <options>            get wallet address
    resync <options>             resync wallet
    import <options>             import wallet seed from mnemonic sentence
    send <options>               send asset to address
    activate <options>           activate contract
    extend <options>             extend contract activation
    execute <options>            execute contract
    active <options>             list active contracts
    publishblock <options>       publish a block to the network
    accountexists <options>      check for an existing account
    checkpassword <options>      check a password
    mnemonicphrase <options>     get the mnemonic phrase
    exportzenpublickey <options> export zen extended public key
    importzenpublickey <options> import zen extended public key 
                                 and create watch-only account
    removewallet <options>       remove wallet
    publickey <options>          derive a public key 
                                 from a given derivation path
    rawtx-create <options>       create a raw transaction that pass 
                                 the asset and amount to the address
    rawtx-sign <options>         sign all possible inputs of the raw
                                 transaction and return the signed 
                                 transaction
    rawtx-publish <options>      publish a fully signed raw transaction
    wallet-create <options>      create a wallet from a newly generated 
                                 mnemonic phrase
    blockchain-info <options>    get blockchain info
    walletkeys <options>         get wallet keys
    signmessage <options>        sign message with your privates

    Use 'zen-cli <subcommand> --help' for additional information.

OPTIONS:

    --port, -p <port>     port of zen-node API
    --test, -t            use testnet port
    --help                display this list of options.


```

## Examples

### Check your balances

```
> zen-cli balance

Asset	| Balance
============================
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000	| 1900000000
```

### Get wallet address

```
> zen-cli address

tp1q7n4l3dldcv69wfyqm32mpkwvf56q5kjdv7ma5p2668z05ljcv2gsq3ke4q
```

### Send Transaction

```
> zen-cli spend 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 1000000 tp1q7n4l3dldcv69wfyqm32mpkwvf56q5kjdv7ma5p2668z05ljcv2gsq3ke4q

Ok "Binary [||]"
```

### Import Wallet

```
> zen-cli import mypassword ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt




```

### Resync Blockchain

```
> zen-cli resync

Success
```

### Activate Contract

```
> zen-cli activate path-to-file number-of-blocks rlimit


Success
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zenprotocol.com/apps/headless/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
