From cce48dc68c9f302ef72800eaa3b848c2f2cdb1ae Mon Sep 17 00:00:00 2001 From: Christopher Goes Date: Fri, 26 Oct 2018 15:47:07 +0200 Subject: [PATCH] Docs fixes in progress while running through the release process --- docs/sdk/clients.md | 76 ++++++++++++++++++++----------------- x/stake/client/cli/flags.go | 4 +- x/stake/client/cli/tx.go | 8 ++-- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/docs/sdk/clients.md b/docs/sdk/clients.md index 4703c49218..8697a14a93 100644 --- a/docs/sdk/clients.md +++ b/docs/sdk/clients.md @@ -10,6 +10,16 @@ 🚧 We are actively working on improving documentation for Gaiacli and Gaiad. ::: +::: tip Note +If you receive this error message: + +```bash +Must specify these options: --chain-id when --trust-node is false +``` + +you must choose whether you wish to verify lite client proofs. If you trust the node which you are querying, you can simply pass `--trust-node=true` - otherwise you'll need to specify `--chain-id`. +::: + `gaiacli` is the command line interface to manage accounts and transactions on Cosmos testnets. Here is a list of useful `gaiacli` commands, including usage examples. ### Keys @@ -70,6 +80,8 @@ View the validator pubkey for your node by typing: gaiad tendermint show-validator ``` +Note that this is the Tendermint signing key, *not* the operator key you will use in delegation transactions. + ::: danger Warning We strongly recommend _NOT_ using the same passphrase for multiple keys. The Tendermint team and the Interchain Foundation will not be responsible for the loss of funds. ::: @@ -79,7 +91,7 @@ We strongly recommend _NOT_ using the same passphrase for multiple keys. The Ten You can generate and print a multisig public key by typing: ```bash -gaiacli show -m K key1 key2...keyK +gaiacli show --multisig-threshold K name1 name2 name3 [...] ``` `K` is the minimum weight, e.g. minimum number of private keys that must have signed the transactions that carry the generated public key. @@ -95,7 +107,7 @@ The best way to get tokens is from the [Cosmos Testnet Faucet](https://faucetcos After receiving tokens to your address, you can view your account's balance by typing: ```bash -gaiacli account +gaiacli query account ``` ::: warning Note @@ -111,7 +123,7 @@ The following command could be used to send coins from one account to another: gaiacli tx send \ --amount=10faucetToken \ --chain-id= \ - --name= \ + --from= \ --to= ``` @@ -128,14 +140,14 @@ Gas estimate might be inaccurate as state changes could occur in between the end Now, view the updated balances of the origin and destination accounts: ```bash -gaiacli account -gaiacli account +gaiacli query account +gaiacli query account ``` You can also check your balance at a given block by using the `--block` flag: ```bash -gaiacli account --block= +gaiacli query account --block= ``` You can simulate a transaction without actually broadcasting it by appending the `--dry-run` flag to the command line: @@ -144,7 +156,7 @@ You can simulate a transaction without actually broadcasting it by appending the gaiacli tx send \ --amount=10faucetToken \ --chain-id= \ - --name= \ + --from= \ --to= \ --dry-run ``` @@ -155,7 +167,7 @@ Furthermore, you can build a transaction and print its JSON format to STDOUT by gaiacli tx send \ --amount=10faucetToken \ --chain-id= \ - --name= \ + --from= \ --to= \ --generate-only > unsignedSendTx.json ``` @@ -165,7 +177,7 @@ You can now sign the transaction file generated through the `--generate-only` fl ```bash gaiacli tx sign \ --chain-id= \ - --name= + --from= unsignedSendTx.json > signedSendTx.json ``` @@ -206,11 +218,19 @@ On the testnet, we delegate `steak` instead of `atom`. Here's how you can bond t ```bash gaiacli tx delegate \ --amount=10steak \ - --validator=$(gaiad tendermint show-validator) \ - --name= \ + --validator= \ + --from= \ --chain-id= ``` +`` is the operator address of the validator to which you intend to delegate. If you are running a local testnet, you can find this with: + +```bash +gaiacli keys show [name] --bech val +``` + +where `[name]` is the name of the key you specified when you initialized `gaiad`. + While tokens are bonded, they are pooled with all the other bonded tokens in the network. Validators and delegators obtain a percentage of shares that equal their stake in this pool. ::: tip Note @@ -237,24 +257,17 @@ You can also get previous delegation(s) status by adding the `--height` flag. #### Unbond Tokens -If for any reason the validator misbehaves, or you just want to unbond a certain amount of tokens, use this following command. You can unbond a specific `shares-amount` (eg:`12.1`\) or a `shares-percent` (eg:`25`) with the corresponding flags. +If for any reason the validator misbehaves, or you just want to unbond a certain amount of tokens, use this following command. You can unbond a specific `shares-amount` (eg:`12.1`\) or a `shares-fraction` (eg:`0.25`) with the corresponding flags. ```bash gaiacli tx unbond begin \ --validator= \ - --shares-percent=100 \ + --shares-fraction=0.5 \ --from= \ --chain-id= ``` -Later you must complete the unbonding process by using the `gaiacli tx unbond complete` command: - -```bash -gaiacli tx unbond complete \ - --validator= \ - --from= \ - --chain-id= -``` +The unbonding will be automatically completed when the unbonding period has passed. ##### Query Unbonding-Delegations @@ -280,23 +293,16 @@ A redelegation is a type delegation that allows you to bond illiquid tokens from ```bash gaiacli tx redelegate begin \ - --address-validator-source= \ - --address-validator-dest= \ - --shares-percent=50 \ + --addr-validator-source= \ + --addr-validator-dest= \ + --shares-fraction=50 \ --from= \ --chain-id= ``` -Here you can also redelegate a specific `shares-amount` or a `shares-percent` with the corresponding flags. +Here you can also redelegate a specific `shares-amount` or a `shares-fraction` with the corresponding flags. -Later you must complete the redelegation process by using the `gaiacli tx redelegate complete` command: - -```bash -gaiacli tx unbond complete \ - --validator= \ - --from= \ - --chain-id= -``` +The redelegation will be automatically completed when the unbonding period has passed. ##### Query Redelegations @@ -305,8 +311,8 @@ Once you begin an redelegation, you can see it's information by using the follow ```bash gaiacli query redelegation \ --address-delegator= \ - --address-validator-source= \ - --address-validator-dest= \ + --addr-validator-source= \ + --addr-validator-dest= \ ``` Or if you want to check all your current unbonding-delegations with disctinct validators: diff --git a/x/stake/client/cli/flags.go b/x/stake/client/cli/flags.go index 29237b6ba8..e4948f9456 100644 --- a/x/stake/client/cli/flags.go +++ b/x/stake/client/cli/flags.go @@ -15,7 +15,7 @@ const ( FlagPubKey = "pubkey" FlagAmount = "amount" FlagSharesAmount = "shares-amount" - FlagSharesPercent = "shares-percent" + FlagSharesFraction = "shares-fraction" FlagMoniker = "moniker" FlagIdentity = "identity" @@ -51,7 +51,7 @@ func init() { fsPk.String(FlagPubKey, "", "Go-Amino encoded hex PubKey of the validator. For Ed25519 the go-amino prepend hex is 1624de6220") fsAmount.String(FlagAmount, "", "Amount of coins to bond") fsShares.String(FlagSharesAmount, "", "Amount of source-shares to either unbond or redelegate as a positive integer or decimal") - fsShares.String(FlagSharesPercent, "", "Percent of source-shares to either unbond or redelegate as a positive integer or decimal >0 and <=1") + fsShares.String(FlagSharesFraction, "", "Fraction of source-shares to either unbond or redelegate as a positive integer or decimal >0 and <=1") fsDescriptionCreate.String(FlagMoniker, "", "validator name") fsDescriptionCreate.String(FlagIdentity, "", "optional identity signature (ex. UPort or Keybase)") fsDescriptionCreate.String(FlagWebsite, "", "optional website") diff --git a/x/stake/client/cli/tx.go b/x/stake/client/cli/tx.go index e3f1060eef..c43e1276e3 100644 --- a/x/stake/client/cli/tx.go +++ b/x/stake/client/cli/tx.go @@ -255,9 +255,9 @@ func GetCmdBeginRedelegate(storeName string, cdc *codec.Codec) *cobra.Command { // get the shares amount sharesAmountStr := viper.GetString(FlagSharesAmount) - sharesPercentStr := viper.GetString(FlagSharesPercent) + sharesFractionStr := viper.GetString(FlagSharesFraction) sharesAmount, err := getShares( - storeName, cdc, sharesAmountStr, sharesPercentStr, + storeName, cdc, sharesAmountStr, sharesFractionStr, delAddr, valSrcAddr, ) if err != nil { @@ -318,9 +318,9 @@ func GetCmdBeginUnbonding(storeName string, cdc *codec.Codec) *cobra.Command { // get the shares amount sharesAmountStr := viper.GetString(FlagSharesAmount) - sharesPercentStr := viper.GetString(FlagSharesPercent) + sharesFractionStr := viper.GetString(FlagSharesFraction) sharesAmount, err := getShares( - storeName, cdc, sharesAmountStr, sharesPercentStr, + storeName, cdc, sharesAmountStr, sharesFractionStr, delAddr, valAddr, ) if err != nil {