Interaction with the network: CLI‌

For more information on the command usage, refer to its help screen: panaceacli --help.

Here is a list of useful panaceacli commands, including usage examples.

Keys

Key Types

There are three types of key representations that are used:

  • panacea

    • Derived from account keys generated by panaceacli keys add

    • Used to receive funds

    • e.g. panacea17kmacx3czkdnhtfueqzzxk9xqzapj453f23m5a

  • panaceavaloper

    • Used to associate a validator to it's operator

    • Used to invoke staking commands

    • e.g. panaceavaloper17kmacx3czkdnhtfueqzzxk9xqzapj453wg3mgr

  • panaceapub

    • Derived from account keys generated by panaceacli keys add

    • e.g. panaceapub1addwnpepqwk3j2j3knuyah89skh8wtn5kr4qx32nhql6hzjadzmre2xlfmvxgy39ln8

  • panaceavalconspub

    • Generated when the node is created with panacead init.

    • Get this value with panacead tendermint show-validator

    • e.g. panaceavalconspub1zcjduepqktkqqsl9rchj77v9vg0crc87grp9h2u5ggpdtvcq74kxlr29lgwsa3dr66

Generate Keys

You'll need an account private and public key pair (a.k.a. sk, pk respectively) to be able to receive funds, send txs, bond tx, etc.

To generate a new secp256k1 key:

panaceacli keys add <account_name>

Next, you will have to create a passphrase to protect the key on disk. The output of the above command will contain a seed phrase. It is recommended to save the seed phrase in a safe place so that in case you forget the password, you could eventually regenerate the key from the seed phrase with the following command:

panaceacli keys add --recover

If you check your private keys, you'll now see <account_name>:

panaceacli keys show <account_name>

View the validator operator's address via:

panaceacli keys show <account_name> --bech=val

You can see all your available keys by typing:

panaceacli keys list

View the validator pubkey for your node by typing:

panacead 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 MediBloc team will not be responsible for the loss of funds. :::

Fees & Gas

Each transaction may either supply fees or gas prices, but not both. Most users will typically provide fees as this is the cost you will end up incurring for the transaction being included in the ledger.

Validator's have a minimum gas price configuration and they use this value when determining if they should include the transaction in a block during CheckTx, where gasPrices >= minGasPrices. Note, your transaction must supply fees that are greater than or equal to minimum fee which the validator requires.

Note: With such a mechanism in place, validators may start to prioritize txs by gasPrice in the mempool, so providing higher fees or gas prices may yield higher tx priority.

e.g.

panaceacli tx send ... --fees=1000000umed

or

panaceacli tx send ... --gas-prices=500.0umed

Account

Query Account balance

After receiving tokens to your address, you can view your account's balance by typing:

panaceacli query account <account_panacea>

::: warning Note When you query an account balance with zero tokens, you will get this error: account <account_panacea> does not exist. This can also happen if you fund the account before your node has fully synced with the chain. These are both normal.:::

Send Tokens

The following command could be used to send coins from one account to another:

panaceacli tx send \
--to <destination_panacea> \
--coins 10000000umed \
--chain-id=<chain_id> \
--from=<key_name> \

where destination_panacea is a key matching the format: panacea1y3mhszahwatjc3023datq46a0u2fv337tes4n9

::: warning Note The --amount flag accepts the format --amount=<value|coin_name>. :::

::: tip Note You may want to cap the maximum gas that can be consumed by the transaction via the --gas flag. If you pass --gas=auto, the gas supply will be automatically estimated before executing the transaction. Gas estimate might be inaccurate as state changes could occur in between the end of the simulation and the actual execution of a transaction, thus an adjustment is applied on top of the original estimate in order to ensure the transaction is broadcasted successfully. The adjustment can be controlled via the --gas-adjustment flag, whose default value is 1.0. :::

Now, view the updated balances of the origin and destination accounts:

panaceacli query account <account_panacea>
panaceacli query account <destination_panacea>

You can also check your balance at a given block by using the --block flag:

panaceacli query account <account_panacea> --block=<block_height>

You can simulate a transaction without actually broadcasting it by appending the --dry-run flag to the command line:

panaceacli tx send \
--to <destination_panacea> \
--coins 10000000umed \
--chain-id=<chain_id> \
--from=<key_name> \
--dry-run

Furthermore, you can build a transaction and print its JSON format to STDOUT by appending --generate-only to the list of the command line arguments:

panaceacli tx send \
--to <destination_panacea> \
--coins 10000000umed \
--chain-id=<chain_id> \
--from=<key_name> \
--generate-only > unsignedSendTx.json
panaceacli tx sign \
--chain-id=<chain_id> \
--from=<key_name> \
unsignedSendTx.json > signedSendTx.json

You can validate the transaction's signatures by typing the following:

panaceacli tx sign --validate-signatures signedSendTx.json

