Emurgo / cardano-serialization-lib

This is a library, written in Rust, for serialization & deserialization of data structures used in Cardano's Haskell implementation of Alonzo along with useful utility functions.
Other
235 stars 125 forks source link

How to generate key pairs like with cardano-cli? #198

Closed ghost closed 3 years ago

ghost commented 3 years ago

I want to be able to generate vkey & skey pairs and then addresses from like we do for payment and stake addresses.

vsubhuman commented 3 years ago

Hi! You can find an example of how both the staking key and external addresses are created from a root private key here in the Yoroi code: https://github.com/Emurgo/yoroi-frontend/blob/90e4c8aeeae8710145aa1daeecb640aa54fc79a3/packages/yoroi-extension/app/api/ada/lib/cardanoCrypto/plate.js#L45-L73

And here you can find how to get the Bip32PrivateKey from your mnemonic words: https://github.com/Emurgo/yoroi-frontend/blob/90e4c8aeeae8710145aa1daeecb640aa54fc79a3/packages/yoroi-extension/app/api/ada/lib/cardanoCrypto/cryptoWallet.js#L66-L82