Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with wallet derivation with testnet #47

Closed
elbelga opened this issue Apr 19, 2018 · 1 comment
Closed

Problems with wallet derivation with testnet #47

elbelga opened this issue Apr 19, 2018 · 1 comment
Labels
invalid This doesn't seem right

Comments

@elbelga
Copy link

elbelga commented Apr 19, 2018

Hi, I believe that there is a problem in derivation and some time doesn't work well. I made some tests with testnet and validate results with https://iancoleman.io/bip39/ and it doesn't match.

I found that in the file BitcoinKitPrivate.m (line 147) you save new private key like this (and some times data length is less than 32 bytes)

    result = [NSMutableData dataWithLength:numBytes];
    BN_bn2bin(privateKey, result.mutableBytes);

and I believe that you need to save new private key like this

    result = [NSMutableData dataWithLength:32];
    BN_bn2bin(privateKey, &result.mutableBytes[32-numBytes]);

Regards

@usatie usatie added the invalid This doesn't seem right label Aug 14, 2018
@usatie
Copy link
Member

usatie commented Aug 14, 2018

Hi @elbelga !
Thanks for giving us a comment!

I tried that site and compared the result for 1000 addresses.
But the results of BitcoinKit was completely equal to those of https://iancoleman.io/bip39/ without applying your change.
3 out of 1000 result was not equal with your change.

So, I guess current implementation is okay, but if you still have the problem, give me more specific test case please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants