Copyright | No rights reserved |
---|---|
License | UNLICENSE |
Maintainer | xenog@protonmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Base58, CashAddr, Bech32 address and WIF private key serialization support.
Synopsis
- data Address
- = PubKeyAddress { }
- | ScriptAddress { }
- | WitnessPubKeyAddress { }
- | WitnessScriptAddress { }
- isPubKeyAddress :: Address -> Bool
- isScriptAddress :: Address -> Bool
- isWitnessPubKeyAddress :: Address -> Bool
- isWitnessScriptAddress :: Address -> Bool
- addrToString :: Network -> Address -> Text
- stringToAddr :: Network -> Text -> Maybe Address
- addrToJSON :: Network -> Address -> Value
- addrFromJSON :: Network -> Value -> Parser Address
- pubKeyAddr :: PubKeyI -> Address
- pubKeyWitnessAddr :: PubKeyI -> Address
- p2pkhAddr :: Hash160 -> Address
- p2wpkhAddr :: Hash160 -> Address
- p2shAddr :: Hash160 -> Address
- p2wshAddr :: Hash256 -> Address
- inputAddress :: ScriptInput -> Maybe Address
- outputAddress :: ScriptOutput -> Maybe Address
- addressToScript :: Address -> Script
- addressToScriptBS :: Address -> ByteString
- addressToOutput :: Address -> ScriptOutput
- payToScriptAddress :: ScriptOutput -> Address
- payToWitnessScriptAddress :: ScriptOutput -> Address
- scriptToAddress :: Script -> Either String Address
- scriptToAddressBS :: ByteString -> Either String Address
- fromWif :: Network -> Base58 -> Maybe SecKeyI
- toWif :: Network -> SecKeyI -> Base58
Documentation
Address format for Bitcoin and Bitcoin Cash.
PubKeyAddress | pay to public key hash (regular) |
| |
ScriptAddress | pay to script hash |
| |
WitnessPubKeyAddress | pay to witness public key hash |
| |
WitnessScriptAddress | pay to witness script hash |
|
Instances
Eq Address Source # | |
Ord Address Source # | |
Read Address Source # | |
Show Address Source # | |
Generic Address Source # | |
Hashable Address Source # | |
Defined in Network.Haskoin.Address | |
Serialize Address Source # | |
type Rep Address Source # | |
Defined in Network.Haskoin.Address type Rep Address = D1 (MetaData "Address" "Network.Haskoin.Address" "haskoin-core-0.8.2-DBbfowLuwQJDnYGV2ClFSV" False) ((C1 (MetaCons "PubKeyAddress" PrefixI True) (S1 (MetaSel (Just "getAddrHash160") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Hash160)) :+: C1 (MetaCons "ScriptAddress" PrefixI True) (S1 (MetaSel (Just "getAddrHash160") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Hash160))) :+: (C1 (MetaCons "WitnessPubKeyAddress" PrefixI True) (S1 (MetaSel (Just "getAddrHash160") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Hash160)) :+: C1 (MetaCons "WitnessScriptAddress" PrefixI True) (S1 (MetaSel (Just "getAddrHash256") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Hash256)))) |
isWitnessPubKeyAddress :: Address -> Bool Source #
Address
pays to a witness public key hash. Only valid for SegWit
networks.
isWitnessScriptAddress :: Address -> Bool Source #
Address
pays to a witness script hash. Only valid for SegWit networks.
pubKeyAddr :: PubKeyI -> Address Source #
Obtain a P2PKH address from a public key.
pubKeyWitnessAddr :: PubKeyI -> Address Source #
Obtain a P2WPKH address from a public key. Only on SegWit networks.
inputAddress :: ScriptInput -> Maybe Address Source #
Infer the Address
of a ScriptInput
.
outputAddress :: ScriptOutput -> Maybe Address Source #
Get the Address
of a ScriptOutput
.
addressToScriptBS :: Address -> ByteString Source #
Encode address as output script in ByteString
form.
addressToOutput :: Address -> ScriptOutput Source #
Encode an output script from an address. Will fail if using a pay-to-witness address on a non-SegWit network.
payToScriptAddress :: ScriptOutput -> Address Source #
Compute a pay-to-script-hash address for an output script.
payToWitnessScriptAddress :: ScriptOutput -> Address Source #
Compute a pay-to-witness-script-hash address for an output script. Only on SegWit networks.
scriptToAddress :: Script -> Either String Address Source #
Decode an output script into an Address
if it has such representation.
scriptToAddressBS :: ByteString -> Either String Address Source #
Decode a serialized script into an Address
.