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

Add methods to serialize and deserialize an extended public key according to bip-32 #128

Merged
merged 2 commits into from
Feb 7, 2022

Conversation

MrStahlfelge
Copy link
Member

Also added method to derive eip3 addresses from such a key

Needed for ergoplatform/ergo-wallet-app#32

…ding to bip-32 and to derive eip3 addresses from such a key
@@ -173,14 +174,35 @@ public static Address createEip3Address(
// Let's use "m/44'/429'/0'/0/index" path (this path is compliant with EIP-3 which
// is BIP-44 for Ergo)
DerivationPath path = JavaHelpers.eip3DerivationWithLastIndex(index);
ExtendedSecretKey secretKey = (ExtendedSecretKey)rootSecret.derive(path);
ExtendedSecretKey secretKey = (ExtendedSecretKey) rootSecret.derive(path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the method below can be reused here to avoid code cloning.

new DerivationPath((Seq) Constants.eip3DerivationPath().decodedPath().dropRight(1),
true));
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…ding to bip-32 and to derive eip3 addresses from such a key
@aslesarenko aslesarenko merged commit c89e0cb into develop Feb 7, 2022
@MrStahlfelge MrStahlfelge deleted the xpubserialization branch February 7, 2022 19:51
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