20

It is possible to get it from here: https://blockchain.info/de/q/pubkeyaddr https://blockchain.info/q

Is it possible with the standard client? How?

I am aware that the blockchain only contains the pubkey after a tx from that address.

17

It is impossible to compute the public key of an address, as the address is computed from the hash of the public key. You can retrieve the public key from address with the reference client using the validateaddress RPC call (or in the debug window of Bitcoin-Qt), but that simply fetches it from the wallet, and only works if the address is your.

What do you need the public key for, if it's not your address?

  • 1
    I would like to encrypt messages by abusing bitcoin/namecoin signing keys as encryption keys. see: bitcointalk.org/index.php?topic=145098 I am aware there might be peripheral risks to using the same keys for signing and encryption. – kermit Jun 13 '13 at 20:07
  • 1
    To elaborate, a public key is 33 bytes long, whereas an address is a 20-byte hash of the public key. Because the information is smaller, therefore it is impossible to compute the correct public key from an address. – Nayuki Jan 11 '16 at 2:30
  • don't i need the full pub key for an address i do NOT own when creating a new multisig address with "addmultisigaddress"? – Albert s Jan 23 '16 at 21:27
  • It IS possible to recover the public key from the signature though (so you can recover the public key of an address already seen on the blockchain), see the answer below. – user48462 Jun 28 '17 at 14:09
  • Wait, shouldn't it be possible to lookup int he blockchain and see if that person spent from that address and then get the public key used to sign the transaction? – Guerlando OCs Jul 26 '17 at 8:30
9

It is impossible. Given an ECDSA (compressed 65Bytes or not 33Bytes) public-key K, a Bitcoin address is generated using the cryptographic hash functions SHA-256 and RIPEMD-160. The public-key is hashed twice: HASH160 = RIPEMD-160(SHA-256(K)). The Bitcoin address is computed directly from this HASH160 value as

base58(0x00 || HASH160 || bSHA-256(SHA-256(0x00 || HASH160))/2224c). "||=concatenation"

enter image description here

so it is impossible to reverse the hash to get the public key.

  • @PieterWuille : but payment transactions are performed to a pubkey… Right ? – user2284570 Mar 28 at 1:21
  • it depends on the transaction type – Badr Bellaj Mar 28 at 11:40
  • I wrote this in the sense this is a requirement. – user2284570 Mar 28 at 11:45
  • the pub key is shared with the network so no need to reverse an address to get the pubkey – Badr Bellaj Mar 28 at 15:23
  • @user2284570 What is a "payment transaction"? – Pieter Wuille Mar 28 at 19:32
8

To be honest, it IS possible, but you need a signature made by that address. From that point, you can get the public key.

See this piece of code: https://github.com/bitcoinjs/bitcoinjs-message/blob/master/index.js#L57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.