<blockquote>
  <p>WIF pubkey</p>
</blockquote>

<p>There is no such thing as a wallet import format pubkey. What you have shared is an address, which is <code>HASH160(pubkey)</code>. There is no way to recover the original public key from an address. You could, however, recover the public key from an outgoing transaction from that address, as it would be revealed as part of the unlocking script.</p>

CC BY-SA 4.0
2018-11-27T14:00:17.133Z
2018-11-27T14:00:17.133Z
Raghav Sood
<p>Is there a way with bitcoinjs-lib to import a WIF pubkey: </p>

<blockquote>
  <p>1HVTiWkuGKEJXJupriTdY5MKngcq2bH6P4</p>
</blockquote>

<p>and get the hexadecimal version like this: </p>

<blockquote>
  <p>02f632717d78bf73e74aa8461e2e782532abae4eed5110241025afb59ebfd3d2fd</p>
</blockquote>

CC BY-SA 4.0
2018-11-26T22:56:39.460Z
WIF is Wallet Input Format for a private key, not a pubkey: https://en.bitcoin.it/wiki/Wallet_import_format. Also that looks like a P2PKH address
JBaczuk
CC BY-SA 4.0
2018-11-26T23:07:15.623Z
OK: is it possible to convert P2PKH back to hexadecimal ?
jfjobidon
CC BY-SA 4.0
2018-11-26T23:08:30.037Z
No, an address is not a public key. It only encodes a hash of a public key, which cannot be reversed.
Pieter Wuille
<bitcoin-core>
how to convert pubkey wif address to hex format with bitcoinjs-lib?
jfjobidon
# how to convert pubkey wif address to hex format with bitcoinjs-lib?

(Asked by: username_0 on 2018-11-26)

Is there a way with bitcoinjs-lib to import a WIF pubkey:

> 1HVTiWkuGKEJXJupriTdY5MKngcq2bH6P4

and get the hexadecimal version like this:

> 02f632717d78bf73e74aa8461e2e782532abae4eed5110241025afb59ebfd3d2fd

**Tags:** bitcoin-core

> **Comments:**
> **username_1**: WIF is Wallet Input Format for a private key, not a pubkey: https://en.bitcoin.it/wiki/Wallet_import_format. Also that looks like a P2PKH address  
> **username_0**: OK: is it possible to convert P2PKH back to hexadecimal ?  
> **username_2**: No, an address is not a public key. It only encodes a hash of a public key, which cannot be reversed.  

---

## 1 answers

### Answer by username_3 on 2018-11-27. Score: 1

> WIF pubkey

There is no such thing as a wallet import format pubkey. What you have shared is an address, which is `HASH160(pubkey)`. There is no way to recover the original public key from an address. You could, however, recover the public key from an outgoing transaction from that address, as it would be revealed as part of the unlocking script.


---

