# aepp-cli-js

Command Line Interface for the æternity blockchain.

## Installation

You can install `aecli` using your preferred tool (`yarn` or `npm`). Here's an `npm` example

```
$ npm install --global @aeternity/aepp-cli
```

## Quick start

Let's ensure that CLI installed correctly by running `$ aecli`. It will show the available commands as below.

```
$ aecli
Usage: aecli [options] [command]

Options:
  -V, --version                                 output the version number
  -h, --help                                    display help for command

Commands:
  account                                       handle wallet operations
  spend [options] <wallet> <receiver> <amount>  send coins to another account or contract
  name                                          manage AENS names
  contract                                      contract interactions
  oracle                                        interact with oracles
  chain                                         make a request to the node
  inspect [options] <identifier>                get details of a node entity
  tx                                            generate transactions to sign and submit manually
  config [options]                              print the current sdk configuration
  select-node [nodeUrl]                         specify node to use in other commands
  select-compiler [compilerUrl]                 specify compiler to use in other commands
  help [command]                                display help for command
```

> To read documentation of other commands and sub-commands, you can append `--help`. For example, type `aecli account --help` to get a list of commands available in `account` module.

The next step is to create a wallet to use in other commands:

```
$ aecli account create ./wallet.json
Address  ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E
Path     /path/to/wallet.json
```

You need to send some coins to the created wallet.

