2
2
I'm goofing around with this fork of pybitcointools and I got stock with generating multiple address for receiving coins with a master public key. So far, this is what I have:
import bitcoin as btc
privatekey = btc.sha256("large example seed for this great test")
print privatekey
# 03e02b95a485112b543ac29cd262afbbd64dca9b4496e264e47312cb193ae5ab
bip32_masterprivatekey = btc.bip32_master_key(privatekey)
bip32_masterpublickey = btc.bip32_privtopub(bip32_masterprivatekey)
print bip32_masterprivatekey
# xprv9s21ZrQH143K3tQmGrVtKc7B6ZPtCJAmD6wDAJXxb7YXAoZFTb55UroSxrU7k823vSQmYPDhdseRKqP1mgSUWDneinai2seUd7RLX2xkmGW
print bip32_masterpublickey
# xpub661MyMwAqRbcGNVENt2tgk3uebENbktcaKroxgwa9T5W3btQ18PL2f7vp78LNoioGhZcgSH1i2cH48YcQttiEaAh86TuJpsUu2J7jQWnmbC
That would generate one bitcoin address, right? How do I generate two or more using the master public key? – shackra – 2016-07-22T04:57:05.620
1Indeed, that would. You'll want to do bip32_descend to get keys that are not the root key. – Jimmy Song – 2016-07-22T13:45:58.150
Sorry for being annoying, but what parameters should I exactly feed
bip32_descendwith, besides the public master key (I guess) to achieve what I'm looking? I did thisbtc.pubkey_to_address(btc.bip32_descend(bip32_masterpublickey, [1, 0, 0]))and I'm getting a different address changing the third 0 of the list, but I'm not sure if that equals toM/i'/0– shackra – 2016-07-22T21:42:52.1601So the last argument is the BIP32 path. [1,0,0] => M/1/0/0 path. Changing any of the numbers in the path or making it longer by an element will change the address. – Jimmy Song – 2016-07-23T15:41:55.760