Skip to content

Conversation

@moocowmoo
Copy link

This patch allows the creation of bip38 keys for addresses created by
Richard Kiss' BIP32 pycoin (genwallet) utility.

test vector outputs:

    $ python -c 'import binascii; open("master-private-key-entropy", "w+b").write(binascii.unhexlify("000102030405060708090a0b0c0d0e0f"))' > test.bip3

    $ genwallet -f test.bip32.seed -i
    xprv9s21ZrQH143K3LhEXZMXowo9hkNiaiDVhfvnGpXCimZtiRc5gJmq1YLKjLeg7iR2xDU8gks56oB1JXxwBzNkX5GHQtnjActTpWudHkpbgNu
    main network
    private key
    secret exponent: 64984153768961157829826368741579665624823626924420053033036842588453764406980
    public pair x:   68560981314052299508403304659895617070088830480209293291335193415198847031373
    public pair y:   90409367661552839451235119846362341380971283312313541569547197748756276715666
    tree depth:      0
    fingerprint:     a4ea9e94
    parent f'print:  00000000
    child index:     0
    chain code:      80bbda1ee5fdc3d94a217325d2fd7290cbd69cb91fc69dc8d21e84c9a7fe870d
    WIF:             L22zGSFr75Cix3h8BUKxfyRUTpxEnNC442pvjnwP2F2GNEppUKuc
      uncompressed:  5JuZTcBAK9CigCwQNrh6N4io6dEshdyRi1sHFgQecdFnd7eMcgL
    Bitcoin address: 1G2zt786BsvKJXAvTamW3Bds64e6pcQBMx
      uncompressed:  1PqxhQ4mJNUVUPoWGznMhqf33HGcfaonaH

tested with above values:

    copy secret exponent, paste seed into PyBrainwallet
            64984153768961157829826368741579665624823626924420053033036842588453764406980

    check bip32 checkbox, uncompressed key and address will appear
            5JuZTcBAK9CigCwQNrh6N4io6dEshdyRi1sHFgQecdFnd7eMcgL
            1PqxhQ4mJNUVUPoWGznMhqf33HGcfaonaH

    check bip38 checkbox, encrypt with string 'secret', get bip38 key
            6PRSKsniRtueuhY2LM47EvXtfzKkAbrtsDasXhUpZgNBRqBdy56cHVLCMj

    import key using mycelium wallet, enter password 'secret'

    key successfully imported

This patch allows the creation of bip38 keys for addresses created by
Richard Kiss' BIP32 pycoin (genwallet) utility.

    test vector outputs:

        $ python -c 'import binascii; open("master-private-key-entropy", "w+b").write(binascii.unhexlify("000102030405060708090a0b0c0d0e0f"))' > test.bip3

        $ genwallet -f test.bip32.seed -i
        xprv9s21ZrQH143K3LhEXZMXowo9hkNiaiDVhfvnGpXCimZtiRc5gJmq1YLKjLeg7iR2xDU8gks56oB1JXxwBzNkX5GHQtnjActTpWudHkpbgNu
        main network
        private key
        secret exponent: 64984153768961157829826368741579665624823626924420053033036842588453764406980
        public pair x:   68560981314052299508403304659895617070088830480209293291335193415198847031373
        public pair y:   90409367661552839451235119846362341380971283312313541569547197748756276715666
        tree depth:      0
        fingerprint:     a4ea9e94
        parent f'print:  00000000
        child index:     0
        chain code:      80bbda1ee5fdc3d94a217325d2fd7290cbd69cb91fc69dc8d21e84c9a7fe870d
        WIF:             L22zGSFr75Cix3h8BUKxfyRUTpxEnNC442pvjnwP2F2GNEppUKuc
          uncompressed:  5JuZTcBAK9CigCwQNrh6N4io6dEshdyRi1sHFgQecdFnd7eMcgL
        Bitcoin address: 1G2zt786BsvKJXAvTamW3Bds64e6pcQBMx
          uncompressed:  1PqxhQ4mJNUVUPoWGznMhqf33HGcfaonaH

    tested with above values:

        copy secret exponent, paste seed into PyBrainwallet
                64984153768961157829826368741579665624823626924420053033036842588453764406980

        check bip32 checkbox, uncompressed key and address will appear
                5JuZTcBAK9CigCwQNrh6N4io6dEshdyRi1sHFgQecdFnd7eMcgL
                1PqxhQ4mJNUVUPoWGznMhqf33HGcfaonaH

        check bip38 checkbox, encrypt with string 'secret', get bip38 key
                6PRSKsniRtueuhY2LM47EvXtfzKkAbrtsDasXhUpZgNBRqBdy56cHVLCMj

        import key using mycelium wallet, enter password 'secret'

        key successfully imported
@moocowmoo
Copy link
Author

error in commit message. should be:

python -c 'import binascii; open("test.bip32.seed", "w+b").write(binascii.unhexlify("000102030405060708090a0b0c0d0e0f"))'

@nomorecoin
Copy link
Owner

I'll look this over when I have a bit more time set aside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants