Bitcoin: deriving the master public key and the btc address from seed phrase of electrum wallet

Related the Home Social Wood and Address BTC from Feem France with Electromocols

**

The future enthusiastics of the cytro activists, it is important to reap, as the bitcoin -bodies and to manage their partial keys. In this state, we disperse the Python code, which adopts a standard seminal phrase in the qualities of the entrance and the root Klavish or the Master -key XPUB, used by the electric -short -liver.

What is the seed phrase?

The seminal phrase is this chapel of words that serve as a partial key for Bitcoin -Koshelka. He is generated with the use of the phrasal formula and the stubborn phrases, each of which contains 25 symbols (or less). The seed phrase is descended on the four parts:

  • FIRST PART: 25 phrase person

  • The second part: 26 phrases of the person

  • Third part: 27 phrase person

  • The quarter part: 33 phrases of the person

Each part contains a couple of words that are cut with a thickets (:) with the last two symbols (0-9). For example, 34: 1a23b

Electronic Koshelets and Phrases Semyan

Bitcoin: deriving the master public key and the btc address from seed phrase of electrum wallet

Electrum – This is a popular program for Bitcoin -Koshelka, which uses the seminal phrase for the closed key. The seminal phrase is used for the attachment of the main open key XPUB.

That’s the launch of the process:

  • Circle the seminal phrase on the four parts: 34: 1A23B,56: 2D45E83F,89: 5A6D7C4A1B12: 345678901234567890L

  • Elevate the Home Senior Key XPUB for each part with a help cryptographic algorithm (for example, ECDSA C secp256K1)

3.

Python code

Python

Import hashlib

Def derive_xpub_key (Seed_phrase):

Cutting seed phrase on four parts

Parts = [seed_phrase [: 25], seed_phrase [26:51], seed_phrase [52:78], seed_phrase [79: 104]]]]

Initialize the blank list for the maintenance of the main general Key Xpub

xpub_keys = []

Iteration over each seminal phrase

For a part in parts:

Encourage Home -Neighboring Key XPub with ECDSA with SECP256K1

Key = Hashlib.ha256 (part.encode ()). Digest ()

Add the attached key in the list of the main general Key Xpub

Xpub_Keys.App (key)

#Buytinat the joys in the one wing

root_key = '' .join (xpub_Keys)

return root_key

Primmer Using:

Seed_phrase = "34: 1a23B56: 2D45E83F89: 5A6D7C4A1B12: 345678901234567890124567890"

Root_key = Derive_xpub_key (Seed_phrase)

PRINT (ROOT_KEY)

Entertainment: This code prefares that the bailiff is introduced into the sight. On the practition, you can dissatate the question of using a more powerless technique for the chronic phrase, such as a password with a password or using the Opto Module Module (HSM).

I hope that this Python code helps you with the delay the main general key and the address BTC from the Electromer -Koshelka Electrome!

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *