Skip to content

Conversation

@juestr
Copy link
Contributor

@juestr juestr commented Jul 1, 2017

This adds command line parsing of message and key to the sign-message.py example:

$ ./sign-message.py -h                                                  (sign-message-cli|✔)
usage: sign-message.py [-h] [-v] -k KEY -m MSG

Sign a message with a private key.

optional arguments:
  -h, --help         show this help message and exit
  -v, --verbose      verbose output
  -k KEY, --key KEY  private key in base58 encoding
  -m MSG, --msg MSG  message to sign

Security warning: arguments may be visible to other users on the same host.

$ ./sign-message.py -m 'hello world' -k 'L4vB5fomsK8L95wQ7GFzvErYGht49JsCPJyJMHpB4xGM6xgi2jvG'
H5fuPQBm4Vmb5q19cbxgkH769SgSkotl9I+qGgKF3ytyE8L/rZgq3c1aYPY4wIAVNlzJ++T4+6WZlKO5diIukyY=

$ ./sign-message.py -v -m 'hello world' -k 'L4vB5fomsK8L95wQ7GFzvErYGht49JsCPJyJMHpB4xGM6xgi2jvG'
Address: 1F26pNMrywyZJdr22jErtKcjF8R3Ttt55G
Message: hello world
Signature: b'H6rxzfQC1l65vzDaGyqTkO5r7QQuwXfEocem7YYP6+3vdwUrs0fyJSfodeKyf61Z1V5Bqfstpt68aSty3rZgq7M='
Verified: True

To verify using bitcoin core:

`bitcoin-cli verifymessage 1F26pNMrywyZJdr22jErtKcjF8R3Ttt55G 'H6rxzfQC1l65vzDaGyqTkO5r7QQuwXfEocem7YYP6+3vdwUrs0fyJSfodeKyf61Z1V5Bqfstpt68aSty3rZgq7M=' 'hello world'`

@petertodd petertodd merged commit 29a0550 into petertodd:master Jul 21, 2017
petertodd added a commit that referenced this pull request Jul 21, 2017
29a0550 Add CLI argument parsing to sign-message.py example. (Jürgen Strobel)
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