Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: antonimasso on August 18, 2014, 11:54:01 AM



Title: Extract Bitcoin Address from Public Key
Post by: antonimasso on August 18, 2014, 11:54:01 AM
Hello,

I'd like to extract the bitcoin address from a public key.
I want to create a MultiSig address and would like to check if the bitcoin address corresponds to the public key.
Does anyone know if this has already been made with Javascript?

Thanks


Title: Re: Extract Bitcoin Address from Public Key
Post by: kolinko on August 18, 2014, 12:44:32 PM
I don't know about a javascript implementation, but for python you can check out ours:

https://github.com/orisi/wiki/wiki/Installing-the-oracle-node

And then run ./runclient.sh main

Here's a code that does it:
https://github.com/orisi/orisi/blob/master/src/client/main.py
(function main)


Title: Re: Extract Bitcoin Address from Public Key
Post by: antonimasso on August 18, 2014, 03:44:51 PM
I'd like to avoid having to make a request to the server to extract the bitcoin address from the public key.
I found another example on how to extract it with PHP (https://stackoverflow.com/questions/19233053/hashing-from-a-public-key-to-a-bitcoin-address-in-php), but I really prefer doing in it Javascript.


Title: Re: Extract Bitcoin Address from Public Key
Post by: ffe on August 18, 2014, 04:02:59 PM
dig into the JavaScript from Bitaddress.org


Title: Re: Extract Bitcoin Address from Public Key
Post by: TheButterZone on August 18, 2014, 11:27:33 PM
What happens when you put the public key after https://blockchain.info/address/

?


Title: Re: Extract Bitcoin Address from Public Key
Post by: DeathAndTaxes on August 18, 2014, 11:58:20 PM
What happens when you put the public key after https://blockchain.info/address/ ?

Nothing because a PubKey is not an address.   An address is a hash of the pubkey (PubKeyHash) or a hash of the script (ScriptHash) with version and checksum encoded in base58.


Title: Re: Extract Bitcoin Address from Public Key
Post by: TheButterZone on August 19, 2014, 12:05:49 AM
What happens when you put the public key after https://blockchain.info/address/ ?

Nothing because a PubKey is not an address.   An address is a hash of the pubkey (PubKeyHash) or a hash of the script (ScriptHash) with version and checksum encoded in base58.

https://blockchain.info/address/62e28bc02c39a27ead237ff0c4039871b29be836


Title: Re: Extract Bitcoin Address from Public Key
Post by: DeathAndTaxes on August 19, 2014, 01:08:13 AM
What happens when you put the public key after https://blockchain.info/address/ ?

Nothing because a PubKey is not an address.   An address is a hash of the pubkey (PubKeyHash) or a hash of the script (ScriptHash) with version and checksum encoded in base58.

https://blockchain.info/address/62e28bc02c39a27ead237ff0c4039871b29be836

That isn't a Public key it is a hash.  PubKeys are 256 bits.


Title: Re: Extract Bitcoin Address from Public Key
Post by: amaclin on August 19, 2014, 04:39:29 AM
Quote
That isn't a Public key it is a hash.  PubKeys are 256 bits.
{troll mode on}
No.
pubkeys are 512 bits.
Yes, it is possible to "compress" it to 257 bits  ;D
{troll mode off}


Title: Re: Extract Bitcoin Address from Public Key
Post by: antonimasso on August 19, 2014, 06:29:42 AM
I finally used brainwallet's JS client code.

Thanks


Title: Re: Extract Bitcoin Address from Public Key
Post by: antonimasso on August 19, 2014, 07:43:14 AM
Working demo:

http://www.amasso.info/bitcoin/