-
Notifications
You must be signed in to change notification settings - Fork 38.1k
Add 'hdderive' RPC, a generic BIP32 calculator #3520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is pretty stateless. What do you think of making/using a shared library with stuff like this? |
I'm sure tons of such libraries already exist. |
You're right of course, but it's pretty nice to have this available in the client (perhaps mostly inside the GUI; for RPC you can use a python library or something easily too), and the code is already there. |
Edit: I take back my recommendation to not merge. The point about confusion still stands, the solution may be just to document better that this is not part of wallet functionality: Also offering per-key functionality unrelated to the wallet is bound to confuse people with the current wallet. People will try to use this, then possibly importprivkey, then forget about change addresses that still get generated the random way. |
Three points from discussing this in #bitcoin-dev:
|
I think this is more appropriate outside bitcoind, in an in-tree utility. PR #4332 adds the "bitcoin-tx" utility. I was also thinking about adding simple "bitcoin-script" and "bitcoin-key" utilities along similar lines. hdderive would find a perfect home among such utilities. In general, I would prefer to move all "utility RPCs" completely outside bitcoind. e.g. with #4332 we can eliminate "createrawtransaction", "decoderawtransaction" and other RPCs that touch neither wallet nor blockchain. |
Agree. |
Agree @jgarzik |
Automatic sanity-testing: FAILED MERGE, see http://jenkins.bluematt.me/pull-tester/p3520_5e447ad9b71a2b40431acc0f99967ba14b014cb5/ for test log. This pull does not merge cleanly onto current master |
Closing this, with the presumption that a similar feature will be added to a utility like bitcoin-tx (and a PR opened for that at that time) |
This adds a 'hdderive' RPC command, which allows arbitrary BIP32 chains/addresses to be computed.
It supports starting from a seed, or from an xpub/xprv specification, and computes for the provided root or any derivation thereof the depth, index, chaincode, public key, address, fingerprint, parent fingerprint, private key, extended public key, and extended private key.
Note that this does not add HD functionality to the wallet itself.