Author

Topic: How to create a new public address using Python for an HD wallet? (Read 1343 times)

legendary
Activity: 3682
Merit: 1580
I searched but could not find a clear answer. Sorry in advance for terminology errors. This seems useful:

https://github.com/richardkiss/pycoin

However I'm not sure I understand how to do the following with that library:

1. Create a HD wallet (i.e. create a new Electrum wallet with seed and all that)
2. Create a new public key that is derived from that HD wallet, or from an existing wallet

My goal is to create a public address that can be presented to a customer on a website. The code will live on a remote server; I would like the public keys created to relate back to a private (offline) HD wallet.



Try this WP plugin that I released recently:

https://bitcointalksearch.org/topic/bitcoin-address-wordpress-plugin-900327

It's not bip32 compatible but will work with an Electrum MPK

You can use the shortcode or, if you know how to code php, call the get_address() function in your own plugin:

Code:
global $AbdBitcoinAddress;
$address = $AbdBitcoinAddress->get_address();
full member
Activity: 173
Merit: 105
You'll need to keep the master public key on the online machine, and then use the get_address() function the script jonald linked to.  Then on your offline machine, you can get the private keys for it with the get_private_key() function.

That being said, I'd recommend using BIP0032 HD wallets instead of Electrum.  Bip32 is becoming the standard for exactly that type of use case, and there are more tools and information about it.

Thanks for the clarification; after looking into BIP0032 I found this library which I think will be perfect for this application:
https://github.com/jmcorgan/bip32utils

full member
Activity: 173
Merit: 105
here's a script you can look at which is similar to what you're trying to do. it's based off electrum.

https://bitcointalksearch.org/topic/electrum-stand-alone-seed-generation-694521

Very useful, thanks.
hero member
Activity: 793
Merit: 1026
You'll need to keep the master public key on the online machine, and then use the get_address() function the script jonald linked to.  Then on your offline machine, you can get the private keys for it with the get_private_key() function.

That being said, I'd recommend using BIP0032 HD wallets instead of Electrum.  Bip32 is becoming the standard for exactly that type of use case, and there are more tools and information about it.
legendary
Activity: 1302
Merit: 1008
Core dev leaves me neg feedback #abuse #political
here's a script you can look at which is similar to what you're trying to do. it's based off electrum.

https://bitcointalksearch.org/topic/electrum-stand-alone-seed-generation-694521
full member
Activity: 173
Merit: 105
I searched but could not find a clear answer. Sorry in advance for terminology errors. This seems useful:

https://github.com/richardkiss/pycoin

However I'm not sure I understand how to do the following with that library:

1. Create a HD wallet (i.e. create a new Electrum wallet with seed and all that)
2. Create a new public key that is derived from that HD wallet, or from an existing wallet

My goal is to create a public address that can be presented to a customer on a website. The code will live on a remote server; I would like the public keys created to relate back to a private (offline) HD wallet.

Jump to: