| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bitcoin.Keys
Description
This module exports tools for working with Bitcoin keys.
Synopsis
- data Prv
- parsePrv :: ByteString -> Maybe Prv
- prvRaw :: Prv -> ByteString
- prvToPub :: Prv -> Pub
- data Pub
- parsePub :: ByteString -> Maybe Pub
- pubCompressed :: Pub -> ByteString
- pubUncompressed :: Pub -> ByteString
- data Tweak
- parseTweak :: ByteString -> Maybe Tweak
- pubAddTweak :: Tweak -> Pub -> Maybe Pub
- prvAddTweak :: Tweak -> Prv -> Maybe Prv
Private
Private key.
Construct with parsePrv.
prvRaw :: Prv -> ByteString Source #
Public
Public key.
Construct with parsePub.
parsePub :: ByteString -> Maybe Pub Source #
Construct a Pub key from either its compressed or uncompressed SEC-encoded
bytes.
- Compressed keys are 33 bytes. The leftmost byte is
0x02if theycoordinate is even, or0x03if odd. The remaining 32 bytes are the big-endian encodedxcoordinate. - Uncompressed keys are 65 bytes. The leftmost byte is
0x04. The next 32 bytes are the big-endian encodedxcordinate. The next 32 bytes are the big-endian encodedycoordinate.
Returns Nothing if something is not satisfied.
pubCompressed :: Pub -> ByteString Source #
Obtain the 33-bytes contatining the SEC compressed Public key.
Just==parsePub.pubCompressed
pubUncompressed :: Pub -> ByteString Source #
Obtain the 65-bytes contatining the SEC uncompressed Public key.
Just==parsePub.pubUncompressed
Tweak
A 32-byte number used to modify a Pub or Prv using prvAddTweak
or pubAddTweak.
parseTweak :: ByteString -> Maybe Tweak Source #
pubAddTweak :: Tweak -> Pub -> Maybe Pub Source #
Tweak a Public key by adding Tweak times the generator to it.
Returns Nothing if the resulting Pub would be invalid.
pubAddTweakt .prvToPub== fmapprvToPub.prvAddTweakt
prvAddTweak :: Tweak -> Prv -> Maybe Prv Source #
Tweak a Prvate key by adding Tweak times the generator to it.
Returns Nothing if the resulting Prv would be invalid.
pubAddTweakt .prvToPub== fmapprvToPub.prvAddTweakt