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

feat: add create-genesis-bls cmd #175

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

gitferry
Copy link
Contributor

This PR is to add gentx cmd, which generates a BLS key file that consists of {address, bls_pub_key, pop, pub_key}. An example of running this cmd is babylond gentx --home ./ where --home is optional and indicates the root path of babylond node with ~/. as the default value.

The pre-conditions of running this command are the existence of the node keyring, which can be generated via babylond init or babylond testnet, and the existence of the BLS key, which can be generated via babylond create-bls-key.

This command will produce a json file in [path-to-babylond]/config/gen-bls-[validator_address].json like the follows:

{
  "validator_address": "bbnvaloper1eppc73j56382wjn6nnq3quu5eye4pmm06uv5pk",
  "bls_key": {
    "pubkey": "gANrHkyFtbwTxvzR3qYxJ6k02sE1ffzN8qhA2GmEstlwptAmnDBtS1Amd9c6cq4vBWtMYaZeQdFmc+Vik8R5brM0HUC2EasVWvKyAUqe3fK6494xZZIcMyHSd+un7MhT",
    "pop": {
      "ed25519_sig": "rWBgzsgCVjFzAkgt0KPFGD+8NONwFYgn0XzI1TsvdhbFHO0dEMaXYhcMOBlAAUGcRdxkEaFdCp4QhKu7LWBQBg==",
      "bls_sig": "mQGCZ32N1+HKwaLLCZ5Bqs93269OILhutJYgoEG6FMCbGBr3tHJ7T/jg7ORWg2c+"
    }
  },
  "val_pubkey": {
    "key": "C4oza8JummU2nTlyp/qnohXmJws/yFzPVoPsldub0ag="
  }
}

@gitferry gitferry force-pushed the checkpointing/generate-genesis-bls-keys branch from 67412f2 to 23d003a Compare October 25, 2022 05:30
Copy link
Member

@vitsalis vitsalis left a comment

Choose a reason for hiding this comment

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

Amazing 👏

require.NoError(t, err)
require.Equal(t, sdk.ValAddress(addr).String(), genKey.ValidatorAddress)
require.True(t, filePV.Key.BlsPubKey.Equal(*genKey.BlsKey.Pubkey))
require.Equal(t, filePV.Key.PubKey.Bytes(), genKey.ValPubkey.Bytes())
Copy link
Member

Choose a reason for hiding this comment

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

Should we also verify that the POP is a valid one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice spot! I have added a Validate() method into GenesisKey and the method is called when GenesisKey is first loaded from the file.

@gitferry gitferry changed the title feat: add gentx cmd feat: add create-genesis-bls cmd Oct 25, 2022
@gitferry gitferry merged commit 1a66aa1 into main Oct 25, 2022
@gitferry gitferry deleted the checkpointing/generate-genesis-bls-keys branch October 25, 2022 12:50
gitferry added a commit that referenced this pull request Oct 25, 2022
vitsalis added a commit that referenced this pull request Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants