Add an optional 3rd parameter to signmessage to allow the user to specify the private key to use for signing the message.
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-
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. d165af9454
-
promag commented at 10:12 PM on April 16, 2016: member
Commit message too long.
-
kazcw commented at 11:02 PM on April 16, 2016: contributor
Concept ACK.
Why require an address? What's the temporary keystore for?
-
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.
-
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?
-
dooglus commented at 11:54 PM on April 16, 2016: contributor
So would you prefer a new RPC,
signmessagewithprivkeyor similar, and have the existingsignmessageleft 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.
-
paveljanik commented at 7:01 AM on April 17, 2016: contributor
And what about new utility
bitcoin-msg? - jonasschnelli added the label RPC/REST/ZMQ on Apr 17, 2016
-
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-msgsounds good but maybe there is something more generic). -
sipa commented at 7:52 AM on April 17, 2016: member
Signing does not need an entropy source.
-
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 ? -
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.
-
btcdrak commented at 1:03 PM on April 17, 2016: contributor
A separate
bitcoin-msgseems a bit excessive. -
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.
verifymessageinrpcmisc.cppdoesn't depend on the wallet either, so you could add it below that. -
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
signmessagewithprivkeyor similar (non-dependent on the wallet)
Bad options are:
- A separate
bitcoin-msgutility. 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?
- Adding message signing/verification functionality to
- laanwj closed this on Apr 27, 2016
- MarcoFalke locked this on Sep 8, 2021