<p>looks like i was using pycoin wrong. for some reason the hex private key is not imported using a <code>H:</code>. the following works fine:</p>

<pre><code>$ ku c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

input                        : c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
network                      : Bitcoin mainnet
netcode                      : BTC
secret exponent              : 88985120633792790105905686761572077713049967498756747774697023364147812997770
 hex                         : c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
wif                          : L3p8oAcQTtuokSCRHQ7i4MhjWc9zornvpJLfmg62sYpLRJF9woSu
 uncompressed                : 5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS
public pair x                : 54652445751364966014814199642702485207468864303823415690143529040235143060593
public pair y                : 72966369330535479126907188414667138321635397511721864437822996012971795952725
 x as hex                    : 78d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71
 y as hex                    : a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455
y parity                     : odd
key pair as sec              : 0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71
 uncompressed                : 0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71\
                                 a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455
hash160                      : 79fbfc3f34e7745860d76137da68f362380c606c
 uncompressed                : c4c5d791fcb4654a1ef5e03fe0ad3d9c598f9827
Bitcoin address              : 1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8
Bitcoin address uncompressed : 1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T
</code></pre>

<p>i think <code>ku H:c4bbcb1f...</code> may be the way to import a bip32 private key, whereas <code>ku c4bbcb1f...</code> just imports a regular private key as secret exponent.</p>

CC BY-SA 3.0
2015-06-23T22:47:18.513Z
2015-06-23T23:00:24.483Z
2015-06-23T23:00:24.483Z
mulllhausen
<p>a well known private key is the sha256 hash of <code>correct horse battery staple</code> it yields:</p>

<pre><code>uncompressed address 1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T
compressed address 1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8
</code></pre>

<p>however i am unable to reproduce this result on <a href="https://github.com/richardkiss/pycoin" rel="nofollow">pycoin 0.53</a>. the sha256 hash is</p>

<pre><code>c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
</code></pre>

<p>but when i use the command-line utility <code>ku</code> in pycoin to import this secret in hex it does not yield the above addresses:</p>

<pre><code>$ ku H:c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

input                        : H:c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
network                      : Bitcoin mainnet
netcode                      : BTC
wallet key                   : xprv9s21ZrQH143K2yLSxbXemfny4nZroqhpiXEQ1MYx8vo2k7HRXypsWesNr7GkWT\
                                 uU9CeaW7QeR38NjjaSfZBAAZVkVEpXwEkxLLXP2q1iFUd
public version               : xpub661MyMwAqRbcFTQv4d4f8ojhcpQMDJRg5k9zojxZhGL1cuca5X984TBrhQw9ZJ\
                                 nvDdzsrjWG8nv4fsWjSU9HpX7pR3RKh2mezryhwXqvkF3
tree depth                   : 0
fingerprint                  : b501bac5
parent f'print               : 00000000
child index                  : 0
chain code                   : 5bbf1322eb26e8568dab5fdb60eb1dce21b0184ba5f6302a363d3d6fa673c630
private key                  : yes
secret exponent              : 10158881283648126355615721166211734569721037983262304808955335053160859610224
 hex                         : 1675b9196a0315b28d60cf62d835ca9e0c7756655f1ae267e72e87cd94f4ac70
wif                          : KwyNQchak8YmPrMjiZubCDbTGupAFPjQGp2A1mE2feyEkgjhPzNF
 uncompressed                : 5HzBHgMXJUYDKmiQGmACNaDLYhWiWziKsFjQLf7aTRv52NeoYhE
public pair x                : 51123819464118526280373633109955475860846079595385829435773454059765711587420
public pair y                : 69375255639189423482159707295881791099365542658018779127323111014791716296211
 x as hex                    : 71070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c
 y as hex                    : 996100d13953e2d4815df164d89d27e8af148c31e2847631acc45928c89c5613
y parity                     : odd
key pair as sec              : 0371070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c
 uncompressed                : 0471070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c\
                                 996100d13953e2d4815df164d89d27e8af148c31e2847631acc45928c89c5613
hash160                      : b501bac5295fc5a812879a5483c456b554e0f994
 uncompressed                : c76a0a580bb6582e3f7e5e80324b0241b63f6eeb
Bitcoin address              : 1HW5NtrRYqmvvF36hxvGFf7e4F2voLyVk2
Bitcoin address uncompressed : 1KBQVzU9DnJCDZPe1r1T9SkrJAniJ2PUCx
</code></pre>

<private-key><pycoin>
pycoin deriving wrong addresses from private key
mulllhausen
# pycoin deriving wrong addresses from private key

(Asked by: username_0 on 2015-06-23)

a well known private key is the sha256 hash of `correct horse battery staple` it yields:

```
uncompressed address 1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T
compressed address 1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8

```

however i am unable to reproduce this result on [pycoin 0.53](https://github.com/richardkiss/pycoin). the sha256 hash is

```
c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

```

but when i use the command-line utility `ku` in pycoin to import this secret in hex it does not yield the above addresses:

```
$ ku H:c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

input                        : H:c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
network                      : Bitcoin mainnet
netcode                      : BTC
wallet key                   : xprv9s21ZrQH143K2yLSxbXemfny4nZroqhpiXEQ1MYx8vo2k7HRXypsWesNr7GkWT\
                                 uU9CeaW7QeR38NjjaSfZBAAZVkVEpXwEkxLLXP2q1iFUd
public version               : xpub661MyMwAqRbcFTQv4d4f8ojhcpQMDJRg5k9zojxZhGL1cuca5X984TBrhQw9ZJ\
                                 nvDdzsrjWG8nv4fsWjSU9HpX7pR3RKh2mezryhwXqvkF3
tree depth                   : 0
fingerprint                  : b501bac5
parent f'print               : 00000000
child index                  : 0
chain code                   : 5bbf1322eb26e8568dab5fdb60eb1dce21b0184ba5f6302a363d3d6fa673c630
private key                  : yes
secret exponent              : 10158881283648126355615721166211734569721037983262304808955335053160859610224
 hex                         : 1675b9196a0315b28d60cf62d835ca9e0c7756655f1ae267e72e87cd94f4ac70
wif                          : KwyNQchak8YmPrMjiZubCDbTGupAFPjQGp2A1mE2feyEkgjhPzNF
 uncompressed                : 5HzBHgMXJUYDKmiQGmACNaDLYhWiWziKsFjQLf7aTRv52NeoYhE
public pair x                : 51123819464118526280373633109955475860846079595385829435773454059765711587420
public pair y                : 69375255639189423482159707295881791099365542658018779127323111014791716296211
 x as hex                    : 71070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c
 y as hex                    : 996100d13953e2d4815df164d89d27e8af148c31e2847631acc45928c89c5613
y parity                     : odd
key pair as sec              : 0371070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c
 uncompressed                : 0471070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c\
                                 996100d13953e2d4815df164d89d27e8af148c31e2847631acc45928c89c5613
hash160                      : b501bac5295fc5a812879a5483c456b554e0f994
 uncompressed                : c76a0a580bb6582e3f7e5e80324b0241b63f6eeb
Bitcoin address              : 1HW5NtrRYqmvvF36hxvGFf7e4F2voLyVk2
Bitcoin address uncompressed : 1KBQVzU9DnJCDZPe1r1T9SkrJAniJ2PUCx

```

**Tags:** private-key, pycoin


---

## 1 answers

### Answer by username_0 on 2015-06-23. Score: 6 | Accepted answer

looks like i was using pycoin wrong. for some reason the hex private key is not imported using a `H:`. the following works fine:

```
$ ku c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

input                        : c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
network                      : Bitcoin mainnet
netcode                      : BTC
secret exponent              : 88985120633792790105905686761572077713049967498756747774697023364147812997770
 hex                         : c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
wif                          : L3p8oAcQTtuokSCRHQ7i4MhjWc9zornvpJLfmg62sYpLRJF9woSu
 uncompressed                : 5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS
public pair x                : 54652445751364966014814199642702485207468864303823415690143529040235143060593
public pair y                : 72966369330535479126907188414667138321635397511721864437822996012971795952725
 x as hex                    : 78d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71
 y as hex                    : a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455
y parity                     : odd
key pair as sec              : 0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71
 uncompressed                : 0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71\
                                 a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455
hash160                      : 79fbfc3f34e7745860d76137da68f362380c606c
 uncompressed                : c4c5d791fcb4654a1ef5e03fe0ad3d9c598f9827
Bitcoin address              : 1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8
Bitcoin address uncompressed : 1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T

```

i think `ku H:c4bbcb1f...` may be the way to import a bip32 private key, whereas `ku c4bbcb1f...` just imports a regular private key as secret exponent.


---

