Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Generating Private Keys #2777

Closed
quantumproducer opened this issue Apr 12, 2018 · 4 comments
Closed

Generating Private Keys #2777

quantumproducer opened this issue Apr 12, 2018 · 4 comments

Comments

@quantumproducer
Copy link

Hello,

Where can I find documentation for how a private key is generated + what it involves?

I tried looking at: https://github.com/input-output-hk/cardano-sl/blob/master/wallet/src/Pos/Wallet/Aeson/WalletBackup.hs

Example:

"In Bitcoin, a private key is a 256-bit number, which can be represented one of several ways. Here is a private key in hexadecimal - 256 bits in hexadecimal is 32 bytes, or 64 characters in the range 0-9 or A-F. " from https://en.bitcoin.it/wiki/Private_key

I want to generate a private key by coin flipping so I need to understand how this works.

@erikd
Copy link
Member

erikd commented Apr 12, 2018

I think the code you are looking for is here : https://github.com/input-output-hk/cardano-crypto/blob/master/src/Cardano/Crypto/Wallet.hs#L91. Obviously test everything you are doing very, very carefully :)

@quantumproducer
Copy link
Author

Thanks @erikd . I saw "n -> Either String XPrv
xprv bs = maybe (Left "error: xprv need to be 128 bytes") (Right . XPrv)"

indicating 128 bytes.. but a seed is only 32 bytes?
generate seed passPhrase
| B.length seed < 32 = error ("Wallet.generate: seed need to be >= 32 bytes, got : " ++ show (B.length seed))

I want to generate a private key by hand then import that into an offline wallet to manage funds.

@erikd
Copy link
Member

erikd commented Apr 12, 2018

Sorry, I am not familiar with that code, I just came across it recently while investigating another issue.

Since this question is actually about the cardano-crypto project I would recommend that you close this issue and raise an issue on the relevant project.

@quantumproducer
Copy link
Author

Reopened in IntersectMBO/cardano-crypto#37

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants