Skip to content

Working with a Peggy node CLI

Alexander Peters edited this page Sep 11, 2020 · 4 revisions

Working with a Peggy node/ CLI

This page contains some commands and queries that can become handy when testing or developing in the project.

🚧 This is all WIP. Commands and arguments may change 🚧

Start a local single node testnet

  • Create a new test key
# validator is the name of the key
peggycli keys add validator
  • Prepare validator node
# local is the moniker
peggyd init --chain-id=testing local
peggyd add-genesis-account validator 1000000000stake
peggyd gentx --name validator  --amount 1000000000stake
peggyd collect-gentxs
  • Start the server
peggyd start --rpc.laddr tcp://0.0.0.0:26657 --trace

Orchestrator: add an ETH key

  • Generate and print new ETH key to the console
peggycli tx peggy unsafe_testing gen_eth_key
  • Submit new eth key for orchestrator
# 0xb8662f35f9de8720424e82b232e8c98d15399490adae9ca993f5ef1dc4883690 is the key. NOTE the mandatory `0x` prefix
peggycli tx peggy update-eth-addr 0xb8662f35f9de8720424e82b232e8c98d15399490adae9ca993f5ef1dc4883690 --from validator  --chain-id=testing -b block -y

Orchestrator: update of the MultiSig Set for the current Validator Set

  • Create a request to start the process
peggycli tx peggy valset-request --from validator --chain-id=testing -b block -y
  • View the new request data
# nonce=height: 101
peggycli q peggy valset-request 101
  • Sign and confirm
# nonce=height: 101
peggycli tx peggy valset-confirm 101  0xb8662f35f9de8720424e82b232e8c98d15399490adae9ca993f5ef1dc4883690 --from validator  --chain-id=testing -b block -y
  • View confirmation data
# nonce=height: 101
peggycli q peggy valset-confirm 101 $(peggycli keys show validator -a) -o json

Other useful queries

  • Show current Orchestrator Set
peggycli q peggy current-valset
  • Show address of an cosmos key
peggycli keys show validator -a

REST Server (light-client daemon)

  • Start Server
peggycli rest-server --laddr tcp://0.0.0.0:1317 --trust-node

Manual query examples

  • Query current Orchestrator Set
curl http://localhost:1317/peggy/current_valset -H "Content-Type: application/json"
  • View request data for the MultiSig Set update
# nonce=height: 101
curl http://localhost:1317/peggy/valset_request/101  -H "Content-Type: application/json"
  • View signed update confirmation
# nonce=height: 101
# validatorAddress: cosmos12flmaejjvzdtz58s4m5avx30wm8uffe7ycj4l9
curl -X POST http://localhost:1317/peggy/query_valset_confirm  -H "Content-Type: application/json" -d '{"nonce":"101", "address":"cosmos12flmaejjvzdtz58s4m5avx30wm8uffe7ycj4l9"}'
Clone this wiki locally