optionally provide privkey to signmessage RPC #7899

pull dooglus wants to merge 1 commits into bitcoin:master from dooglus:signmessage-using-privkey changing 1 files +20 −4
  1. dooglus commented at 9:36 PM on April 16, 2016: contributor

    Add an optional 3rd parameter to signmessage to allow the user to specify the private key to use for signing the message.

  2. Add an optional 3rd parameter to signmessage to allow the user to specify the private key to use for signing the message. d165af9454
  3. promag commented at 10:12 PM on April 16, 2016: member

    Commit message too long.

  4. kazcw commented at 11:02 PM on April 16, 2016: contributor

    Concept ACK.

    Why require an address? What's the temporary keystore for?

  5. dooglus commented at 11:22 PM on April 16, 2016: contributor

    It always required an address. I guess it could accept a private key in place of the address - is that what you're getting at?

    The temporary keystore is for holding the supplied private key, much like the one in rpc/rawtransaction.cpp's signrawtransaction code.

  6. sipa commented at 11:28 PM on April 16, 2016: member

    This seems like a useful function to have, but I prefer having separate functions for wallet-dependent rpcs and utility rpcs that get fed all their arguments.

    Also, would it suffice to add this to bitcoin-tx instead?

  7. dooglus commented at 11:54 PM on April 16, 2016: contributor

    So would you prefer a new RPC, signmessagewithprivkey or similar, and have the existing signmessage left as it is?

    This it the first I have heard of bitcoin-tx. A quick look at it suggests it is for creating and working with raw transactions, whereas this PR is about signing messages.

    Having said that, I don't mind where it is added. I just want a way of signing a message with a private key not in my wallet that doesn't require me to shut down bitcoind, move the wallet.dat out of the way, restart it, import the private key into a new wallet, sign the message, shut down bitcoind again, delete the temporary wallet, move the original wallet back and restart bitcoind again. Because that's kind of long-winded.

  8. paveljanik commented at 7:01 AM on April 17, 2016: contributor

    And what about new utility bitcoin-msg?

  9. jonasschnelli added the label RPC/REST/ZMQ on Apr 17, 2016
  10. jonasschnelli commented at 7:42 AM on April 17, 2016: contributor

    Agree with @sipa. Signing a message with a provided private-key is pure utility. The only dependencies you need are libsecp256k1, some entropy source and sh256. Not sure where it would fit best (bitcoin-msg sounds good but maybe there is something more generic).

  11. sipa commented at 7:52 AM on April 17, 2016: member

    Signing does not need an entropy source.

  12. jonasschnelli commented at 9:25 AM on April 17, 2016: contributor

    @sipa: how would you then randomize the context (like secp256k1_context_randomize()) https://github.com/bitcoin/secp256k1/blob/master/include/secp256k1.h#L558 ?

  13. laanwj commented at 11:15 AM on April 17, 2016: member

    Concept ACK, however: please add a new method to sign message without wallet (thus providing the key), don't add another optional-wallet RPC call, or optional argument to signmessage. One near-future goal is to get rid of #ifdef ENABLE_WALLETs, to prevent circular dependencies and make the wallet a better isolated unit. @jonasschnelli

    @sipa: how would you then randomize the context (like secp256k1_context_randomize()) https://github.com/bitcoin/secp256k1/blob/master/include/secp256k1.h#L558 ?

    Signing is deterministic as of #5227, so there is no randomness needed for signing. If there is some implementation problem with secp256k1 that (due to context dependencies) requires it that should probably be solved there.

  14. btcdrak commented at 1:03 PM on April 17, 2016: contributor

    A separate bitcoin-msg seems a bit excessive.

  15. laanwj commented at 1:48 PM on April 19, 2016: member

    A separate bitcoin-msg seems a bit excessive.

    Agreed. Mind that we're using (pseudo-)static linking, so every new executable adds a hefty size to the archives. Let's just add a wallet-independent RPC call for signing messages. verifymessage in rpcmisc.cpp doesn't depend on the wallet either, so you could add it below that.

  16. laanwj commented at 2:31 PM on April 26, 2016: member

    So, to summarize, the current approach is not mergable as it doesn't change the dependency on the wallet.

    Good options would be:

    • Adding message signing/verification functionality to bitcoin-tx
    • Adding a new RPC signmessagewithprivkey or similar (non-dependent on the wallet)

    Bad options are:

    • A separate bitcoin-msg utility. This is overkill. @dooglus Are you going to move this forward, or would it be better to close and wait for someone else to pick it up?
  17. laanwj commented at 11:59 AM on April 27, 2016: member

    Closing in favor of #7953

  18. laanwj closed this on Apr 27, 2016

  19. MarcoFalke 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 15:15 UTC

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