Sign and verify message with bitcoin address and public key #183

pull khalahan wants to merge 0 commits into bitcoin:master from khalahan:signandverif changing 0 files +0 −0
  1. khalahan commented at 12:42 PM on April 24, 2011: none

    Adds two rpc commands :

    • signmessage <bitcoinaddress> <message>
    • verifymessage <pubkey> <sign> <message>

    It allows to sign a message with the public key of a bitcoin address you own, to be sure of the identity of the sender. Command : ./bitcoind signmessage 1L5zqFahc8Ahu9wtgJqCeJMendvD174xsG "Hi github users :p" Output : { "address" : "1L5zqFahc8Ahu9wtgJqCeJMendvD174xsG", "pubkey" : "04ef6e366cd6b0b8fbf02c0c25ad39fe892b90c597875899fdc9db16941cf43fb8c429e0534cb8b972f5cc9f1a50f36dc3352ffad427f073e1c64a145828a3be6e", "sign" : "3046022100a80b6e0c7c54c54ba943f4e3cde12f5a7dc5313e3f0a15ce868f01683ced64fa0221008b4ad7d3800a11c241dcef7aaf44c8224a7d9f1e54d3e669bf4887036b6d10af" }

    Command : ./bitcoind verifymessage <above pubkey> <above sign> "Hi github users :p" Output : { "address" : "1L5zqFahc8Ahu9wtgJqCeJMendvD174xsG", "pubkey" : "04ef6e366cd6b0b8fbf02c0c25ad39fe892b90c597875899fdc9db16941cf43fb8c429e0534cb8b972f5cc9f1a50f36dc3352ffad427f073e1c64a145828a3be6e" }

    Reviews and comments are welcomed, I don't know if all is used as it should.

    Forum thread : http://www.bitcoin.org/smf/index.php?topic=6428.0

    EDIT(alex): Sipa's revision references pull 183 - #524

  2. gavinandresen commented at 12:39 AM on April 25, 2011: contributor

    Can you start a forum thread about this? There was some concern about possible attacks revealing private keys if the attacker can send arbitrary data to be signed.

    Also some nits: indentation looks messed up on the git diff, and isn't there a better way to get a string into a vector<unsigned char> ?

  3. khalahan commented at 10:56 AM on April 25, 2011: none

    Forum thread is available here : http://www.bitcoin.org/smf/index.php?topic=6428.0

  4. gavinandresen commented at 3:24 PM on May 3, 2011: contributor

    Can you squash the 4 commits into one please? It'll make the commit history cleaner. (other than that, I agree this is a cool new feature and is ready to be pulled)

  5. jgarzik commented at 3:20 PM on May 5, 2011: contributor

    ACK, once rebased as Gavin requested

  6. gavinandresen commented at 5:04 PM on May 5, 2011: contributor

    Also: consensus on the forums seems to be that making the padding: address+padding+message ... wouldn't hurt.

  7. Sign and verify message with bitcoin address and public key
    Add padding to input (fixed string + address) before hashing
    efffd28162
  8. khalahan commented at 2:32 PM on May 6, 2011: none

    Here is the rebased commit plus address used as padding (cool feature the rebase/squash commands :p).

  9. amiryal commented at 4:15 PM on May 7, 2011: contributor

    Nice work, khalahan; thanks!

    I am not familiar with the JSON RPC protocol, so this may be a silly question: is it necessary for the server to echo some of the parameters back to the caller? (e.g. address when signing and pubkey when verifying.)

    $ bitcoind signmessage 1GsDU... hello { "address" : "1GsDU...", "pubkey" : "04c4...", "sign" : "3045..." } $ bitcoind verifymessage 04c4... 3045.... hello { "address" : "1GsDU...", "pubkey" : "04c4..." }

    Second question: why not use the address for verifying rather than the pubkey? Can the pubkey not be inferred from the address?

  10. sipa commented at 12:20 PM on May 8, 2011: member

    The pubkey can indeed not be inferred from the address. I suggested on the forum to encode the pubkey in the signature output, so the verifymessage interface can take an address. (see http://www.bitcoin.org/smf/index.php?topic=6428.msg108668#msg108668)

  11. khalahan commented at 8:47 AM on May 19, 2011: none

    amiryal > there is no real need to echo some of the input parameters.

    Should i remove duplicates ?

    sipa > i replied on the forum

  12. gmaxwell commented at 5:49 AM on July 22, 2011: contributor

    The pubkey can be inferred from the address plus the signature value, however.

  13. gavinandresen commented at 3:21 PM on August 9, 2011: contributor

    I resurrected discussion on forum thread: https://bitcointalk.org/index.php?topic=6428.msg443377#msg443377

  14. gavinandresen commented at 7:08 PM on September 29, 2011: contributor

    Closing, sipa has a more refined version.

  15. gavinandresen closed this on Sep 29, 2011

  16. dexX7 referenced this in commit 90e6ff4167 on Nov 24, 2014
  17. lateminer referenced this in commit 0f9c045097 on Dec 9, 2017
  18. attilaaf referenced this in commit 27cec02422 on Jan 13, 2020
  19. cryptapus referenced this in commit 8ae478af87 on Feb 28, 2020
  20. rajarshimaitra referenced this in commit 58f282ee38 on Aug 5, 2021
  21. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me