Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: trior on April 11, 2014, 09:56:24 AM



Title: Multiple public adresses for one private key?
Post by: trior on April 11, 2014, 09:56:24 AM


Is it possible to have multiple public addresses for one private key?
If yes how to do it ?

Tanks !!


Title: Re: Multiple public adresses for one private key?
Post by: Chrithu on April 11, 2014, 10:30:38 AM
I am pretty sure that's impossible.

My understanding is the public key is calculated from the private key in a unique fashion.


Title: Re: Multiple public adresses for one private key?
Post by: cr1776 on April 11, 2014, 10:39:56 AM


Is it possible to have multiple public addresses for one private key?
If yes how to do it ?

Tanks !!

The reverse question is a different matter.


Title: Re: Multiple public adresses for one private key?
Post by: Light on April 11, 2014, 10:50:06 AM
I am pretty sure that's impossible.

My understanding is the public key is calculated from the private key in a unique fashion.

Correct, Bitcoin's current implementation means that it is impossible for you to have more than a single public key from each of your private keys. Mathematically, I believe you might be able to - but this has been addressed by the way Bitcoin has been coded.


Title: Re: Multiple public adresses for one private key?
Post by: DannyHamilton on April 11, 2014, 02:34:26 PM
The private key in Wallet Import Format (WIF) as most of us are used to seeing it actually has 3 important parts.

https://en.bitcoin.it/wiki/Wallet_import_format

  • (1 byte) A version number.
  • (32 bytes) The ECDSA private key.
  • (4 bytes) A checksum.

By changing the version number, you can generate different bitcoin addresses (one for an uncompressed public key, and the other for a compressed public key) with the same ECDSA private key.  This will result in a different WIF (both the version number and the checksum will be affected) for that private key though, so when viewed in the typical format it will appear to be a different private key.



Title: Re: Multiple public adresses for one private key?
Post by: Abdussamad on April 11, 2014, 05:11:20 PM


Is it possible to have multiple public addresses for one private key?
If yes how to do it ?

Tanks !!

If I were to stretch things a little I could say that a deterministic wallet is an example of unlimited addresses derived from a single private key. That private key is called a seed. Examples of deterministic wallets are electrum and armory. Try them out if you want to see it in action.


Title: Re: Multiple public adresses for one private key?
Post by: cp1 on April 12, 2014, 02:08:52 AM
Stealth addresses are similar too.


Title: Re: Multiple public adresses for one private key?
Post by: dowsey14 on April 14, 2014, 05:54:41 AM
No, you cannot have multiple public addresses from a single private key.

However, over 28 million private keys can produce the same bitcoin address. Seriously.

However, the chance of every producing a collision is so astronomically rare that you would have to be bitten by a shark, hit by a bus, shot by a gunman, struck by lightning and win the lottery all within a single day.

Trying to get a collision? Forget it, it's virtually impossible!


Title: Re: Multiple public adresses for one private key?
Post by: mintodev on April 14, 2014, 07:11:29 AM
No, it is not possible.

One private key has one public key. So each address has only one private key.


Title: Re: Multiple public adresses for one private key?
Post by: dowsey14 on April 14, 2014, 09:55:46 AM
No, it is not possible.

One private key has one public key. So each address has only one private key.

Ok. I stand corrected. I previously thought that you could have lots of private keys hashing to a single bitcoin address, but that collisions would still be so rare as to render that non-problematic.

The thing that I find interesting is that a private key is enormous compared to the size of a bitcoin address, leading me to believe that it would be possible to hash multiple private keys to the same bitcoin address.


Title: Re: Multiple public adresses for one private key?
Post by: DannyHamilton on April 14, 2014, 01:40:05 PM
No, it is not possible.

One private key has one public key. So each address has only one private key.

Ok. I stand corrected. I previously thought that you could have lots of private keys hashing to a single bitcoin address, but that collisions would still be so rare as to render that non-problematic.

The thing that I find interesting is that a private key is enormous compared to the size of a bitcoin address, leading me to believe that it would be possible to hash multiple private keys to the same bitcoin address.

You are correct.  There are potentially nearly 2256 public keys, and there can't be more than 2160 bitcoin addresses.  Therefore, there are likely to be multiple public keys (and therefore multiple private keys) that all result in the same bitcoin address.  Fortunately, there is no known way to find these additional keys that result in the same address.


