I'm trying to create a BIP32 storefront that uses Electrum's key derivation path. The user passes me their MPK, and with every order I generate a new address based on the MPK. I'm able to generate addresses, but they don't match the one's created by Electrum. I'm using Electrum 2.2.
This is my code (I'm using pybitcointools command line). To keep thinks legible, I'm swapping out the actual values for $variables
.
> Using $xpub which is the MPK I copied from Electrum:
./pybtctools bip32_ckd $xpub 0
> $xpub0
./pybtctools bip32_ckd $xpub0 0
> $xpub00
./pybtctools pubtoaddr $xpub00
> $addr
My expectation is that the$addr
I end up with should match the the first address of my "receiving" addresses in Electrum. However, they don't match. Any thoughts on why that might be?
For reference the xpub I start with xpub661MyMwAqRbcGK5eE2eSWmnU4Pg6knZZqZEmREAgZ4vj6z3B5soecps7UJj37NF9aWhjEMQoyH9xgcC14KUgEGX9avagrdv9rcN56wjwXR2
and I get an address of 17VzXFqo6Kg7vMxNLWD5hhwgsdCV6XL9RT
(which is not in my Receiving addresses list).