Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electrum 2 XPUB public master key #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Electrum 2 XPUB public master key #157

wants to merge 1 commit into from

Conversation

vstoykovbg
Copy link

Create keys and addresses from Electrum 2 XPUB public master key

New functions: electrum_pubkey_v2 and electrum_address_v2.

Example code:

#!/usr/bin/python3

from bitcoin import *


this_Electrum_v2_XPUB_master_public_key = "xpub661MyMwAqRbcFdBCo3DNoAd2jxiTshTYz2zdx7wDmnWtkFVe5Egzkb7dwsKbgGPj4SjEHSnRawewD1PJYLbQsZaXVGoaMQVmVc4SMXurZGw"

print ("\n * Public \"receive\" addresses: *\n\n")

for this_idx in range(0,6):

    this_public_key = electrum_pubkey_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 0) # 0: receive 1: change
    this_public_address = pubkey_to_address(this_public_key)

    this_public_address2 = electrum_address_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 0) # 0: receive 1: change

    print (this_public_address, this_public_address2)


print ("\n * Public \"change\" addresses: *\n\n")

for this_idx in range(0,6):

    this_public_key = electrum_pubkey_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 1) # 0: receive 1: change
    this_public_address = pubkey_to_address(this_public_key)

    this_public_address2 = electrum_address_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 1) # 0: receive 1: change

    print (this_public_address, this_public_address2)

Create keys and addresses from Electrum 2 XPUB public master key

New functions: electrum_pubkey_v2 and  electrum_address_v2.

Example code:

```
#!/usr/bin/python3

from bitcoin import *


this_Electrum_v2_XPUB_master_public_key = "xpub661MyMwAqRbcFdBCo3DNoAd2jxiTshTYz2zdx7wDmnWtkFVe5Egzkb7dwsKbgGPj4SjEHSnRawewD1PJYLbQsZaXVGoaMQVmVc4SMXurZGw"

print ("\n * Public \"receive\" addresses: *\n\n")

for this_idx in range(0,6):

    this_public_key = electrum_pubkey_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 0) # 0: receive 1: change
    this_public_address = pubkey_to_address(this_public_key)

    this_public_address2 = electrum_address_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 0) # 0: receive 1: change

    print (this_public_address, this_public_address2)


print ("\n * Public \"change\" addresses: *\n\n")

for this_idx in range(0,6):

    this_public_key = electrum_pubkey_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 1) # 0: receive 1: change
    this_public_address = pubkey_to_address(this_public_key)

    this_public_address2 = electrum_address_v2(this_Electrum_v2_XPUB_master_public_key, this_idx, 1) # 0: receive 1: change

    print (this_public_address, this_public_address2)

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants