I am working on a Bitcoin Wallet, i have public key but can't figure out how can i genrate xPub key from this.

  • You can't. Perhaps you can ask a more specific question after reading more about BIP32? Commented Dec 7, 2017 at 3:54
  • I also recommend to have a look into Andreas' book "Mastering Bitcoin" (2nd edition), where he explains in chapter 5, how HD wallets and BIP32 work. The book is somewhere online readable (I think it was even on Amazon, but there is the pre-release only, and has chapter 4 with wallets). Commented Dec 7, 2017 at 12:51

1 Answer 1


The extended public key, xPub, consists of both a chaincode and the public key itself. These are effectively distinct from each other, you cannot generate the chain code from the public key or vice-versa. Normally they are both generated at the same time from a seed, but without the seed you cannot generate the same chain code.

  • @TygaChristed please accept the answer if it satisfied your question, because otherwise it remains "unanswered" on the site :) Commented Dec 13, 2017 at 12:14

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.