• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

bip32 hd wallets – get extended public key from extended private key in python

Moussa by Moussa
December 9, 2025
in Bitcoin
0
How do Bitcoin mining pools typically handle payout frequency versus thresholds?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


From BIP32:

We represent an extended private key as (k, c), with k the normal
private key, and c the chain code. An extended public key is
represented as (K, c), with K = point(k) and c the chain code.

point(p): returns the coordinate pair resulting from EC point
multiplication (repeated application of the EC group operation) of the
secp256k1 base point with the integer p.

ser256(p): serializes the integer p as a 32-byte sequence,
most significant byte first.

serP(P): serializes the coordinate pair P = (x,y) as a byte
sequence using SEC1’s compressed form: (0x02 or 0x03) ||
ser256(x), where the header byte depends on the parity of
the omitted y coordinate.

Extended public and private keys are serialized as follows:

  • 4 byte: version bytes (mainnet: 0x0488B21E public, 0x0488ADE4 private; testnet: 0x043587CF public, 0x04358394 private)
  • 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 derived keys, ….
  • 4 bytes: the fingerprint of the parent’s key (0x00000000 if master key)
  • 4 bytes: child number. This is ser32(i) for i in xi = xpar/i, with xi the key being serialized. (0x00000000 if master key)
  • 32 bytes: the chain code
  • 33 bytes: the public key or private key data (serP(K) for public keys, 0x00 || ser256(k) for private keys)

This 78 byte structure can be encoded like other Bitcoin data in
Base58, by first adding 32 checksum bits (derived from the double
SHA-256 checksum), and then converting to the Base58 representation.
This results in a Base58-encoded string of up to 112 characters.

Thus the extended public key (xpub) can be derived from the extended private key (xprv) as follows:

  1. Convert the xprv from Base58 to bytes and extract the private key from the last 33 bytes (ignoring the checksum).
  2. Calculate the public key from the private key as per point(p).
  3. Serialize the result:
    • 4 bytes: 0x0488B21E (mainnet) or 0x043587CF (testnet)
    • 41 bytes: depth, parent fingerprint, child number and chain code are the same as in the xprv
    • 33 bytes: public key serialized using serP(K)
  4. Add the 4-byte checksum and convert to Base58.



Source link

Related articles

US Lawmaker Probes Federal Reserve Approval of Kraken, Warns of ‘Critical’ Risk – Featured Bitcoin News

US Lawmaker Probes Federal Reserve Approval of Kraken, Warns of ‘Critical’ Risk – Featured Bitcoin News

March 28, 2026
How do Bitcoin mining pools typically handle payout frequency versus thresholds?

bitcoin core – developing hd wallet using bip32 and bip 39

March 28, 2026
Share76Tweet47

Related Posts

US Lawmaker Probes Federal Reserve Approval of Kraken, Warns of ‘Critical’ Risk – Featured Bitcoin News

US Lawmaker Probes Federal Reserve Approval of Kraken, Warns of ‘Critical’ Risk – Featured Bitcoin News

by Moussa
March 28, 2026
0

Lawmaker Presses Fed Over Crypto Account Approval Heightened scrutiny over access to U.S. payment infrastructure is intensifying as policymakers examine...

How do Bitcoin mining pools typically handle payout frequency versus thresholds?

bitcoin core – developing hd wallet using bip32 and bip 39

by Moussa
March 28, 2026
0

I'm developing a HD wallet using C#. I want to use this wallet for multiple blockchains like bitcoin, ethereum, dogecoin...

Cracked: How Irish Crypto Authorities Finally Moved 500 ‘Inaccessible’ Bitcoin

Cracked: How Irish Crypto Authorities Finally Moved 500 ‘Inaccessible’ Bitcoin

by Moussa
March 28, 2026
0

The Irish crypto wallet was supposed to be a digital tomb. For ten years, 500 Bitcoin sat untouched, locked behind...

Hyperliquid Policy Center’s Concerns Over CLARITY Act– Urges Fixes To Protect DeFi Developers

Hyperliquid Policy Center’s Concerns Over CLARITY Act– Urges Fixes To Protect DeFi Developers

by Moussa
March 28, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure A fresh round of disagreement over the...

Bond Market Stress Overtakes Oil Shock

Bond Market Stress Overtakes Oil Shock

by Moussa
March 27, 2026
0

Reason to trust Strict editorial policy that focuses on accuracy, relevance, and impartiality Created by industry experts and meticulously reviewed...

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjIlMjBuYW1lJTNEJTIybm4lMjIlMjBpZCUzRCUyMnRucC0xJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0MlMkZkaXYlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1lbWFpbCUyMiUzRSUzQ2xhYmVsJTIwZm9yJTNEJTIydG5wLTIlMjIlM0VFbWFpbCUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1lbWFpbCUyMiUyMHR5cGUlM0QlMjJlbWFpbCUyMiUyMG5hbWUlM0QlMjJuZSUyMiUyMGlkJTNEJTIydG5wLTIlMjIlMjB2YWx1ZSUzRCUyMiUyMiUyMHJlcXVpcmVkJTNFJTNDJTJGZGl2JTNFJTBBJTNDZGl2JTIwY2xhc3MlM0QlMjJ0bnAtZmllbGQlMjB0bnAtcHJpdmFjeS1maWVsZCUyMiUzRSUzQ2xhYmVsJTNFJTNDaW5wdXQlMjB0eXBlJTNEJTIyY2hlY2tib3glMjIlMjBuYW1lJTNEJTIybnklMjIlMjByZXF1aXJlZCUyMGNsYXNzJTNEJTIydG5wLXByaXZhY3klMjIlM0UlQzIlQTBCeSUyMGNvbnRpbnVpbmclMkMlMjB5b3UlMjBhY2NlcHQlMjB0aGUlMjBwcml2YWN5JTIwcG9saWN5JTNDJTJGbGFiZWwlM0UlM0MlMkZkaXYlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1idXR0b24lMjIlM0UlM0NpbnB1dCUyMGNsYXNzJTNEJTIydG5wLXN1Ym1pdCUyMiUyMHR5cGUlM0QlMjJzdWJtaXQlMjIlMjB2YWx1ZSUzRCUyMlN1YnNjcmliZSUyMiUyMCUzRSUwQSUzQyUyRmRpdiUzRSUwQSUzQyUyRmZvcm0lM0UlMEElM0MlMkZkaXYlM0UlM0NiciUyRiUzRSUzQyUyRnAlM0U=[/vc_raw_html][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News