Title: Re: Multiple public adresses for one private key?
Post by: cp1 on April 14, 2014, 01:49:09 PM
As far as I know:

Private ECDSA key:  256 bits
generate public key from that:  2 32 byte numbers
SHA-256 hash of public key:  256 bits
RIPEMD-160 hash of that:  160 bits
SHA-256 hash that twice and encode in base 58 to get your address.

Throw in some checksums and magic numbers along the way.


Title: Re: Multiple public adresses for one private key?
Post by: DannyHamilton on April 14, 2014, 02:01:08 PM
As far as I know:

Private ECDSA key:  256 bits
generate public key from that:  2 32 byte numbers
SHA-256 hash of public key:  256 bits
RIPEMD-160 hash of that:  160 bits
SHA-256 hash that twice and encode in base 58 to get your address.

Throw in some checksums and magic numbers along the way.

The double SHA-256 is for the checksum.  That and the version number are both part of Base58check encoding.

  • Private key:(256 bits)
  • ECDSA public key from that: two 32 bit numbers (512 bits), or one 32 bit number (256 bits) for compressed key
  • SHA-256 hash of public key: 256 bits
  • RIPEMD-160 hash of that: 160 bits
  • Encode in Base58check (Add version byte in front, checksum behind, and encode with special base 58 rules)


Title: Re: Multiple public adresses for one private key?
Post by: kittucrypt on April 14, 2014, 06:12:11 PM
The private key in Wallet Import Format (WIF) as most of us are used to seeing it actually has 3 important parts.

https://en.bitcoin.it/wiki/Wallet_import_format

  • (1 byte) A version number.
  • (32 bytes) The ECDSA private key.
  • (4 bytes) A checksum.

By changing the version number, you can generate different bitcoin addresses (one for an uncompressed public key, and the other for a compressed public key) with the same ECDSA private key.  This will result in a different WIF (both the version number and the checksum will be affected) for that private key though, so when viewed in the typical format it will appear to be a different private key.




So does that mean everytime I create a new address on the Bitcoin core, a new Priv+Pub pair is generated? If yes, how are they all tied to my own wallet? How does the application keep them together for me?


Title: Re: Multiple public adresses for one private key?
Post by: DannyHamilton on April 14, 2014, 06:26:12 PM
So does that mean everytime I create a new address on the Bitcoin core, a new Priv+Pub pair is generated?

Yes. (Although with default settings, Bitcoin Core pre-generates 100 addresses)

If yes, how are they all tied to my own wallet? How does the application keep them together for me?

Bitcoin stores all the private keys in a file called wallet.dat.


Title: Re: Multiple public adresses for one private key?
Post by: kittucrypt on April 14, 2014, 06:28:35 PM
So does that mean everytime I create a new address on the Bitcoin core, a new Priv+Pub pair is generated?

Yes. (Although with default settings, Bitcoin Core pre-generates 100 addresses)

If yes, how are they all tied to my own wallet? How does the application keep them together for me?

Bitcoin stores all the private keys in a file called wallet.dat.

So it generates 100 priv+pub key pairs at the time of installation but does not show them up. Once I click on generating new addresses, it picks one of those and show it to me? If I go beyond 100, it generates new priv+pub key everytime?

Is that how it works?


Title: Re: Multiple public adresses for one private key?
Post by: DannyHamilton on April 14, 2014, 06:41:29 PM
So it generates 100 priv+pub key pairs at the time of installation but does not show them up.

Correct.

Once I click on generating new addresses, it picks one of those and show it to me?

Correct.  It also uses one of those addresses every time you send a transaction (for the change from the transaction).

If I go beyond 100, it generates new priv+pub key everytime?

Is that how it works?

Not quite.

Each time it takes a priv+pub key from the pre-generated pool, it generates a new one to add to the queue.  That way there continues to be a pool of 100 available.

Because of this, you can create a backup at any time, and as long as you haven't used up more than 100 addresses since the backup, you can recover your entire wallet balance from the backup.


Title: Re: Multiple public adresses for one private key?
Post by: kittucrypt on April 14, 2014, 07:53:04 PM
Ahh Gotcha! Thanks!  :)