Image for post
Image for post

How to find xPub key in your wallet?

Karen Su
Karen Su
Sep 30, 2019 · 3 min read

What is xPub key?

A crypto currency wallet is like a digital version of a bank account for your crypto currencies. To secure your crypto currencies, at the heart of many blockchain-based protocols, a concept of public/private key pairs from cryptography is used.

When hooking your crypto wallets with Forgingblock APIs, xPub key from your wallet is needed for bitcoin, litecoin, and bitcoin cash . xPub key is like the bank account number you give others to send money to you. In the cryptocurrency world, the xPub key generates a new address for each transaction to the sender, which secures the receivers’ privacy more.

What is HD wallet?

We can think that a public Key is like your bank account number where people can send funds and your Private Key is like a physical signature that can authorize a paper check to pay money out of your account.

If a private/ public key pair is needed to generate a new address for each crypto currency transaction, the wallet has to track and maintain a large amount of private/public key pairs, which is highly inefficient and error prone.

So some of the Bitcoin developers worked together to create BIP32, which defined how a single secret seed could be used to generate child key pairs to be used, now with the seed information only, a hierarchical tree-like structure of private/public addresses (or keys) can be derived from it. Every key pair in this tree can define a xPub and an xPriv key that can generate its children xPub and xPriv keys.

In short , an HD (Hierarchical Deterministic) Wallet is a new-age digital wallet that supports the above key storage structure, which automatically generates a hierarchical tree-like structure of private/public addresses (or keys).

What is SegWit protocol?

SegWit (Segregated Witness) is the name for a Bitcoin (BTC) protocol upgrade, which was implemented on Aug. 23, 2017, which enabled a faster and safer Bitcoin. By default, using new HD wallet, every xPub key you provided would create SegWit (P2WPKH) addresses.

For some exchanges or older applications which don’t support SegWit protocol,other schemes are needed. Forgingblock supports more “schemes” than SegWit (P2WPKH) and Legacy (P2PKH) addresses. For example, to use P2SH-P2WPKH scheme, the xpub format should be provided as “ xpub…-[p2sh]”.

Please check forgingblock API document for details.

How to find xPub key in Electrum?

Open Electrum Wallet > go to wallet menu > information > the Master Public Key (MPK) you find here is the xPub key.

How to find xPub key in other popular wallets?

Please refer to the official guide links below for these popular wallets:

ForgingBlock

Bitcoin & Fiat Gateway for Merchants

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store