githubEdit

CLI Commands

The client used to interact with the Nexqloud network is currently distributed in the provider-services Command Line Interface (CLI) application.

The Nexqloud CLI

The Nexqloud command line utility

 provider-services -h, --help   help for command line utility

Provider-Services Commands

Below are links to the top level commands. Click one of the links to see the available commands.

Common Command Usage and Examples

Send Tokens

Sign and send tokens to other account.

Usage

Example

More info

Query Transaction

Query for a transaction by hash in a committed block.

Usage

Examples

More info

Bond(Stake) Tokens

Delegate some tokens to validator i.e., bonding tokens.

Usage

Example

More info

Redelegate Tokens

Redelegate some tokens from one validator to another.

Usage

Example

More info

Undelegate(unbond) Tokens

Undelegate some tokens from validator i.e., unbonding tokens.

Usage

Example

More info

Withdraw Rewards

Withdraw rewards from validator

Usage

Example

More info

Query Rewards

Query all rewards earned by a delegator, optionally restrict to rewards from a single validator.

Usage

Examples

More info

Query Balance

Query the total balance of an account or of a specific denomination.

Usage

Examples

More info

Recover Key

Provide seed phrase to recover existing key instead of creating.

Usage

Example

Export Key

Export a private key from the local keybase in ASCII-armored encrypted format. Export key with entering new password.

Usage

Example

Import Key

Import a file with ASCII armored private key into the local keybase. Required key password to import key.

Usage

Example

Generating a Transaction

Generating a transaction can simply be done by appending the --generate-only flag on any tx command

Example

This will output the unsigned transaction as JSON in the console. We can also save the unsigned transaction to a file by appending > unsigned_tx.json to the above command.

Signing a Transaction

Signing a transaction using the CLI requires the unsigned transaction to be saved in a file.

This command will decode the unsigned transaction and sign it with SIGN_MODE_DIRECT with alice's key, which we already set up in the keyring. The signed transaction will be output as JSON to the console, and we can save it to a file by appending > signed_tx.json.

More Info

Some useful flags to consider in the tx sign command:

  • --sign-mode: you may use amino-json to sign the transaction using SIGN_MODE_LEGACY_AMINO_JSON

  • --offline: sign in offline mode. This means that the tx sign command doesn't connect to the node to retrieve the signer's account number and sequence, both needed for signing. In this case, you must manually supply the --account-number and --sequence flags. This is useful for offline signing, i.e. signing in a secure environment which doesn't have access to the internet.

Encode a Transaction

Encode transactions created with the --generate-only flag and signed with the sign command. It will read a transaction from , serialize it to the Amino wire protocol, and output it as base64. If you supply a dash (-) argument in place of an input filename, the command reads from standard input.

More Info

Broadcasting a Transaction (CLI)

Broadcasting a transaction using the CLI requires the signed transaction to be saved in a file.

You may optionally pass the --broadcast-mode flag to specify which response to receive from the node:

  • block: the CLI waits for the tx to be committed in a block.

  • sync: the CLI waits for a CheckTx execution response only.

  • async: the CLI returns immediately (transaction might fail).

More info

Broadcasting a Transaction (REST)

Broadcasting a transaction using the REST endpoint (served by gRPC-gateway) can be done by sending a POST request as follows, where the txBytes are the protobuf-encoded bytes of a signed transaction:

Here, tx_bytes value will be encoded tx of signed transaction.

Example

Using CosmJS (JavaScript & TypeScript)

CosmJS aims to build client libraries in JavaScript that can be embedded in web applications. Please see CosmJS documentationarrow-up-right for more information. As of January 2021, CosmJS documentation is still work in progress.

Please go through this codearrow-up-right to sign a transaction using CosmJS javascript library.

Last updated