26

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.

3 Answers 3

28

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 belongs to you.

Update: you need to use getaddressinfo now instead of validateaddress.

8
  • 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, 2013 at 20:07
  • 2
    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, 2016 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, 2016 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, 2017 at 14:09
  • 2
    @user2284570 Bitcoin transactions have an input and output address and are normally sent to a "pubkey hash", not a "pubkey". A bitcoin address is just a pubkey hash with a header and checksum bytes appended then encoded with base58checked. So you can go from a bitcoin address to a pubkey hash without a problem. Feb 1, 2020 at 11:43
14

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

12

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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