If I want to watch a public address, I need the hex string for that address, because the importpubkey command only takes a hex input. How can I convert a base 58 address to a hex string using the bitcoin core?

  • Possible duplicate of How can I convert a SHA256 hash into a Bitcoin base58 private key?
    – Hannah Vernon
    Commented Nov 20, 2017 at 21:50
  • I realize the above link does the conversion the other way; however it should help you get started.
    – Hannah Vernon
    Commented Nov 20, 2017 at 21:51
  • 1
    @MaxVernon Uh, what??? This has nothing to do with private keys. Also, the conversion you cited is going the wrong way. That does not get me started. I want to know how to convert a base 58 pub key to a hex pub key USING THE CORE CLIENT. Commented Nov 20, 2017 at 21:56

2 Answers 2


You cannot generate public key from a bitcoin address. From bitcoin address, all you can get is the hash160. Following reference, this can be done through base58 decoding, going from Step 9 -> Step 8. So you get same output as from Step 4 along with checksum at the end.

Basically you have two alternatives:

  • If you have the private key, generate the public key and use importpubkey
  • Use importaddress

You might want to use the importaddress RPC method (I'm not even aware of an importpubkey method). The importaddress method accepts the base58 address string you have. I recently asked a slightly-related question and ended up answering it myself here: How to make ImportMulti function like ImportAddress for watch-only addresses placed into Accounts?

  • When I do that, I get the error "couldn't connect to server". Commented Nov 21, 2017 at 2:25
  • Then you have a bigger problem! Commented Nov 21, 2017 at 9:44

Your Answer

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

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