<p>addrgen author here!</p>

<p>Addrgen was created before Electrum was BIP-0032 compatible and thus it used different master public keys and derivation method.</p>

<p>Please check the following PHP implementation which supports BIP-0032:</p>

<ul>
<li><a href="https://github.com/Bit-Wasp/bitcoin-lib-php" rel="nofollow">https://github.com/Bit-Wasp/bitcoin-lib-php</a></li>
</ul>

<p>For python there are couple of implementations available, e.g.</p>

<ul>
<li><a href="https://pypi.python.org/pypi/bip32utils" rel="nofollow">https://pypi.python.org/pypi/bip32utils</a></li>
<li><a href="https://pypi.python.org/pypi/pycoin/" rel="nofollow">https://pypi.python.org/pypi/pycoin/</a></li>
<li><a href="https://pypi.python.org/pypi/bitcoin/" rel="nofollow">https://pypi.python.org/pypi/bitcoin/</a></li>
</ul>

CC BY-SA 3.0
2015-05-26T01:46:48.820Z
Bitwasp guy here, maybe check out https://github.com/Bit-Wasp/bitcoin-php  rewrote the old library - src/Key/HierarchicalKeyFactory.php is probably what you need
karimkorun
CC BY-SA 3.0
2015-05-25T22:13:13.000Z
2015-06-02T20:32:38.750Z
2015-06-02T20:32:38.750Z
Pavol Rusnak
<p>I'm trying to generate bip32 addresses using the following (the PHP version).</p>

<p><a href="https://github.com/prusnak/addrgen" rel="nofollow">https://github.com/prusnak/addrgen</a></p>

<p>The author provides a test MPK which I can get working that looks like this:</p>

<pre><code>675b7041a347223984750fe3ab229df0c9f960e7ec98226b7182a2cb1990e39901feecf5a670f1d788ab29f626e20de424f049d216fc6f4c6ec42506763fa28e
</code></pre>

<p>However, the MPK I export from electrum does not work. Its much shorter and looks like this:</p>

<pre><code>xpub661MyMwAqRbcGntu46CZtzegh5V3vT624SJqPVUgqzboX6A39f1hb8vEMrG555gV5QzVXEpPXqwayMQKu1ZKKRLkX9AoFvqPwAm3qL24AnE
</code></pre>

<p>The exact message I get is</p>

<pre><code>pack(): Type H: illegal hex digit x
</code></pre>

<p>Any idea whats going on? Why does electrum's MPK not resemble the authors?</p>

<electrum><bip32-hd-wallets><deterministic-wallets>
Problems generating addresses using bip32
Akhil F
# Problems generating addresses using bip32

(Asked by: username_0 on 2015-05-25)

I'm trying to generate bip32 addresses using the following (the PHP version).
https://github.com/prusnak/addrgen
The author provides a test MPK which I can get working that looks like this:
675b7041a347223984750fe3ab229df0c9f960e7ec98226b7182a2cb1990e39901feecf5a670f1d788ab29f626e20de424f049d216fc6f4c6ec42506763fa28e

However, the MPK I export from electrum does not work. Its much shorter and looks like this:
xpub661MyMwAqRbcGntu46CZtzegh5V3vT624SJqPVUgqzboX6A39f1hb8vEMrG555gV5QzVXEpPXqwayMQKu1ZKKRLkX9AoFvqPwAm3qL24AnE

The exact message I get is
pack(): Type H: illegal hex digit x

Any idea whats going on? Why does electrum's MPK not resemble the authors?

**Tags:** electrum, bip32-hd-wallets, deterministic-wallets


---

## 1 answers

### Answer by username_1 on 2015-05-25. Score: 3 | Accepted answer

addrgen author here!

Addrgen was created before Electrum was BIP-0032 compatible and thus it used different master public keys and derivation method.

Please check the following PHP implementation which supports BIP-0032:

* <https://github.com/Bit-Wasp/bitcoin-lib-php>

For python there are couple of implementations available, e.g.

* <https://pypi.python.org/pypi/bip32utils>
* <https://pypi.python.org/pypi/pycoin/>
* <https://pypi.python.org/pypi/bitcoin/>

> **Comments:**
> **username_2**: Bitwasp guy here, maybe check out https://github.com/Bit-Wasp/bitcoin-php  rewrote the old library - src/Key/HierarchicalKeyFactory.php is probably what you need  

---

