-
Notifications
You must be signed in to change notification settings - Fork 36
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 P-Chain address derivation support #118
base: master
Are you sure you want to change the base?
Conversation
assert.Nil(t, err) | ||
assert.Equal( | ||
t, | ||
"P-fuji15f9g0h5xkr5cp47n6u3qxj6yjtzzzrdr23a3tl", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how I verified the derivation:
keyData, err := keychain.ParsePrivateKeyAndDeriveAddresses(wc.runtimeConfig.NetworkConfig, privateKeyString)
if err != nil {
return err
}
println("Private Key :", keyData.PrivateKey.String())
println("Public Key :", hex.EncodeToString(keyData.PublicKey.Bytes()))
println("P Chain Bech32 Address :", keyData.Addresses.P)
Result:
Private Key : PrivateKey-2aazcWnVv1MicvTkqBhjuCkuhE6jdAN4tkXXMHyucKCzEQrNKm
Public Key : 02e0d4392cfa224d4be19db416b3cf62e90fb2b7015e7b62a95c8cb490514943f6
P Chain Bech32 Address : P-fuji15f9g0h5xkr5cp47n6u3qxj6yjtzzzrdr23a3tl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just nits, overall lgtm
@StephenButtolph fixed comments and rebase the master. |
We are going to merge something in to |
This PR adds support for P-Chain address derivation.
The P chain network identifier will be:
Test:
This change is backward compatible since it only derive P-chain address for P-chain request.
Will update test cases once core functionality and structure has been reviewed.