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 utilityProvider-Services Commands
Below are links to the top level commands. Click one of the links to see the available commands.
provider-services add-genesis-account - Add a genesis account to genesis.json
provider-services auth-server - Run the authentication server to issue JWTs to tenants
provider-services collect-gentxs - Collect genesis txs and output a genesis.json file
provider-services debug - Tool for helping with debugging your application
provider-services events - Prints out nexqloud events in real time
provider-services hostname-operator - kubernetes operator interfacing with k8s nginx ingress
provider-services init - Initialize private validator, p2p, genesis, and application configuration files
provider-services ip-operator - kubernetes operator interfacing with Metal LB
provider-services keys - Manage your application's keys
provider-services lease-events - get lease events
provider-services lease-logs - get lease logs
provider-services lease-shell - do lease shell
provider-services lease-status - get lease status
provider-services migrate-endpoints - migrate endpoints between deployments on the same provider
provider-services migrate-hostnames - migrate hostnames between deployments on the same provider
provider-services node - operations with nexqloud RPC node
provider-services operator - kubernetes operators control
provider-services query - Querying subcommands
provider-services run - run nexqloud provider
provider-services run-resource-server - Run the resource server which authenticates tenants based on JWT before providing access to resources
provider-services send-manifest - Submit manifest to provider(s)
provider-services service-status - get service status
provider-services show-cluster-ns - print cluster namespace for given lease ID
provider-services status - get provider status
provider-services tx - Transactions subcommands
provider-services validate-genesis - validates the genesis file at the default location or at the location passed as an arg
provider-services version - Print the application binary version information
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 documentation for more information. As of January 2021, CosmJS documentation is still work in progress.
Please go through this code to sign a transaction using CosmJS javascript library.
Last updated