Skip to content

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