You can broadcast the signed transaction to a node by providing the JSON file to the following command:

panaceacli tx broadcast --node=<node> signedSendTx.json

Query Transactions

Matching a set of tags

You can use the transaction search command to query for transactions that match a specific set of tags, which are added on every transaction.

Each tag is conformed by a key-value pair in the form of <tag>:<value>. Tags can also be combined to query for a more specific result using the & symbol.

The command for querying transactions using a tag is the following:

panaceacli query txs --tags='<tag>:<value>'

And for using multiple tags:

panaceacli query txs --tags='<tag1>:<value1>&<tag2>:<value2>'

The pagination is supported as well via page and limit:

panaceacli query txs --tags='<tag>:<value>' --page=1 --limit=20

::: tip Note

The action tag always equals the message type returned by the Type() function of the relevant message.

You can find a list of available tags on each module by looking at the /tags directory of each module. :::

Matching a transaction's hash

You can also query a single transaction by its hash using the following command:

panaceacli query tx [hash]

Slashing

Unjailing

To unjail your jailed validator

panaceacli tx slashing unjail --from <validator-operator-addr>

Signing Info

To retrieve a validator's signing info:

panaceacli query slashing signing-info <validator-pubkey>

Query Parameters

You can get the current slashing parameters via:

panaceacli query slashing params

Staking

Create your validator

This guide assumes that you have already set up your full node by following the guide.

Your panaceavalconspub address (public key) can be used to create a new validator by staking tokens. You can find your validator public key by:

panacead tendermint show-validator

Execute the following command to create your validator:

Don't use more umed than you have!

panaceacli tx staking create-validator \
--pubkey=$(panacead tenderment show-validator) \
--moniker="choose a moniker" \
--chain-id=<chain-id> \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--amount=10000000umed \
--fees="1000000umed" \
--from=<key-name>
  • pubkey: A public key associated with the Tendermint private key (which was generated by panacead init).

    The public key can be resolved by panacead tendermint show-validator in the node that you want to make as a validator.

    For details about various key types, please see this guide.

  • moniker: A validator nickname that will be displayed publicly

  • commission-rate: An initial commission rate on block rewards and fees charged to delegators

  • commission-max-rate: A maximum commission rate which this validator can charge. This can be changed after the

    create-validator transaction is processed.

  • commission-max-change-rate: A maximum daily increase of the validator commission. This can be changed after the

    create-validator transaction is processed. This is used to measure % point change over the commision-rate.

    E.g. 1% to 2% is a 100% rate increase, but only 1% point.

  • min-self-delegation: A strictly positive integer that represents the minimum amount of self-delegated voting power

    your validator must always have. A min-self-delegation of 1 means your validator will never have a self-delegation

    lower than 1med (1000000umed).

  • amount: An amount of your self-delegation

You can confirm that you are in the validator set by the following command:

panaceacli query staking validators

Delegate to a Validator

You can delegate umed to a validator. These delegators can receive part of the validator's fee revenue.

Query Validators

You can query the list of all validators of a specific chain:

panaceacli query staking validators

If you want to get the information of a single validator you can check it with:

panaceacli query staking validator <account_panaceaval>

Bond Tokens

Here's how you can bond tokens to a validator (i.e. delegate):

panaceacli tx staking delegate \
<validator address> \
10000000umed \
--from=<key_name> \
--chain-id=<chain_id>

<validator> 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:

panaceacli keys show [name] --bech val

where [name] is the name of the key you specified when you initialized panacead.

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.

Query Delegations

Once submitted a delegation to a validator, you can see it's information by using the following command:

panaceacli query staking delegation <delegator_addr> <validator_addr>

Or if you want to check all your current delegations with distinct validators:

panaceacli query staking delegations <delegator_addr>

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.

panaceacli tx staking unbond \
<account_panaceaval> \
10000umed \
--from=<key_name> \
--chain-id=<chain_id>

The unbonding will be automatically completed when the unbonding period has passed.

Query Unbonding-Delegations

Once you begin an unbonding-delegation, you can see it's information by using the following command:

panaceacli query staking unbonding-delegation <delegator_addr> <validator_addr>

Or if you want to check all your current unbonding-delegations with disctinct validators:

panaceacli query staking unbonding-delegations <account_panacea>

Additionally, as you can get all the unbonding-delegations from a particular validator:

panaceacli query staking unbonding-delegations-from <account_panaceaval>

To get previous unbonding-delegation(s) status on past blocks, try adding the --height flag.

Redelegate Tokens

A redelegation is a type delegation that allows you to bond illiquid tokens from one validator to another:

panaceacli tx staking redelegate \
<src validator address> \
<dst validator address> \
10000umed \
--from=<key_name> \
--chain-id=<chain_id>

The redelegation will be automatically completed when the unbonding period has passed.

Query Redelegations

Once you begin an redelegation, you can see it's information by using the following command:

panaceacli query staking redelegation <delegator_addr> <src_val_addr> <dst_val_addr>

Or if you want to check all your current unbonding-delegations with disctinct validators:

panaceacli query staking redelegations <account_panacea>

Additionally, as you can get all the outgoing redelegations from a particular validator:

panaceacli query staking redelegations-from <account_panaceaval>

To get previous redelegation(s) status on past blocks, try adding the --height flag.

Query Parameters

Parameters define high level settings for staking. You can get the current values by using:

panaceacli query staking params

With the above command you will get the values for:

  • Unbonding time

  • Maximum numbers of validators

  • Maximum entries

  • Coin denomination for staking

Query Pool

A staking Pool defines the dynamic parameters of the current state. You can query them with the following command:

panaceacli query staking pool

With the pool command you will get the values for:

  • Not-bonded and bonded tokens

Fee Distribution

Query distribution parameters

To check the current distribution parameters, run:

panaceacli query distr params

Query validator commission

To check the current outstanding commission for a validator, run:

panaceacli query distr commission <validator_address>

Query validator slashes

To check historical slashes for a validator, run:

panaceacli query distr slashes <validator_address> <start_height> <end_height>

Query delegator rewards

To check current rewards for a delegation (were they to be withdrawn), run:

panaceacli query distr rewards <delegator_address> <validator_address>

Query all delegator rewards

To check all current rewards for a delegation (were they to be withdrawn), run:

panaceacli query distr rewards <delegator_address>

Multisig transactions

Multisig transactions require signatures of multiple private keys. Thus, generating and signing a transaction from a multisig account involve cooperation among the parties involved. A multisig transaction can be initiated by any of the key holders, and at least one of them would need to import other parties' public keys into their Keybase and generate a multisig public key in order to finalize and broadcast the transaction.

For example, given a multisig key comprising the keys p1, p2, and p3, each of which is held by a distinct party, the user holding p1 would require to import both p2 and p3 in order to generate the multisig account public key:

panaceacli keys add \
p2 \
--pubkey=panaceapub1addwnpepqwk3j2j3knuyah89skh8wtn5kr4qx32nhql6hzjadzmre2xlfmvxgy39ln8
panaceacli keys add \
p3 \
--pubkey=panaceapub1addwnpepqvr594kcrv7y43l5laqtyxzg7s7f5ma9fvm6gjwsf3pp86j3wln676hwndf
panaceacli keys add \
p1p2p3 \
--multisig-threshold=2 \
--multisig=p1,p2,p3

A new multisig public key p1p2p3 has been stored, and its address will be used as signer of multisig transactions:

panaceacli keys show --address p1p2p3

You may also view multisig threshold, pubkey constituents and respective weights by viewing the JSON output of the key or passing the --show-multisig flag:

panaceacli keys show p1p2p3 -o json
panaceacli keys show p1p2p3 --show-multisig

The first step to create a multisig transaction is to initiate it on behalf of the multisig address created above:

panaceacli tx send panacea1ynkxl2d9yj9hh5jxt3m9s8nljh507tm5u66swq 10umed \
--from=<multisig_address> \
--generate-only > unsignedTx.json

The file unsignedTx.json contains the unsigned transaction encoded in JSON. p1 can now sign the transaction with its own private key:

panaceacli tx sign \
unsignedTx.json \
--multisig=<multisig_address> \
--from=p1 \
--output-document=p1signature.json \
--chain-id=<chain_id>

Once the signature is generated, p1 transmits both unsignedTx.json and p1signature.json to p2 or p3, which in turn will generate their respective signature:

panaceacli tx sign \
unsignedTx.json \
--multisig=<multisig_address> \
--from=p2 \
--output-document=p2signature.json \
--chain-id=<chain_id>

p1p2p3 is a 2-of-3 multisig key, therefore one additional signature is sufficient. Any the key holders can now generate the multisig transaction by combining the required signature files:

panaceacli tx multisign \
unsignedTx.json \
p1p2p3 \
p1signature.json p2signature.json \
--output-document=signedTx.json \
--chain-id=<chain_id>

The transaction can now be sent to the node:

panaceacli tx broadcast signedTx.json \
--chain-id=<chain_id>

Shells completion scripts

Completion scripts for popular UNIX shell interpreters such as Bash and Zsh can be generated through the completion command, which is available for both panacead and panaceacli.

If you want to generate Bash completion scripts run the following command:

panacead completion > panacead_completion
panaceacli completion > panaceacli_completion

If you want to generate Zsh completion scripts run the following command:

panacead completion --zsh > panacead_completion
panaceacli completion --zsh > panaceacli_completion

::: tip Note On most UNIX systems, such scripts may be loaded in .bashrc or .bash_profile to enable Bash autocompletion:

