Bitcoin Forum
December 15, 2024, 12:34:56 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to create a new public address using Python for an HD wallet?  (Read 1345 times)
687_2 (OP)
Full Member
***
Offline Offline

Activity: 173
Merit: 105



View Profile
December 16, 2014, 01:40:19 AM
 #1

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.


Buy the dip with the security and privacy of your own wallet: use cross chain atomic swaps to trade Bitcoin, USDT, and Ether. Trades are secured and settled on-chain. https://sibex.io
jonald_fyookball
Legendary
*
Offline Offline

Activity: 1302
Merit: 1008


Core dev leaves me neg feedback #abuse #political


View Profile
December 16, 2014, 03:13:57 AM
 #2

here's a script you can look at which is similar to what you're trying to do. it's based off electrum.

https://bitcointalk.org/index.php?topic=694521.0

luv2drnkbr
Hero Member
*****
Offline Offline

Activity: 793
Merit: 1026



View Profile
December 16, 2014, 10:02:21 AM
 #3

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.

687_2 (OP)
Full Member
***
Offline Offline

Activity: 173
Merit: 105



View Profile
December 16, 2014, 04:24:54 PM
 #4

here's a script you can look at which is similar to what you're trying to do. it's based off electrum.

https://bitcointalk.org/index.php?topic=694521.0

Very useful, thanks.

Buy the dip with the security and privacy of your own wallet: use cross chain atomic swaps to trade Bitcoin, USDT, and Ether. Trades are secured and settled on-chain. https://sibex.io
687_2 (OP)
Full Member
***
Offline Offline

Activity: 173
Merit: 105



View Profile
December 16, 2014, 04:35:28 PM
 #5

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


Buy the dip with the security and privacy of your own wallet: use cross chain atomic swaps to trade Bitcoin, USDT, and Ether. Trades are secured and settled on-chain. https://sibex.io
Abdussamad
Legendary
*
Offline Offline

Activity: 3710
Merit: 1586



View Profile
December 20, 2014, 12:26:51 PM
 #6

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://bitcointalk.org/index.php?topic=900327.0

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();
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!