-
Notifications
You must be signed in to change notification settings - Fork 36
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
Create validator wallet #481
Conversation
multiversx_sdk_cli/cli_wallet.py
Outdated
@@ -57,6 +75,12 @@ def setup_parser(args: List[str], subparsers: Any) -> Any: | |||
"new", | |||
"Create a new wallet and print its mnemonic; optionally save as password-protected JSON (recommended) or PEM (not recommended)", | |||
) | |||
sub.add_argument( | |||
"--validator-wallet", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether we should have a separate sub-command, instead.
E.g.
mxpy wallet ... (for user wallets)
mxpy validator-wallet ...
Especially since other sub-sub-commands of mxpy wallet
do not make sense for this kind of wallets (e.g. bech32, convert etc.). Actually, some convert functionality could be useful (e.g. PEM to raw hex), but, overall, maybe we can have them separately.
💭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a separate sub-command
multiversx_sdk_cli/sign_verify.py
Outdated
|
||
def sign_message_by_validator(message: str, validator: ValidatorSigner) -> SignedMessage: | ||
message_computer = MessageComputer() | ||
serialized_message = message_computer.compute_bytes_for_signing(Message(message.encode())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For validator wallets, this is not e regular use-case. In the few cases when validator wallets are required to sign a message, they sign the plain variant (raw bytes). Not this special enveloping:
As far as I know (see validators CLI of mxpy).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
sub.add_argument("--message", required=True, help="the message you want to sign") | ||
sub.add_argument("--pem", required=True, type=str, help="the path to a validator pem file") | ||
sub.add_argument( | ||
"--validator-index", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also be simply "index".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, fixed
) | ||
sub.add_argument("--infile", required=True, help="the pem file of the wallet") | ||
sub.add_argument( | ||
"--index", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Added functionality to create a validator wallet.
Also added functionality to sign a message using a validator wallet and to verify a messages using a bls validator pubkey.