BitcoinQnA / seedtool

GNU General Public License v3.0
74 stars 16 forks source link

[Feature request]: Bitcoin addresses resulting from private keys generated independently #36

Closed GregoryTrzonkowski closed 1 year ago

GregoryTrzonkowski commented 2 years ago

As a user, I want to input ECDSA private key in hex format and get the resulting bitcoin addresses so that they are independent from the implemented software libraries and sources of entropy.

Why is it important? To minimize users' dependence on tools, libraries etc. Users should be able to choose not to trust them and manually generate keys on their own (or import ones generated elsewhere). There is the risk that an auto-generated keys may follow a pattern that may be exploited (keys could be recreated easily and used to transfer bitcoins from an address). A pattern/vulnerability (bug in random key generation implementation) may be discovered in the future and affect keys/addresses generated in the past.

There is only "Enter your own entropy" input field in the tool in the 1.07 (current) version. Let's add a similar input field for ECDSA private key (in hex format), please.

SuperPhatArrow commented 2 years ago

Thanks for the feature request.

I will add this as well as Wallet Import Format (WIF) and xprv

SuperPhatArrow commented 2 years ago

@GregoryTrzonkowski I have just had the time to take a look at implementing this today but I am a little confused by your request.

As a user, I want to input ECDSA private key in hex format and get the resulting bitcoin addresses so that they are independent from the implemented software libraries and sources of entropy.

It sound like you wish to input an ECDSA private key in hex format (which is a 256 bit scalar) and generate an HD wallet from that, but in order to do that we need you to input the chain code too. Is this correct?

To minimize users' dependence on tools, libraries etc. Users should be able to choose not to trust them and manually generate keys on their own (or import ones generated elsewhere). There is the risk that an auto-generated keys may follow a pattern that may be exploited (keys could be recreated easily and used to transfer bitcoins from an address). A pattern/vulnerability (bug in random key generation implementation) may be discovered in the future and affect keys/addresses generated in the past.

But the confusing part seems to be that you worry about the security of the underlying cryptography of BIP32 and deriving child keys, is this correct? In that case, are you looking to input a private key (in hex format) and then generate the public key corresponding to that private key, and then generate the single bitcoin address of a given type for the key pair?

In summary:

  1. Given the user input of ONLY a "ECDSA private key (in hex format)", we compute a single bitcoin address for each address type.
  2. Given the user input of BOTH a "ECDSA private key (in hex format)" AND a chain code (256 bits of entropy) we can compute an HD wallet that can generate many accounts and addresses.

I am confused about which you are asking for?

GregoryTrzonkowski commented 2 years ago

I asked for the 1st one:

In summary:

  1. Given the user input of ONLY a "ECDSA private key (in hex format)", we compute a single bitcoin address for each address type.
SuperPhatArrow commented 2 years ago

I asked for the 1st one:

Understood, thanks for the clarification.