echo '. panacead_completion' >> ~/.bashrc
echo '. panaceacli_completion' >> ~/.bashrc

Refer to the user's manual of your interpreter provided by your operating system for information on how to enable shell autocompletion. :::

AOL

Create Topic

You can create topic with this:

panaceacli tx aol create-topic <topic>

List Topics

You can query the list of topics belong to specific account:

panaceacli query aol list-topics <owner_panacea>

You can get the detail information of the topic with this:

panaceacli query aol get-topic <owner_panacea> <topic>

Add Writer

You can add writer to the specific topic. the list of all validators of a specific chain:

panaceacli tx aol add-writer <topic> <writer_panacea>

::: tip Note that the topic owner is not a writer as default. You need to add your self to the topic as a writer. :::

List Writers

You can query the list of writers to the topic:

panaceacli query aol list-writers <owner_panacea> <topic>

You can get the detail information of the writer with this:

panaceacli query aol get-writer <owner_panacea> <topic> <writer_panacea>

where [name] is the name of the key you specified when you initialized panacead.

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.

Delete Writer

Owner can delete writer from the topic. After owner delete the writer, writer can not add record to the topic anymore.

panaceacli tx aol delete-writer <topic> <writer_panacea>

::: Note that only owner can delete writer from the topic :::

Add Record

Writer can add record to the topic with this:

panaceacli tx aol add-record <owner_panacea> <topic> <key> <value>

Get Record

You can query the record with this:

panaceacli query aol get-record <owner_panacea> <topic> <offset>

DID

Create(Issue) a DID

panaceacli tx did create-did --chain-id=<chain-id> --from=<address>

This doesn't require any parameter except chain-id and from. That is, it generates a Secp256k1 key-pair and derive a DID and a DID Document. The DID Document is stored in Panacea.

To store the key-pair safely in your local, the command will prompt you to enter a passphrase. The encrypted key-pair file will be stored in your ~/.panaceacli/did_keystore directory.

Resolve a DID

panaceacli query did get-did <did> --chain-id=<chain-id>

This returns a DID Document in JSON corresponding to that DID. If the DID doesn't exist, or was already deactivated, an error will be returned.

Update a DID

panaceaacli tx did update-did <did> <key-id> <did-doc-path> --chain-id=<chain-id> --from=<address>

A DID Document will be replaced to the new one written in a JSON file: <did-doc-path>. To prove that you are the DID owner, you must pass a <key-id> that is one of verificationMethods in the DID Document. Also, that command will prompt you to enter a passphrase of that key if the key-pair is stored in your keystore: ~/.panaceacli/did_keystore. The key-pair will be used to make a signature so that Panacea can verify that you are the DID owner.

Deactivate a DID

panaceacli tx did deactivate-did <did> <key-id> --chain-id=<chain-id> --from=<address>

Like updating a DID, a <key-id> must be specified and the corresponding key-pair should be used to make a signature so that Panacea can verify that you are the DID owner.

Deactivating a DID is not the same as deleting a DID. DIDs cannot be deleted permanently. They can just be deactivated. And DIDs cannot be reused to create another DID Documents forever.

Token

Issue a new token

A new token can be issued by the following command. Anyone can issue a new token with fee paid. After issuing, the token would appear in the issuer's account.

The symbol doesn't have to be unique. - followed by random 3 letters will be appended to the provided symbol to avoid uniqueness constraint. Those 3 letters are the first three letters of the Tx hash of the issue transaction. The generated symbol will be returned as a Tx response.

For more details of each parameter, please see the Token specification.

# Note that the total supply must be in micro unit without a denomination.
panaceacli tx token issue \
"my token" \
KAI \
1000000000 \
--mintable \
--from panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc \
--chain-id testing

Query a token

# List all token symbols
$ panaceacli query token list-tokens --chain-id testing
- KAI-0C5
- KAI-0EA
# Query a token
$ panaceacli query token get-token KAI-0EA
name: my secret token
symbol: KAI-0EA
totalsupply:
denom: ukai0ea
amount: "1000000000"
mintable: true
owneraddress: panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc

Query account balances and send tokens

Of course, the new token is visible in the account balance.

$ panaceacli query account panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc
address: panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc
coins:
- denom: ukai0c5
amount: "1000000000"
- denom: ukai0ea
amount: "999999900"
- denom: ukai62e
amount: "1000000000"
- denom: umed
amount: "99000000000000"
pubkey: panaceapub1addwnpepqf2m7rxgazcem4e6x4hjnwexeagrqjfdlkvz65e0jpxv5sn76jurgpqmpd5
accountnumber: 0
sequence: 6

Also, the new token can be sent to other accounts. Note that the amount must be specified with the micro-denomination that contains the 3-letter suffix (without -).

panaceacli tx send <from-address> <to-address> 1000000ukai0ea