> On testnet you can do that using [faucet](https://faucet.aepps.com/). Switch to testnet using `$ aecli select-node`.

Run `$ aecli inspect <wallet address>` to ensure that it got coins.

```
$ aecli inspect ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E
Account ID       ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E
Account balance  10000ae
Account nonce    0
No pending transactions
```

At the last step, we will send our coins to another account:

```
$ aecli spend ./wallet.json ak_AgV756Vfo99juwzNVgnjP1gXX1op1QN3NXTxvkPnHJPUDE8NT 42ae
Transaction mined
Transaction hash   th_2muLsbZeFaVJ3tePTnLqobPhxBzwFsm1zUv8sjgMX4LKuevX2T
Block hash         mh_dnoULQWpiRtcrntd5yJPUxcu7YrTu18xZ1e9EC2b8prKdShME
Block height       2 (about now)
Signatures         ["sg_SG5uW5KEGiy5iG1cCkKq4VEdpyvewcW4NjVf4vj2ZoCiap5iB7UQoknWpyWsD4FkziBuGPE88zwXemq3ZvPrdzNtXtKuD"]
Transaction type   SpendTx (ver. 1)
Sender address     ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E
Recipient address  ak_AgV756Vfo99juwzNVgnjP1gXX1op1QN3NXTxvkPnHJPUDE8NT
Amount             42ae
Payload            ba_Xfbg4g==
Fee                0.00001684ae
Nonce              1
TTL                4 (about now)
```

Find out more in the [user guide](/developer-documentation/aepp-cli-js/user-guide.md).

## Resources

* [User guide](/developer-documentation/aepp-cli-js/user-guide.md)
* [Changelog](/developer-documentation/aepp-cli-js/changelog.md)
* [Contributor guide](/developer-documentation/aepp-cli-js/contributor-guide.md)

## Commands reference

* `account`
  * [`sign`](/developer-documentation/aepp-cli-js/reference.md#sign) — sign a transaction using wallet
  * [`sign-message`](/developer-documentation/aepp-cli-js/reference.md#sign-message) — sign a personal message using wallet
  * [`verify-message`](/developer-documentation/aepp-cli-js/reference.md#verify-message) — check if message was signed by address
  * [`address`](/developer-documentation/aepp-cli-js/reference.md#address) — get wallet address and optionally secret key
  * [`create`](/developer-documentation/aepp-cli-js/reference.md#create) — create a wallet by a secret key or generate a new one
* [`spend`](/developer-documentation/aepp-cli-js/reference.md#spend) — send coins to another account or contract
* `name`
  * [`full-claim`](/developer-documentation/aepp-cli-js/reference.md#full-claim) — claim an AENS name in a single command
  * [`pre-claim`](/developer-documentation/aepp-cli-js/reference.md#pre-claim) — pre-claim an AENS name
  * [`claim`](/developer-documentation/aepp-cli-js/reference.md#claim) — claim an AENS name (requires pre-claim)
  * [`bid`](/developer-documentation/aepp-cli-js/reference.md#bid) — bid on name in auction
  * [`update`](/developer-documentation/aepp-cli-js/reference.md#update) — update a name pointer
  * [`extend`](/developer-documentation/aepp-cli-js/reference.md#extend) — extend name TTL
  * [`revoke`](/developer-documentation/aepp-cli-js/reference.md#revoke) — revoke an AENS name
  * [`transfer`](/developer-documentation/aepp-cli-js/reference.md#transfer) — transfer a name to another account
* `contract`
  * [`compile`](/developer-documentation/aepp-cli-js/reference.md#compile) — compile a contract to get bytecode
  * [`encode-calldata`](/developer-documentation/aepp-cli-js/reference.md#encode-calldata) — encode calldata for contract call
  * [`decode-call-result`](/developer-documentation/aepp-cli-js/reference.md#decode-call-result) — decode contract call result
  * [`call`](/developer-documentation/aepp-cli-js/reference.md#call) — execute a function of the contract
  * [`deploy`](/developer-documentation/aepp-cli-js/reference.md#deploy) — deploy a contract on the chain
* `oracle`
  * [`create`](/developer-documentation/aepp-cli-js/reference.md#create-1) — register current account as oracle
  * [`extend`](/developer-documentation/aepp-cli-js/reference.md#extend-1) — extend oracle's time to leave
  * [`create-query`](/developer-documentation/aepp-cli-js/reference.md#create-query) — create an oracle query
  * [`respond-query`](/developer-documentation/aepp-cli-js/reference.md#respond-query) — respond to an oracle query
* `chain`
  * [`top`](/developer-documentation/aepp-cli-js/reference.md#top) — query the top key/micro block of the chain
  * [`status`](/developer-documentation/aepp-cli-js/reference.md#status) — query node version, network id, and related details of the selected node
  * [`ttl`](/developer-documentation/aepp-cli-js/reference.md#ttl) — get relative TTL by absolute TTL
  * [`play`](/developer-documentation/aepp-cli-js/reference.md#play) — prints blocks from top until condition
  * [`broadcast`](/developer-documentation/aepp-cli-js/reference.md#broadcast) — send signed transaction to the chain
* [`inspect`](/developer-documentation/aepp-cli-js/reference.md#inspect) — get details of a node entity
* `tx`
  * [`spend`](/developer-documentation/aepp-cli-js/reference.md#spend-1) — build spend transaction
  * [`name-preclaim`](/developer-documentation/aepp-cli-js/reference.md#name-preclaim) — build name preclaim transaction
  * [`name-claim`](/developer-documentation/aepp-cli-js/reference.md#name-claim) — build name claim transaction
  * [`name-update`](/developer-documentation/aepp-cli-js/reference.md#name-update) — build name update transaction
  * [`name-transfer`](/developer-documentation/aepp-cli-js/reference.md#name-transfer) — build name transfer transaction
  * [`name-revoke`](/developer-documentation/aepp-cli-js/reference.md#name-revoke) — build name revoke transaction
  * [`contract-deploy`](/developer-documentation/aepp-cli-js/reference.md#contract-deploy) — build contract deploy transaction
  * [`contract-call`](/developer-documentation/aepp-cli-js/reference.md#contract-call) — build contract call transaction
  * [`oracle-register`](/developer-documentation/aepp-cli-js/reference.md#oracle-register) — build oracle register transaction
  * [`oracle-extend`](/developer-documentation/aepp-cli-js/reference.md#oracle-extend) — build oracle extend transaction
  * [`oracle-post-query`](/developer-documentation/aepp-cli-js/reference.md#oracle-post-query) — build oracle post query transaction
  * [`oracle-respond`](/developer-documentation/aepp-cli-js/reference.md#oracle-respond) — build oracle respond transaction
  * [`verify`](/developer-documentation/aepp-cli-js/reference.md#verify) — verify transaction using node
* [`config`](/developer-documentation/aepp-cli-js/reference.md#config) — print the current sdk configuration
* [`select-node`](/developer-documentation/aepp-cli-js/reference.md#select-node) — specify node to use in other commands
* [`select-compiler`](/developer-documentation/aepp-cli-js/reference.md#select-compiler) — specify compiler to use in other commands


---

# 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.aeternity.com/developer-documentation/aepp-cli-js.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.
