go-bip32 icon indicating copy to clipboard operation
go-bip32 copied to clipboard

Verify Child key parent relation

Open Pierozi opened this issue 5 years ago • 2 comments

Hello,

Did you know if it will be possible to integrate a verification method to check if a Child public key is derivated from another public key to check the parent relation?

As my understanding we must implement this algo: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#public-parent-key--public-child-key

Thanks for your library btw 👏

Pierozi avatar Sep 16 '19 20:09 Pierozi

i think it is easy to implement the verification method to check. First you should know the public key and index(es), Then call NewChildKey. At last, check the NewChildKey.PublicKey whether equals distPublickey

Finally, This library has already implemented public parent key to public child key this function is integrated in method NewChildKey

freespiriter avatar Jun 01 '20 16:06 freespiriter

@freespiriter I do not want to create a new key and compare it. But rather be able to know if a Child key has been derived from a master key.

For people that could be interested, I have done the implementation using the proper hash combination. https://github.com/PeerVault/PeerVault-Service/blob/master/src/crypto/crypto.go#L113

Pierozi avatar Jun 20 '20 15:06 Pierozi