# 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](https://docs.aeternity.com/developer-documentation/aepp-cli-js/user-guide).

## Resources

* [User guide](https://docs.aeternity.com/developer-documentation/aepp-cli-js/user-guide)
* [Changelog](https://docs.aeternity.com/developer-documentation/aepp-cli-js/changelog)
* [Contributor guide](https://docs.aeternity.com/developer-documentation/aepp-cli-js/contributor-guide)

## Commands reference

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