Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cosmos cli for low-level utility functionality #1595

Merged
merged 4 commits into from
Jan 13, 2020
Merged

Conversation

NicolasMahe
Copy link
Member

@NicolasMahe NicolasMahe commented Jan 13, 2020

Simplification and update version of PR #1552
closes #1563

To compile the 2 cli, run: make build-cmd-cosmos.
You should have the 2 new cli in the bin directory: mesg-cosmos and mesg-cosmos-daemon.

mesg-cosmos cli is a real client. It connects to tendermint using tendermint's rpc port. It can create transaction (transfers and other cool stuff) and publish them. It exposes all cosmos modules commands. It uses a local folder to keep configs (~/.mesg-cosmos-cli).

Cosmos Client

Usage:
  mesg-cosmos [command]

Available Commands:
  config      Create or query an application CLI configuration file
  help        Help about any command
  keys        Add or view local private keys
  query       Querying subcommands
  rest-server Start LCD (light-client daemon), a local REST server
  status      Query remote node for status
  tx          Transactions subcommands
  version     Print the app version

Flags:
      --chain-id string   Chain ID of tendermint node
  -e, --encoding string   Binary encoding (hex|b64|btc) (default "hex")
  -h, --help              help for mesg-cosmos
      --home string       directory for config and data (default "/Users/nico/.mesg-cosmos-cli")
  -o, --output string     Output format (text|json) (default "text")
      --trace             print out full stack trace on errors

Use "mesg-cosmos [command] --help" for more information about a command.

You can run a few commands to set its config and stop passing it as flags:

# Configure your CLI to eliminate need for chain-id flag
./bin/mesg-cosmos config chain-id mesg-dev-chain
./bin/mesg-cosmos config output json
./bin/mesg-cosmos config indent true
./bin/mesg-cosmos config trust-node true

mesg-cosmos-daemon is a cli for the "server" side. It can display some useful info about an existing tendermint node (node id, pubkey) and also it is used to create new genesis. I used it to create the testnet genesis. I will publish in the doc or blog a guide on how to create a new genesis.

ClI Daemon (server)

Usage:
  mesg-cosmos-daemon [command]

Available Commands:
  init                Initialize private validator, p2p, genesis, and application configuration files
  collect-gentxs      Collect genesis txs and output a genesis.json file
  gentx               Generate a genesis tx carrying a self delegation
  validate-genesis    validates the genesis file at the default location or at the location passed as an arg
  add-genesis-account Add genesis account to genesis.json
  start               Run the full node
  unsafe-reset-all    Resets the blockchain database, removes address book files, and resets priv_validator.json to the genesis state

  tendermint          Tendermint subcommands
  export              Export state to JSON

  version             Print the app version
  help                Help about any command

Flags:
  -h, --help               help for mesg-cosmos-daemon
      --home string        directory for config and data (default "/Users/nico/.mesg/tendermint")
      --log_level string   Log level (default "main:info,state:info,*:error")
      --trace              print out full stack trace on errors

Use "mesg-cosmos-daemon [command] --help" for more information about a command.

@NicolasMahe NicolasMahe requested a review from antho1404 January 13, 2020 04:39
@NicolasMahe NicolasMahe self-assigned this Jan 13, 2020
@NicolasMahe NicolasMahe added this to the next milestone Jan 13, 2020
@NicolasMahe NicolasMahe changed the title Feature/cosmos cli Add 2 cosmos cli Jan 13, 2020
if err != nil {
panic(err)
}
db, err := db.NewGoLevelDB("app", filepath.Join(cfg.Path, cfg.Cosmos.RelativePath))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if it can be bypass until the cosmos module refacto.

@antho1404 antho1404 merged commit 72e2214 into dev Jan 13, 2020
@antho1404 antho1404 deleted the feature/cosmos-cli branch January 13, 2020 09:34
@NicolasMahe NicolasMahe added the release:add Pull requests that add something label Jan 14, 2020
@NicolasMahe NicolasMahe changed the title Add 2 cosmos cli Add cosmos cli Jan 14, 2020
@NicolasMahe NicolasMahe changed the title Add cosmos cli Add cosmos cli for low-level utility functionality Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:add Pull requests that add something
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create the cosmos CLI
2 participants