• 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

BTOB, Lee Chae Yeon and More: K-POP IP Goes Onchain With Sony Crypto

BTOB, Lee Chae Yeon and More: K-POP IP Goes Onchain With Sony Crypto

September 30, 2026
Solana Whale Wallet Count Declines 3.6% Since May

Public Company Sells Part Of Its Gold Holdings To Buy Solana

September 30, 2026
Share76Tweet47

Related Posts

BTOB, Lee Chae Yeon and More: K-POP IP Goes Onchain With Sony Crypto

BTOB, Lee Chae Yeon and More: K-POP IP Goes Onchain With Sony Crypto

by Moussa
September 30, 2026
0

BTOB and Lee Chae Yeon’s agency is making a move into crypto, partnering with Sony-backed Soneium to explore bringing K-Pop...

Solana Whale Wallet Count Declines 3.6% Since May

Public Company Sells Part Of Its Gold Holdings To Buy Solana

by Moussa
September 30, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure TL;DR Digital Commodities has bought approximately C$100,000...

CLARITY Act Delay Shows Crypto Market Structure Fight Is Not Over

BTCS Prepares DeFi Business To Provide Liquidity For Tokenized Stocks

by Moussa
September 30, 2026
0

TL;DR BTCS says its Imperium DeFi unit has completed preparatory compliance steps for potential use of the SEC’s Covered Firm...

Tracy Shuchart: BTC & the Commodities Supercycle

Tracy Shuchart: BTC & the Commodities Supercycle

by Moussa
September 30, 2026
0

Bitcoin Magazine Tracy Shuchart: BTC & the Commodities Supercycle Six million barrels a day of oil still aren’t getting through...

Fake Coinbase Texts Led to $900K Bitcoin Theft, US Seeks Seized Crypto

Fake Coinbase Texts Led to $900K Bitcoin Theft, US Seeks Seized Crypto

by Moussa
September 30, 2026
0

Key TakeawaysThe two wallets held bitcoin belonging to a beneficiary and a family trust.Investigators traced 11.2 of the stolen bitcoin...

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