Repository navigation
Conversation
Add the signrawtransactionwithkey command and its result to btcjson, and SignRawTransactionWithKey to rpcclient so callers can sign with their own WIF keys against bitcoind without loading a wallet. The client has a single method that takes the keys, the optional previous outputs and the optional signature hash type, instead of three numbered variants. When only the hash type is set, an empty prevtxs list is sent because the parameters are positional. This continues btcsuite#1885, rebased onto master with the review on it applied. Co-authored-by: galileo-pkm <8114900+galileo-pkm@users.noreply.github.com>
|
Thanks for taking a look. I agree btcd itself has no wallet.
That said, I'll go with whatever the maintainers prefer here. @guggero, would you take this in |
allocz
left a comment
There was a problem hiding this comment.
Don't you think that is better to use a function call instead of network call to do this kind of operation? I don't like the idea of incentivizing users to send private keys over network calls.
|
That's a fair concern. The keys do go over the RPC connection here, but that's already true for I agree local signing is the better choice when the caller holds the keys, so I added a note to the |
Change Description
This adds
signrawtransactionwithkeytobtcjsonandSignRawTransactionWithKeytorpcclient. With it, a caller can sign a raw transaction against bitcoind using its own WIF keys, without loading a wallet.It continues #1885 by @galileo-pkm, who said there that they couldn't keep working on it and invited someone to take it over. Their commit is credited with a
Co-authored-bytrailer. Compared with #1885:SignRawTransactionWithKey(tx, privKeysWIF, inputs, hashType)instead of three numbered variants. A nilinputsand an emptyhashTypeleave those parameters out. When only the hash type is set, an emptyprevtxslist is sent, because the parameters are positional.PrivKeysis a required[]stringrather than an optional pointer, since bitcoind requires the key list.Steps to Test
TestWalletSvrCmdshas new cases for the command with keys only, with previous outputs, and with an empty input list plus a hash type.TestSignRawTransactionWithKeychecks which optional parameters the client sends in each case and that the result is decoded.Pull Request Checklist
Testing
Code Style and Documentation