menu
search

Blogs & Articles: What is an xpub? đź”— 4 years ago

nopara73 on Medium

You know that your Bitcoin Address is what you share to the world to get paid.

You probably know that your wallet software uses a private key to spend the money you received on this address.

The keys are not stored on the network and they can be generated without access to the Internet.

From the private key, we use a one-way cryptographic function, to generate a public key.

There are two Bitcoin networks:

  • TestNet is a Bitcoin network for development purposes. Bitcoins on this network are worth nothing.
  • MainNet is the Bitcoin network everybody uses.
You can acquire testnet coins quickly by using faucets, just google “get testnet bitcoins”.

You can easily get your bitcoin address from your public key and the network on which this address should be used.

Practicing Bitcoin Programming on MainNet makes mistakes more memorable.

Like the good ol’ days

You may be wondering why generate several keys? The main reason is privacy. Since you can see the balance of all addresses, it is better to use a new address for each transaction.
The problem with this is, all backups of your wallet will become outdated when you generate a new key.

Deterministic Wallets (BIP 32)

A “Deterministic” wallet would fix our backup problem. With such a wallet, you would have to save only the seed.

bean grief goddess glow jelly direct balcony theme detect hamster special aspect

From this seed, you can generate the same series of private keys over and over. This is what the “Deterministic” stands for. From a master key, I can generate new keys.

What is an xpub?

The trick is that you can “neuter” your master key, then you have a public (without private key) version of the master key. From this neutered version, a third party can generate your public keys without knowing your private keys.

Your neutered master private key is your master public key, also called extended public key or xpub.

xpub6DE1bvvTaMkDaAghedChtufg3rDPeYdWt9sM5iTwBVYe9X6bmLenQrSexSa1qDscYtidSMUEo9u7TuXg48Y3hBXQr7Yw8zUaEToH1rVgvif

https://twitter.com/chris_belcher_/status/1299281870757257218

This article was mostly a put together from an open source book I co-authored with Nicolas Dorier a couple of years ago: Programming The Blockchain in C#.

More from this author

2nd March 2024 10:14

26th December 2023 09:53

17th October 2023 02:19

16th June 2023 01:35

26th May 2023 12:49

1 year agoEcce Cypherpunk

14th April 2023 08:18

2nd April 2023 04:26

2 years agoWasabigeddon

18th July 2022 10:01

Feel free to send a tip using tippin.me

Or alternatively you can send a few sats directly:

btc logo BTC ln logo BTC (Lightning)

btc tip qr

33ELQ1ye29gB6YVQY6zRLFVCNYkJez9jMh

lightning tip qr

lnurl1dp68gurn8ghj7cm0d9hxxmmjdejhytnfduhkcmn4wfkz7urp0yhn2vryv5ukvdm995ckydph956rvv3h94sk2dny95mkgv34xdsnvvrpv4jxz6whyrn