How to find xPub key in your wallet?
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: