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

Utility function to get Tezos Address (PKH) from a public key #643

Closed
jevonearth opened this issue Feb 22, 2021 · 1 comment
Closed

Utility function to get Tezos Address (PKH) from a public key #643

jevonearth opened this issue Feb 22, 2021 · 1 comment
Assignees
Milestone

Comments

@jevonearth
Copy link
Collaborator

jevonearth commented Feb 22, 2021

Is your feature request related to a problem and use case? Please describe.

Sometimes a user wants to get the public key hash from a public key.

Describe the solution you'd like

tz1/ed25519 case

Given a public key: edpku61nGAwkeoA7PQJEFWmrVP1eWrSTVoHgCaF2isjWqDeGdux37k
I want a function that will give me the PKH: tz1ipB38oB5F76HnbTRqWPLEnVtCgj6yf2nB

tz2/secp256k1 case

Given a public key: sppk7czKu6So3zDWjhBPBv9wgCrBAfbEFoKYzEaKUsjhNr5Ug6E4Sn1
I want a function that will give me the PKH: tz2Gsf1Q857wUzkNGzHsJNC98z881UutMwjg

tz3/p256 case

Given a public key: p2pk67BANWUUX2fod9EQbv8ev7GGLpb4UXvLHEVVMiHBSWPHgyzf1tv
I want a function that will give me the PKH: tz3daYfTrShLBfH24hv2kGwXD5y2bApH83RC

Implementation details
In the @taquito/utils package, implement a helper function that will take a public key as a parameter and return the public key hash.
The function needs to support the 3 curves (ed25519, secp256k1, and p256).
Consider using the b58cdecode and b58cencode functions of the utils package and the hash function from '@stablelib/blake2b' library.

Describe alternatives you've considered

...

@jevonearth
Copy link
Collaborator Author

Could be addressed at the same time as #611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants