-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User guides for Keplr, Leap, Ping Pub and CLI (#211)
- Loading branch information
Showing
39 changed files
with
647 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Architecture", | ||
"position": 5 | ||
"position": 6 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"label": "Tools", | ||
"position": 5, | ||
"position": 7, | ||
"collapsed": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"label": "Users", | ||
"position": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"label": "Using ZetaChain's CLI" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Adding an Account | ||
|
||
## Prerequisites | ||
|
||
This tutorial requires `zetacored` CLI to be installed. Please, check out the | ||
docs [on installing the CLI](/users/cli/setup). | ||
|
||
:::warning | ||
|
||
This guide is using the test keyring, which is not secure. Do not use it in for | ||
accounts with real funds. | ||
|
||
::: | ||
|
||
Before interacting with ZetaChain using the CLI, you need to add an account. | ||
|
||
## Creating a New Account | ||
|
||
Create a new account: | ||
|
||
``` | ||
zetacored keys add alice | ||
``` | ||
|
||
Where `alice` is the name of the account. | ||
|
||
``` | ||
- address: zeta10r4ygmwhd5jyrfrve72u3vz0ujdr8lvatw0gw9 | ||
name: alice | ||
pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"A4pXWBWe/MK8gRhBCuOgeVZu33IaMX08TYTznbHiUg5R"}' | ||
type: local | ||
**Important** write this mnemonic phrase in a safe place. | ||
It is the only way to recover your account if you ever forget your password. | ||
fade sunset wink lonely seek glass load group shove scan tape shop rather connect enhance absurd illness patch void save skirt fee code mushroom | ||
``` | ||
|
||
In this and following guides we'll be using `alice` as an example account name. | ||
When a command requires an address, we'll be using the following command | ||
`$(zetacored keys show alice -a)` which simply returns an address of a given | ||
key. Please, replace `alice` in the following examples with your own key name. | ||
|
||
## Importing an Account | ||
|
||
If you have an existing account, you can import it using the mnemonic phrase: | ||
|
||
``` | ||
zetacored keys add bob --recover | ||
``` | ||
|
||
The terminal will ask you to enter your mnemonic phrase: | ||
|
||
``` | ||
> Enter your bip39 mnemonic | ||
man promote grunt cube venture shaft fix scorpion payment tobacco bunker cannon sugar funny time lake foster believe raccoon then shadow price hour weekend | ||
- address: zeta130c4smfsmdncp0vgqc8nh64dn80q3tkz3hjj4n | ||
name: bob | ||
pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"AlwIbpaOnvauaiRXTGZgyzRBqexCUUvwzACG+j4KzceW"}' | ||
type: local | ||
``` | ||
|
||
The mnemonic phrase above is for demonstration purposes only. Do not use it. | ||
|
||
## Listing Accounts | ||
|
||
List all accounts: | ||
|
||
``` | ||
zetacored keys list | ||
``` | ||
|
||
``` | ||
- address: zeta10r4ygmwhd5jyrfrve72u3vz0ujdr8lvatw0gw9 | ||
name: alice | ||
pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"A4pXWBWe/MK8gRhBCuOgeVZu33IaMX08TYTznbHiUg5R"}' | ||
type: local | ||
- address: zeta130c4smfsmdncp0vgqc8nh64dn80q3tkz3hjj4n | ||
name: bob | ||
pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"AlwIbpaOnvauaiRXTGZgyzRBqexCUUvwzACG+j4KzceW"}' | ||
type: local | ||
``` | ||
|
||
## Convert Between Address Formats | ||
|
||
ZetaChain uses two types of addresses: | ||
|
||
- bech32 addresses that look like `zeta***` | ||
- hex addresses that look like `0x***` | ||
|
||
You can convert between the two formats using the `debig addr` command: | ||
|
||
``` | ||
zetacored debug addr zeta10r4ygmwhd5jyrfrve72u3vz0ujdr8lvatw0gw9 | ||
``` | ||
|
||
``` | ||
Address: [120 234 68 109 215 109 36 65 164 108 207 149 200 176 79 228 154 51 253 157] | ||
Address (hex): 78EA446DD76D2441A46CCF95C8B04FE49A33FD9D | ||
Bech32 Acc: zeta10r4ygmwhd5jyrfrve72u3vz0ujdr8lvatw0gw9 | ||
Bech32 Val: zetavaloper10r4ygmwhd5jyrfrve72u3vz0ujdr8lva0wh5rn | ||
``` | ||
|
||
A single account can be represented by a bech32 or a hex address. You don't need | ||
to "transfer tokens between `zeta***` and `0x***` addresses", because both | ||
addresses represent the same account with the same amount of tokens. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
|
||
# Querying Balances | ||
|
||
## Prerequisites | ||
|
||
This tutorial requires `zetacored` CLI to be installed. Please, check out the | ||
docs [on installing the CLI](/users/cli/setup). | ||
|
||
## Querying Balances | ||
|
||
To query accounts balances for the `alice` account, run the following command: | ||
|
||
``` | ||
zetacored q bank balances $(zetacored keys show alice -a) --node https://zetachain-athens.blockpi.network:443/rpc/v1/public | ||
``` | ||
|
||
Provide a valid node RPC URL with the `--node` flag. You can use one of the | ||
available RPCs [listed in the docs](/reference/api) labeled "Tendermint RPC". | ||
Please, note that you need to specify the port number in the URL. If the | ||
protocol scheme is `https://`, the port is 443, unless specified otherwise. | ||
|
||
```yml | ||
balances: | ||
- amount: "11345716912473012386685" | ||
denom: azeta | ||
``` | ||
The amount is in `azeta` units, which is the smallest unit. To convert it to | ||
ZETA, divide it by 10¹⁸. In the example above, the balance is approximately | ||
11345 ZETA. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# Delegating to a Validator | ||
|
||
## Prerequisites | ||
|
||
This tutorial requires `zetacored` CLI to be installed. Please, check out the | ||
docs [on installing the CLI](/users/cli/setup). | ||
|
||
## Delegating to a Validator | ||
|
||
ZetaChain is a proof of stake blockchain network. Validators are responsible for | ||
producing new blocks and securing the network. You can delegate your ZETA to a | ||
validator to participate in the network and earn rewards. | ||
|
||
You can find a list of validators on | ||
[ZetaScan](https://explorer.zetachain.com/validators), | ||
[Ping Pub](https://testnet.ping.pub/zetachain/staking), or any | ||
[other explorer](/reference/explorers). | ||
|
||
Choose the validator you want to delegate to based on their commission rate, | ||
uptime, how much voting power they have and other factors. It is generally a | ||
good idea to NOT delegate to validators that have the most voting power, this | ||
ensures that the network remains decentralized. | ||
|
||
Copy the validator's operator address from the explorer. The address should be | ||
prefixed with `zetavaloper`. | ||
|
||
Next, check your [account balance](/users/cli/balances) and decide on the amount | ||
you want to stake. | ||
|
||
Before delegating it's important to understand that your ZETA will be locked for | ||
a period of time. You will not be able to transfer or spend it. The amount of | ||
time it is locked for depends on the network parameters. You can check the | ||
parameters using the API: | ||
|
||
https://zetachain-athens.blockpi.network/lcd/v1/public/cosmos/staking/v1beta1/params | ||
|
||
Run the following command to delegate your ZETA to the validator: | ||
|
||
``` | ||
zetacored tx staking delegate zetavaloper167ns6zwczl9asjs47jwv3uhtkxfjcvx3fg3d4a 1000000000000000azeta --node https://zetachain-athens.blockpi.network:443/rpc/v1/public --from alice --chain-id athens_7001-1 | ||
``` | ||
|
||
- `zetavaloper167ns6zwczl9asjs47jwv3uhtkxfjcvx3fg3d4a` is the validator operator | ||
address | ||
- `1000000000000000azeta` is the amount (in this example, 0.001 ZETA) | ||
- `--node https://zetachain-athens.blockpi.network:443/rpc/v1/public` is the | ||
Tendermint RPC URL | ||
- `--from alice` is they account key name (see | ||
[Managing Accounts](/users/cli/account)) | ||
- `--chain-id athens_7001-1` is the chain ID of the ZetaChain testnet | ||
|
||
The terminal will ask you to confirm the transaction: | ||
|
||
``` | ||
auth_info: | ||
fee: | ||
amount: [] | ||
gas_limit: "200000" | ||
granter: "" | ||
payer: "" | ||
signer_infos: [] | ||
tip: null | ||
body: | ||
extension_options: [] | ||
memo: "" | ||
messages: | ||
- "@type": /cosmos.staking.v1beta1.MsgDelegate | ||
amount: | ||
amount: "1000" | ||
denom: azeta | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper167ns6zwczl9asjs47jwv3uhtkxfjcvx3fg3d4a | ||
non_critical_extension_options: [] | ||
timeout_height: "0" | ||
signatures: [] | ||
confirm transaction before signing and broadcasting [y/N]: y | ||
``` | ||
|
||
Type `y` and press Enter to confirm. | ||
|
||
``` | ||
code: 0 | ||
codespace: "" | ||
data: "" | ||
events: [] | ||
gas_used: "0" | ||
gas_wanted: "0" | ||
height: "0" | ||
info: "" | ||
logs: [] | ||
raw_log: '[]' | ||
timestamp: "" | ||
tx: null | ||
txhash: C86E7C0E98A16CA0EB63800DF6CBB80D492201E17AB57229790DCF3403B59D02 | ||
``` | ||
|
||
The transaction was successful. You can check your balance again to see that the | ||
amount has been deducted. | ||
|
||
You can also confirm the transaction on the explorer by searching for the | ||
transaction hash: | ||
|
||
https://testnet.ping.pub/zetachain/tx/C86E7C0E98A16CA0EB63800DF6CBB80D492201E17AB57229790DCF3403B59D02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Withdrawing Rewards | ||
|
||
## Prerequisites | ||
|
||
This tutorial requires `zetacored` CLI to be installed. Please, check out the | ||
docs [on installing the CLI](/users/cli/setup). | ||
|
||
## Calculating Rewards | ||
|
||
To calculate the rewards you have earned, you can use the following command: | ||
|
||
``` | ||
zetacored q distribution rewards $(zetacored keys show alice -a) --node https://zetachain-athens.blockpi.network:443/rpc/v1/public | ||
``` | ||
|
||
This command shows the rewards that you have earned from each validator: | ||
|
||
``` | ||
rewards: | ||
- reward: | ||
- amount: "674201594136.000000000000000000" | ||
denom: azeta | ||
validator_address: zetavaloper1qumrwnz9x2emzd5yjylp8pf9w2wh3my0gag27y | ||
- reward: | ||
- amount: "1597782052369.999999999999999999" | ||
denom: azeta | ||
validator_address: zetavaloper1pptfhnyj37qn0nfuhmu7m5ssy5x6td8hmccpzl | ||
- reward: | ||
- amount: "337307045870000.003493213123204105" | ||
denom: azeta | ||
validator_address: zetavaloper1ymnrwg9e3xr9xkw42ygzjx34dyvwvtc24ct0t5 | ||
- reward: | ||
- amount: "333720742599.014432608595395975" | ||
denom: azeta | ||
validator_address: zetavaloper1xkddnhcdy5j4auzefjqkt3kp56t6vq7sm5xlga | ||
- reward: | ||
- amount: "0.000063911026464599" | ||
denom: azeta | ||
validator_address: zetavaloper1ggqzjf5726uu7xc6pfwg00lny79w6t3a4unarz | ||
- reward: | ||
- amount: "32.761155900000000000" | ||
denom: azeta | ||
validator_address: zetavaloper1wwnug5n5e2s2sf0k7t4zcu7enlwj9vq0s09xlf | ||
- reward: | ||
- amount: "317101080947.999999999999999999" | ||
denom: azeta | ||
validator_address: zetavaloper10g9x93lw7hu0cey5fyvewm4lsnuhe8q3xzay7j | ||
- reward: | ||
- amount: "0.000343011411232999" | ||
denom: azeta | ||
validator_address: zetavaloper167ns6zwczl9asjs47jwv3uhtkxfjcvx3fg3d4a | ||
total: | ||
- amount: "340229851340085.779488644156297676" | ||
denom: azeta | ||
``` | ||
|
||
## Withdrawing Rewards | ||
|
||
To withdraw your rewards from all validators, run the following command: | ||
|
||
``` | ||
zetacored tx distribution withdraw-all-rewards --gas 5000000 --from alice --chain-id athens_7001-1 --node https://zetachain-athens.blockpi.network:443/rpc/v1/public | ||
``` | ||
|
||
Please, note that this command broadcasts a transaction with potentially | ||
multiple messages (one per validator). For the transaction to succeed, you may | ||
need to specify gas manually. In the example above, we are using | ||
`--gas 5000000`, but the actual amount of gas required may be different | ||
depending on network conditions. | ||
|
||
Confirm the transaction to withdraw your rewards: | ||
|
||
``` | ||
auth_info: | ||
fee: | ||
amount: [] | ||
gas_limit: "5000000" | ||
granter: "" | ||
payer: "" | ||
signer_infos: [] | ||
tip: null | ||
body: | ||
extension_options: [] | ||
memo: "" | ||
messages: | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper1qumrwnz9x2emzd5yjylp8pf9w2wh3my0gag27y | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper1pptfhnyj37qn0nfuhmu7m5ssy5x6td8hmccpzl | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper1ymnrwg9e3xr9xkw42ygzjx34dyvwvtc24ct0t5 | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper1xkddnhcdy5j4auzefjqkt3kp56t6vq7sm5xlga | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper1ggqzjf5726uu7xc6pfwg00lny79w6t3a4unarz | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper1wwnug5n5e2s2sf0k7t4zcu7enlwj9vq0s09xlf | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper10g9x93lw7hu0cey5fyvewm4lsnuhe8q3xzay7j | ||
- '@type': /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward | ||
delegator_address: zeta19nfaqu9wr0fktyyampva98ec025kjy0phww5um | ||
validator_address: zetavaloper167ns6zwczl9asjs47jwv3uhtkxfjcvx3fg3d4a | ||
non_critical_extension_options: [] | ||
timeout_height: "0" | ||
signatures: [] | ||
confirm transaction before signing and broadcasting [y/N]: y | ||
``` |
Oops, something went wrong.