22

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.

23

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.

| improve this answer | |
  • 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
  • 1
    @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. – dodgy_coder Feb 1 at 11:43
11

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.

| improve this answer | |
  • @PieterWuille : but payment transactions are performed to a pubkey… Right ? – user2284570 Mar 28 '19 at 1:21
  • it depends on the transaction type – Badr Bellaj Mar 28 '19 at 11:40
  • I wrote this in the sense this is a requirement. – user2284570 Mar 28 '19 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 '19 at 15:23
  • @user2284570 What is a "payment transaction"? – Pieter Wuille Mar 28 '19 at 19:32
11

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

| improve this answer | |

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.