sedaprotocol / seda-chain

SEDA chain network
GNU General Public License v3.0
17 stars 9 forks source link

feat: Add SEDA Keys #320

Closed hacheigriega closed 1 month ago

hacheigriega commented 1 month ago

Explanation of Changes

This PR adds the last component of the pubkey module, the SEDA keys. This implements a CLI command for generating a set of SEDA keys and publishing their public keys on chain. Each of the SEDA keys are generated from a random seed, and they are stored in a single key file seda_keys.json under the same directory where the consensus private key is saved to. This means that, if any of the keys is lost, the user must re-generate and rotate all of his or her SEDA keys.

To generate the SEDA keys and register their public keys on chain, run:

$ sedad tx pubkey add-seda-keys --from satoshi --keyring-backend test --fees 10000000000000000aseda --gas auto --gas-adjustment 1.5

To query the validator's list of SEDA public keys:

$ sedad query pubkey validator-keys sedavaloper1nsnv4g2ejq36asujaettw4ge73pzzpjf86208z
validator_pub_keys:
  indexed_pub_keys:
  - index: 0
    pub_key:
      '@type': /cosmos.crypto.secp256k1.PubKey
      key: A7G7jKH0nldfGvWcLf+KudfJha4iYr4Gq5PRAXvnqVZA
  validator_addr: sedavaloper1nsnv4g2ejq36asujaettw4ge73pzzpjf86208z1000000 10000000000aseda                                                  

When the SEDA Protocol requires a new key to be registered on chain, the add-key command would be updated to generate the new key at some unused index.

Related PRs and Issues

TODO

Closes #162

hacheigriega commented 1 month ago

Thanks for the reviews.. I will address them after fixing the JSON unmarshalling issue I found while adding CLI tests.

hacheigriega commented 1 month ago

Done but there is a gas estimation issue to be addressed in a separate PR (See Issue #341)