Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: brovine on November 18, 2013, 02:26:58 AM



Title: How to calculate address?
Post by: brovine on November 18, 2013, 02:26:58 AM
Not sure if this is the right section. Sorry if not.

How can I calculate the address if I have the public key and a private partial key?


Title: Re: How to calculate address?
Post by: SemiMolten on November 18, 2013, 03:08:10 AM
bitaddress.org and navigate to the vanity wallet


Title: Re: How to calculate address?
Post by: brovine on November 18, 2013, 03:33:00 AM
bitaddress.org and navigate to the vanity wallet

Thank you. And now how can I do it offline?


Title: Re: How to calculate address?
Post by: DeathAndTaxes on November 18, 2013, 03:34:07 AM
bitaddress.org and navigate to the vanity wallet

Thank you. And now how can I do it offline?

Save the site, access it from an offline computer.

All the logic is in the client side javascript.  It works just as well offline.


Title: Re: How to calculate address?
Post by: brovine on November 18, 2013, 03:39:24 AM
bitaddress.org and navigate to the vanity wallet

Thank you. And now how can I do it offline?

Save the site, access it from an offline computer.

All the logic is in the client side javascript.  It works just as well offline.

Alright and now let's assume I want to know how it's done.


Title: Re: How to calculate address?
Post by: DeathAndTaxes on November 18, 2013, 03:42:21 AM
Here:
https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses

Cheat sheet:
https://en.bitcoin.it/w/images/en/9/9b/PubKeyToAddr.png

Bitcoin now supports compressed pubkeys (only contains X value, Y value is computed) the above diagram should probably be updated to reflect that.


Title: Re: How to calculate address?
Post by: brovine on November 18, 2013, 04:10:34 AM
Here:
https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses

Cheat sheet:
https://en.bitcoin.it/w/images/en/9/9b/PubKeyToAddr.png

Bitcoin now supports compressed pubkeys (only contains X value, Y value is computed) the above diagram should probably be updated to reflect that.

In this, where would I stick the partial private key?


Title: Re: How to calculate address?
Post by: DannyHamilton on November 18, 2013, 04:41:00 AM
In this, where would I stick the partial private key?

The private key is used to calculate the public key.

You said you already have the public key.

Not sure if this is the right section. Sorry if not.

How can I calculate the address if I have the public key and a private partial key?

Once you have the public key, that's all you need for calculating the address.


Title: Re: How to calculate address?
Post by: brovine on November 18, 2013, 04:43:33 AM
In this, where would I stick the partial private key?

The private key is used to calculate the public key.

You said you already have the public key.

Not sure if this is the right section. Sorry if not.

How can I calculate the address if I have the public key and a private partial key?

Once you have the public key, that's all you need for calculating the address.

Okay let me explain the scenario.

I'm using vanitygen. I supply a public key to it and a prefix. It then finds the vanity address using said public key and provides me a partial private key. Sites like bitaddress.com can take that public key and the partial private key and determine the address. The public key itself is not enough; that returns a different address.


Title: Re: How to calculate address?
Post by: J35st3r on November 18, 2013, 09:38:18 AM
I'm using vanitygen. I supply a public key to it and a prefix. It then finds the vanity address using said public key and provides me a partial private key. Sites like bitaddress.com can take that public key and the partial private key and determine the address. The public key itself is not enough; that returns a different address.

That functionality is intended for vanity key "farms" that calculate private keys as a service. The key combination ensures the generated key is known only by the client and not the service.

I was involved in a short discussion on this a while back so I'll link the thread https://bitcointalk.org/index.php?topic=268567.0 in case its of any use to you.


Title: Re: How to calculate address?
Post by: brovine on November 18, 2013, 04:53:27 PM
I'm using vanitygen. I supply a public key to it and a prefix. It then finds the vanity address using said public key and provides me a partial private key. Sites like bitaddress.com can take that public key and the partial private key and determine the address. The public key itself is not enough; that returns a different address.

That functionality is intended for vanity key "farms" that calculate private keys as a service. The key combination ensures the generated key is known only by the client and not the service.

I was involved in a short discussion on this a while back so I'll link the thread https://bitcointalk.org/index.php?topic=268567.0 in case its of any use to you.

...It generates a partial private key that gets converted to a public key and then added with the buyer's public key to calculate the address. Multiple sites and scripts offer this service, such as bitaddress and pybitcointools

I'd like to know the algorithm to do this so that I can do it up in PHP.


Title: Re: How to calculate address?
Post by: J35st3r on November 18, 2013, 09:40:18 PM
...It generates a partial private key that gets converted to a public key and then added with the buyer's public key to calculate the address. Multiple sites and scripts offer this service, such as bitaddress and pybitcointools

I'd like to know the algorithm to do this so that I can do it up in PHP.

I gave you the link to the thread, if you'd read it you'd have found this link https://bitcointalk.org/index.php?topic=84569.0 which explains the process reasonably clearly (it relies on the properties of the ECDSA addition operation as regards private keys and their generated public keys, not being a math guru I can't explain it myself).

I find the ECDSA code in JackJack's Pywallet to be the easiest to follow, so you may want to start there, though it does not implement the split-key algorithm. You'll need to look at the vanitygen source for that (which I find quite difficult to follow) or the javascript in bitaddress.org.