Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump font weight docs website and fix link #5391

Merged
merged 254 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
4a86564
working
gamarin2 May 24, 2019
a9e303c
querier
gamarin2 May 28, 2019
0913fb6
working
gamarin2 Jun 3, 2019
167104c
merg
gamarin2 Jun 3, 2019
6346e8b
workiiiing
gamarin2 Jun 5, 2019
23f8f78
finish
gamarin2 Jun 5, 2019
9c2fd4e
add dep and makefile
gamarin2 Jun 5, 2019
9baaed7
Apply suggestions from code review
gamarin2 Jun 5, 2019
45f5654
typo
gamarin2 Jun 5, 2019
265ed8e
typo
gamarin2 Jun 5, 2019
0a83404
Apply suggestions from code review
gamarin2 Jun 6, 2019
5f883fd
refactor for new module interface
gamarin2 Jun 10, 2019
b06fafc
pull
gamarin2 Jun 10, 2019
dde15ae
karoly review
gamarin2 Jun 11, 2019
da2514f
Apply suggestions from code review
gamarin2 Jun 11, 2019
56c3f5b
encoding
gamarin2 Jun 11, 2019
4f7c6b4
working on baseapp doc
gamarin2 Jun 17, 2019
e37310f
baseapp work
gamarin2 Jun 27, 2019
92a0db9
reorg
gamarin2 Jun 27, 2019
94664fe
almost there
gamarin2 Jul 5, 2019
2624fec
finish first draft
gamarin2 Jul 5, 2019
9aedc16
Merge branch 'master' into gamarin/baseapp
gamarin2 Jul 5, 2019
3496625
remove old files
gamarin2 Jul 5, 2019
c90c997
module doc start
gamarin2 Jul 10, 2019
1239fcb
finish intro
gamarin2 Jul 11, 2019
a2e24e8
working
gamarin2 Jul 15, 2019
0f1b61d
workinnn
gamarin2 Jul 18, 2019
c5bb538
add transactions into core
glozow Jul 18, 2019
3c7d388
hans comments
glozow Jul 25, 2019
41e922c
add transactions into core
glozow Jul 18, 2019
37a2f11
final edits
glozow Aug 8, 2019
c3623e9
working
gamarin2 Aug 8, 2019
1e70aaf
gautier comments
glozow Aug 10, 2019
e8f59d2
merge
gamarin2 Aug 20, 2019
81cf8e6
clean
gamarin2 Aug 20, 2019
a6788cd
working
gamarin2 Aug 20, 2019
16d78da
consolidate intro
gamarin2 May 20, 2019
66dd675
querier
gamarin2 May 28, 2019
6d1df2e
workiiiing
gamarin2 Jun 5, 2019
afbaba5
refactor for new module interface
gamarin2 Jun 10, 2019
a039341
karoly review
gamarin2 Jun 11, 2019
dc97fb5
working on baseapp doc
gamarin2 Jun 17, 2019
24570fe
baseapp work
gamarin2 Jun 27, 2019
2c412ec
reorg
gamarin2 Jun 27, 2019
f783f03
almost there
gamarin2 Jul 5, 2019
653ada2
finish first draft
gamarin2 Jul 5, 2019
0fc3c9a
remove old files
gamarin2 Jul 5, 2019
7b1f376
finish intro
gamarin2 Jul 11, 2019
023c31e
workinnn
gamarin2 Jul 18, 2019
033af57
initial commit after rebase
glozow Jul 20, 2019
f342f3a
query-lifecycle and started modules-interfaces
glozow Jul 20, 2019
f766dc2
query-lifecycle first draft done
glozow Jul 21, 2019
45fb5f1
module interfaces first draft
glozow Jul 23, 2019
a77f607
rest and intro skeletons
glozow Jul 26, 2019
0284332
rest and intro done
glozow Jul 26, 2019
54ced86
small edits and links
glozow Jul 26, 2019
e3d819e
comments
glozow Jul 31, 2019
4f040c4
revisions
glozow Aug 2, 2019
0be9410
cli.md comments
glozow Aug 12, 2019
62e1da2
comments
glozow Aug 14, 2019
8faeacb
minor edits
glozow Aug 14, 2019
936afcc
better flow for query lifecycle
glozow Aug 20, 2019
93a9fab
add transactions into core
glozow Jul 18, 2019
54ee067
hans comments
glozow Jul 25, 2019
de0aebf
add transactions into core
glozow Jul 18, 2019
e6123bd
merge
glozow Aug 20, 2019
207132c
checkout master-docs files
glozow Aug 21, 2019
cf60c92
deleted some
glozow Aug 21, 2019
8f9c36c
remove modules readme
glozow Aug 21, 2019
38c9ab9
cli.md comments
glozow Aug 28, 2019
19fee81
comments
glozow Aug 28, 2019
c685c34
module-interfaces comments
glozow Aug 28, 2019
cef7b4c
Merge PR #4857: Add Context concept doc
glozow Aug 28, 2019
d96abfd
working
gamarin2 Sep 9, 2019
f38fd48
working
gamarin2 Sep 9, 2019
c7ddc70
finish messages and queries
gamarin2 Sep 10, 2019
f7b6fc3
handler
gamarin2 Sep 10, 2019
8b1ac72
querier
gamarin2 Sep 10, 2019
6f39d98
last comments!
glozow Sep 10, 2019
02bfe22
punctuation
glozow Sep 10, 2019
5162d2e
querier2
gamarin2 Sep 10, 2019
a33f0db
Merge pull request #4704 from cosmos/gloria/transactions-doc
gamarin2 Sep 10, 2019
25fdbf2
consolidate intro
gamarin2 May 20, 2019
a6bd71e
querier
gamarin2 May 28, 2019
2101a75
workiiiing
gamarin2 Jun 5, 2019
8ee9c4a
refactor for new module interface
gamarin2 Jun 10, 2019
cefe24d
karoly review
gamarin2 Jun 11, 2019
c3bdae6
working on baseapp doc
gamarin2 Jun 17, 2019
919ced4
baseapp work
gamarin2 Jun 27, 2019
a8a06b1
reorg
gamarin2 Jun 27, 2019
6bfd175
almost there
gamarin2 Jul 5, 2019
8c6c26b
finish first draft
gamarin2 Jul 5, 2019
96d0441
remove old files
gamarin2 Jul 5, 2019
082ef4c
finish intro
gamarin2 Jul 11, 2019
00e88d8
workinnn
gamarin2 Jul 18, 2019
996e47d
initial commit after rebase
glozow Jul 20, 2019
5b10675
query-lifecycle and started modules-interfaces
glozow Jul 20, 2019
b6e4e17
query-lifecycle first draft done
glozow Jul 21, 2019
a708cc2
module interfaces first draft
glozow Jul 23, 2019
9affd0f
rest and intro skeletons
glozow Jul 26, 2019
cf13f00
rest and intro done
glozow Jul 26, 2019
d64ce4c
small edits and links
glozow Jul 26, 2019
cab3c2e
comments
glozow Jul 31, 2019
2ec8d94
revisions
glozow Aug 2, 2019
f53347f
cli.md comments
glozow Aug 12, 2019
d861ad7
comments
glozow Aug 14, 2019
a154691
minor edits
glozow Aug 14, 2019
3c7d671
better flow for query lifecycle
glozow Aug 20, 2019
463bffa
checkout master-docs files
glozow Aug 21, 2019
5b24d33
deleted some
glozow Aug 21, 2019
e96b166
remove modules readme
glozow Aug 21, 2019
0444f02
cli.md comments
glozow Aug 28, 2019
70fd35c
comments
glozow Aug 28, 2019
ee08a01
module-interfaces comments
glozow Aug 28, 2019
6343e60
Merge branch 'gloria/interfaces-docs' of github.com:cosmos/cosmos-sdk…
jackzampolin Sep 11, 2019
b4d1657
keeper
gamarin2 Sep 12, 2019
190c5d3
genesis
gamarin2 Sep 12, 2019
d2a2d91
finish
gamarin2 Sep 13, 2019
f3d307a
Merge branch 'master-docs' into gamarin/building-modules
gamarin2 Sep 13, 2019
c09597f
Apply suggestions from code review
gamarin2 Sep 16, 2019
e20c6d3
hans review
gamarin2 Sep 16, 2019
628ad72
Update docs/core/baseapp.md
gamarin2 Sep 16, 2019
9fa66e4
working
gamarin2 Sep 17, 2019
6914e0d
last comment
glozow Sep 17, 2019
47c9a28
Merge pull request #4755 from cosmos/gloria/interfaces-docs
gamarin2 Sep 17, 2019
036f418
workin
gamarin2 Sep 17, 2019
7392275
Merge branch 'master-docs' into gamarin/finish-docs
gamarin2 Sep 17, 2019
01e79c8
Apply suggestions from code review
fedekunze Oct 1, 2019
c151b31
encoding and node
gamarin2 Oct 4, 2019
5ef23b0
almost finish store
gamarin2 Oct 11, 2019
a8c51b7
merge
gamarin2 Oct 11, 2019
bc6afa6
merge
gamarin2 Oct 11, 2019
c44e476
Merge branch 'gamarin/building-modules' of https://github.com/cosmos/…
gamarin2 Oct 11, 2019
1d5d907
merge
gamarin2 Oct 11, 2019
7af02f8
finish docs
gamarin2 Oct 11, 2019
2b419e9
fixes
gamarin2 Oct 11, 2019
d3a168a
Merge pull request #5037 from cosmos/gamarin/building-modules
gamarin2 Oct 11, 2019
6ee28c4
fede comments + permalinks
gamarin2 Oct 18, 2019
e13a4bc
hans review
gamarin2 Oct 21, 2019
1cc5c19
add more permalinks
gamarin2 Oct 23, 2019
6d67876
Merge pull request #5186 from cosmos/gamarin/finish-docs
gamarin2 Oct 23, 2019
0d4e30c
update docs theme version (#5239)
fadeev Oct 24, 2019
6291948
merge master
gamarin2 Oct 27, 2019
fb63c07
R4R: Docs Cleanup (#5246)
gamarin2 Oct 28, 2019
834e14b
fix links
gamarin2 Nov 2, 2019
2b418b5
remove dup
gamarin2 Nov 2, 2019
4521f3c
remove dup
gamarin2 Nov 2, 2019
b97e615
remove dup
gamarin2 Nov 2, 2019
f1cc432
remove dup
gamarin2 Nov 2, 2019
f1ea40c
remove dup
gamarin2 Nov 2, 2019
5e4d9e9
fix links
gamarin2 Nov 2, 2019
0103f64
add subscribe events
gamarin2 Nov 5, 2019
72b821a
refine rest
gamarin2 Nov 5, 2019
3e55e78
index page
fadeev Nov 7, 2019
1b4ce52
sidebar
fadeev Nov 7, 2019
f0286af
theme version
fadeev Nov 7, 2019
1216369
theme version
fadeev Nov 7, 2019
1427288
testing netlify
fadeev Nov 7, 2019
fa048b8
theme version
fadeev Nov 7, 2019
9b32df7
tooltip example
fadeev Nov 8, 2019
f958a9b
version
fadeev Nov 9, 2019
eef7f62
testing code embedding
fadeev Nov 10, 2019
699d1f1
reverting back
fadeev Nov 10, 2019
885b2f8
theme version
fadeev Nov 10, 2019
dcdb101
version
fadeev Nov 10, 2019
e0b216f
version
fadeev Nov 10, 2019
3716b05
version
fadeev Nov 11, 2019
30dae64
readme and version
fadeev Nov 12, 2019
483d597
cleanup
gamarin2 Nov 13, 2019
77fc987
Merge branch 'master-docs' into docs-theme-latest
gamarin2 Nov 13, 2019
deffa90
redo app anatomy
gamarin2 Nov 13, 2019
e71cc65
Merge branch 'master-docs' into docs-theme-latest
gamarin2 Nov 13, 2019
aae2d9f
modules readme, theme version
fadeev Nov 13, 2019
14623ca
theme version
fadeev Nov 13, 2019
604e414
fix modules list
fadeev Nov 13, 2019
9505e33
theme version
fadeev Nov 14, 2019
50d8538
new snippets
gamarin2 Nov 15, 2019
dd2fc20
Merge branch 'master-docs' into docs-theme-latest
gamarin2 Nov 15, 2019
47d3115
modules readme
fadeev Nov 16, 2019
2d3d229
Merge branch 'docs-theme-latest' of https://github.com/cosmos/cosmos-…
fadeev Nov 16, 2019
d088829
update docs readme
gamarin2 Nov 18, 2019
6de6087
modify synopsis
gamarin2 Nov 18, 2019
7d62116
version
fadeev Nov 19, 2019
376c8dd
Merge branch 'master-docs' into docs-theme-latest
fadeev Nov 19, 2019
67bcf80
fix yaml
fadeev Nov 19, 2019
990a4d4
version
fadeev Nov 19, 2019
dbedb92
version
fadeev Nov 19, 2019
150566f
version
fadeev Nov 19, 2019
1a8278f
version
fadeev Nov 19, 2019
29956aa
version
fadeev Nov 20, 2019
5a4d439
version
fadeev Nov 21, 2019
cc57ed4
version
fadeev Nov 21, 2019
132aa27
version
fadeev Nov 21, 2019
d152ffe
version
fadeev Nov 22, 2019
90b184c
version
fadeev Nov 23, 2019
6aabc5a
add hide banner
gamarin2 Nov 25, 2019
01cd19b
version
fadeev Nov 25, 2019
2fa42e1
version
fadeev Nov 28, 2019
2a6cd2b
Merge branch 'master-docs' into docs-theme-latest
fadeev Dec 2, 2019
0ada884
version
fadeev Dec 2, 2019
d63bf84
small fixes
gamarin2 Dec 2, 2019
9dd99f1
modules readme, version
fadeev Dec 6, 2019
f388057
remove hotkeys dep, version
fadeev Dec 6, 2019
097d05e
version
fadeev Dec 6, 2019
a7d5523
version
fadeev Dec 6, 2019
f4e319d
version
fadeev Dec 6, 2019
a664b8d
version
fadeev Dec 8, 2019
786e719
version
fadeev Dec 9, 2019
c1c13a3
version
fadeev Dec 9, 2019
efe58c9
version
fadeev Dec 9, 2019
e3d62d8
slight notice
gamarin2 Dec 9, 2019
55dcc49
fix links and hide
gamarin2 Dec 9, 2019
565101d
permalinks
gamarin2 Dec 9, 2019
f7a7f26
small clean
gamarin2 Dec 9, 2019
ebf8fbf
Merge branch 'master-docs' into docs-theme-latest
gamarin2 Dec 9, 2019
40a56dd
merge
gamarin2 Dec 9, 2019
c03aaee
version
fadeev Dec 9, 2019
1fc0701
Merge branch 'docs-theme-latest' of https://github.com/cosmos/cosmos-…
fadeev Dec 9, 2019
d70bfa5
resolve conflicts, add google analytics
fadeev Dec 9, 2019
c705394
fix merge remants
gamarin2 Dec 9, 2019
2004b3f
version
fadeev Dec 10, 2019
cfba835
changelog 1/2
gamarin2 Dec 10, 2019
d34481b
Changelog: docs UI
fadeev Dec 10, 2019
2a52470
version
fadeev Dec 10, 2019
0ca6a8b
remove merge conflicts
fadeev Dec 10, 2019
1031cc4
remove merge conflicts
fadeev Dec 10, 2019
d6027cf
Code: Update link for Contributing to the docs to docs_readme
fadeev Dec 11, 2019
7f73d49
HTML/CSS: Update layout of homepage footer to match new layout in Figma
fadeev Dec 11, 2019
a0a89a6
version
fadeev Dec 11, 2019
10b625b
Merge branch 'master' into master-docs
gamarin2 Dec 11, 2019
69af384
final modifs
gamarin2 Dec 11, 2019
4d9fff0
merge
gamarin2 Dec 11, 2019
93252f2
modules, version
fadeev Dec 11, 2019
d7d0198
Merge branch 'docs-theme-latest' of https://github.com/cosmos/cosmos-…
fadeev Dec 11, 2019
53f2cff
modules readme
fadeev Dec 11, 2019
81ee608
link to module list from homepage
fadeev Dec 11, 2019
4f9bd1c
version
fadeev Dec 11, 2019
e11a866
building modules link
fadeev Dec 11, 2019
7a7cb12
version
fadeev Dec 11, 2019
211040f
version
fadeev Dec 11, 2019
c4898f5
fonts
fadeev Dec 11, 2019
68f6c4f
version
fadeev Dec 11, 2019
f775771
version
fadeev Dec 11, 2019
9897728
fix link
gamarin2 Dec 11, 2019
287307a
merge conflicts
fadeev Dec 11, 2019
05d8b28
fix package.json
fadeev Dec 11, 2019
e5cc921
Merge branch 'master' into docs-theme-latest
alexanderbez Dec 11, 2019
8b57449
links in explore sdk section
fadeev Dec 11, 2019
05b0d86
Merge branch 'docs-theme-latest' of https://github.com/cosmos/cosmos-…
fadeev Dec 11, 2019
19e85ed
core concepts
fadeev Dec 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
initial commit after rebase
  • Loading branch information
glozow committed Aug 20, 2019
commit 033af57324ae5139aceb6aff947c487bbf06659c
145 changes: 143 additions & 2 deletions docs/interfaces/cli.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,144 @@
# CLI
# Command-Line Interface

> TODO: Rewrite this section to explain how CLI works for a generic SDK app.
## Prerequisites

* [Anatomy of an SDK App](./app-anatomy.md)

## Synopsis

This document describes how to create a commmand-line interface for an SDK application. A separate document for creating module interfaces can be found [here](#./module-interfaces.md).

1. [Application CLI](#Application-cli)
2. [Commands](#commands)
3. [Flags](#flags)
4. [Initialization and Configurations](#initialization-and-configurations)

## Application CLI

One of the main entrypoints of an application is the command-line interface. This entrypoint is created as a `main.go` file which compiles to a binary, conventionally placed in the application's `app/cmd/cli` folder.

### Cobra

There is no set way to create a CLI, but SDK modules all use the [Cobra Library](https://github.com/spf13/cobra). Building a CLI with Cobra entails defining commands, arguments, and flags. [**Commands**](#commands) represent the action users wish to take, such as `tx` for creating a transaction and `query` for querying the application. Each command can also have nested subcommands, necessary for naming the specific transaction type. Users also supply **Arguments**, such as account numbers to send coins to, and [**Flags**](#flags) to modify various aspects of the commands, such as gas prices or which node to broadcast to.

### Main Function

The `main.go` file needs to have a `main()` function that does the following to run the command-line interface:

* **Instantiate the `codec`** by calling the application's `MakeCodec()` function. The `codec` is used to code and encode data structures for the application - stores can only persist `[]byte`s so the developer must define a serialization format for their data structures or use the default, [Amino](./amino.md).
* **Configurations** are set by reading in configuration files (e.g. the sdk config file).
* **Create the root command** to which all the application commands will be added as subcommands and add any required flags to it, such as `--chain-id`.
* **Add subcommands** for all the possible user interactions, including [transaction commands](#transaction-commands) and [query commands](#query-commands).
* **Create an Executor** and execute the root command.

The rest of the document will detail what needs to be implemented for each step.

## Commands

Every application CLI first constructs a root command, then adds functionality by aggregating subcommands (often with further nested subcommands) using `AddCommand()`. The bulk of an application's unique capabilities lies in its transaction and query commands, called `TxCmd` and `QueryCmd` respectively.

### Root Command

The root command (also called `rootCmd`) is what the user first types into the command line to indicate which application they wish to interact with. The string used to invoke the command (the "Use" field) is typically the name of the application suffixed with `-cli`, e.g. `appcli`. The root command must include the following commands to support basic functionality in the application.

* **Status** command from the SDK rpc client tools, which prints information about the status of the connected `Node`.
* **Config** command from the SDK client tools, which allows the user to edit a `config.toml` file that sets values for [flags](#flags) such as `--chain-id` and which `--node` they wish to connect to.
* **Keys** commands from the SDK client tools, which includes a collection of subcommands for using the key functions in the SDK crypto tools, including adding a new key and saving it to disk, listing all public keys stored in the key manager, and deleting a key.
* [**Transaction**](#transaction-commands) commands.
* [**Query**](#query-commands) commands.

### Transaction Commands

Application [transactions](#./transactions.md) are objects that trigger state changes. To enable the creation of transactions using the CLI interface, `TxCmd` should add the following commands:

* **Sign** command from the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/67f6b021180c7ef0bcf25b6597a629aca27766b8/docs/spec/auth) module, which signs messages in a transaction. To enable multisig, it should also add the `auth` module MultiSign command. Since every transaction requires some sort of signature in order to be valid, this command is necessary for every application.
* **Broadcast** command from the SDK client tools, which broadcasts transactions.
* **Send** command from the [`bank`](https://github.com/cosmos/cosmos-sdk/tree/67f6b021180c7ef0bcf25b6597a629aca27766b8/docs/spec/bank) module, which is a transaction that allows accounts to send coins to one another, including gas and fees for transactions.
* Any application-specific transaction commands defined by the application developer.
* All commands in each module the application is dependent on, retrieved by calling `GetTxCmd()` on all the modules or using the Module Manager's `AddTxCommands()` function.

### Query Commands

Application queries are objects that allow users to retrieve information about the application's state. To enable basic queries, `QueryCmd` should add the following commands:

* **QueryTx** and/or other transaction query commands from the `auth` module which allow the user to search for a transaction by inputting its hash, a list of tags, or a block height. These various queries allow users to see if transactions have been included in a block.
* **Account** command from the `auth` module, which displays the state (e.g. account balance) of an account given an address.
* **Validator** command from the SDK rpc client tools, which displays the validator set of a given height.
* **Block** command from the SDK rpc client tools, which displays the block data for a given height.
* Any application-specific query commands defined by the application developer.
* All commands in each module the application is dependent on, retrieved by calling `GetQueryCmd()` on all the modules or using the Module Manager's `AddQueryCommands()` function.

## Flags

Flags are used to modify commands. Users can explicitly include them in commands or pre-configure them by entering a command in the format `appcli config <flag> <value>` into their command line. Commonly pre-configured flags include the `--node` to connect to and `--chain-id` of the blockchain the user wishes to interact with.

A _persistent_ flag (as opposed to a _local_ flag) added to a command transcends all of its children. Additionally, all flags have default values when they are added to commands; some toggle an option off but others are empty values that the user needs to override to create valid commands. A flag can be explicitly marked as _required_ so that an error is automatically thrown if the user does not provide a value, but it is also acceptable to handle unexpected missing flags differently.

### Root Command Flags

It is common to add a _persistent_ flag for `--chain-id`, the unique identifier of the blockchain the application pertains to, to the root command. Adding this flag makes sense as the chain ID should not be changing across commands in this application CLI.

### Transaction Flags

To **create** a transaction, the user enters a `tx` command and provides several flags.

* `--from` indicates which account the transaction originates from. This account is used to sign the transaction.
* `--gas` refers to how much gas, which represents computational resources, Tx consumes. Gas is dependent on the transaction and is not precisely calculated until execution, but can be estimated by providing auto as the value for --gas.
* `--gas-adjustment` (optional) can be used to scale gas up in order to avoid underestimating. For example, users can specify their gas adjustment as 1.5 to use 1.5 times the estimated gas.
* `--gas-prices` specifies how much the user is willing pay per unit of gas, which can be one or multiple denominations of tokens. For example, --gas-prices=0.025uatom, 0.025upho means the user is willing to pay 0.025uatom AND 0.025upho per unit of gas.
* `--fees` specifies how much in fees the user is willing to pay in total. Note that the user only needs to provide either `gas-prices` or `fees`, but not both, because they can be derived from each other.
* `--generate-only` (optional) instructs the application to simply generate the unsigned transaction and output or write to a file. Without this flag, the transaction is created, signed, and broadcasted all in one command.
* `--dry-run` (optional), similar to `--generate-only`, instructs the application to ignore the `--gas` flag and simulate the transaction running without broadcasting.
* `--indent` (optional) adds an indent to the JSON response.
* `--memo` sends a memo along with the transaction.

For example, the following command creates a transaction to send 1000uatom from `sender-address` to `recipient-address`. The user is willing to pay 0.025uatom per unit gas but wants the transaction to be only generated offline (i.e. not broadcasted) and written, in JSON format, to the file `myUnsignedTx.json`.

```bash
appcli tx send <recipientAddress> 1000uatom --from <senderAddress> --gas auto -gas-prices 0.025uatom --generate-only > myUnsignedTx.json
```

To **sign** a transaction generated offline using the `--generate-only` flag, the user enters a `tx sign` command (by default, the transaction is automatically signed upon creation). There are four values for flags that must be provided if a transaction is expected to be signed:

* `--from` specifies an address; the corresponding private key is used to sign the transaction.
* `--chain-id` specifies the unique identifier of the blockchain the transaction pertains to.
* `--sequence` is the value of a counter measuring how many transactions have been sent from the account. It is used to prevent replay attacks.
* `--account-number` is an identifier for the account.
* `--validate-signatures` (optional) instructs the process to sign the transaction and verify that all signatures have been provided.
* `--ledger` (optional) lets the user perform the action using a Ledger Nano S, which needs to be plugged in and unlocked.

For example, the following command signs the inputted transaction, `myUnsignedTx.json`, and writes the signed transaction to the file `mySignedTx.json`.

```bash
appcli tx sign myUnsignedTx.json --from <senderName> --chain-id <chainId> --sequence <sequence> --account-number<accountNumber> > mySignedTx.json
```

To **broadcast** a signed transaction generated offline, the user enters a `tx broadcast` command. Only one flag is required here:

* `--node` specifies which node to broadcast to.
* `--trust-node` (optional) indicates whether or not the node and its response proofs can be trusted.
* `--broadcast-mode` (optional) specifies when the process should return. Options include asynchronous (return immediately), synchronous (return after `CheckTx` passes), or block (return after block commit).

For example, the following command broadcasts the signed transaction, `mySignedTx.json` to a particular node.

```bash
appcli tx broadcast mySignedTx.json --node <node>
```
### Query Flags

Queries also have flags.

* `--node` indicates which full-node to connect to.
* `--trust-node` (optional) represents whether or not the connected node is trusted. If the node is not trusted, all proofs in the responses are verified.
* `--indent` (optional) adds an indent to the JSON response.
* `--height` (optional) can be provided to query the blockchain at a specific height.
* `--ledger` (optional) lets the user perform the action using a Ledger Nano S.


## Initialization and Configurations

TODO

## Next

Read about how to build a CLI for your module [here](./module-interfaces#cli)
33 changes: 33 additions & 0 deletions docs/interfaces/query-lifecycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Query Lifecycle

## Prerequisites

## Synopsis

This document describes SDK interfaces through the lifecycle of a query, from the user interface to application stores and back. The query will be referred to as `query`.

1. [Interfaces](#interfaces)
2. [CLIContext](#clicontext)
3. [Tendermint and ABCI](#tendermint-and-abci)
4. [Application Query Handling](#application-query-handling)
5. [Response](#response)

## Interfaces

### CLI

### REST

## CLIContext

## Tendermint and ABCI

## Application Query Handling

### Baseapp

## Response

## Next

Read about how to build a [Command-Line Interface](./cli.md).