haskoin-core-0.8.0: Bitcoin & Bitcoin Cash library for Haskell

CopyrightNo rights reserved
LicenseUNLICENSE
Maintainerxenog@protonmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Network.Haskoin.Address.CashAddr

Description

Support for Bitcoin Cash (BCH) CashAddr format.

Synopsis

Documentation

type CashPrefix = Text Source #

CashAddr prefix, usually shown before the colon in addresses, but sometimes omitted. It is used in the checksum calculation to avoid parsing an address from the wrong network.

type CashVersion = Word8 Source #

CashAddr version, until new address schemes appear it will be zero.

type CashAddr = Text Source #

High level CashAddr human-reabale string, with explicit or implicit prefix.

type Cash32 = Text Source #

Low level Cash32 is the human-readable low-level encoding used by CashAddr. It need not encode a valid address but any binary data.

cashAddrDecode :: Network -> CashAddr -> Maybe (CashVersion, ByteString) Source #

High-Level: decode CashAddr string if it is valid for the provided Network. Prefix may be omitted from the string.

cashAddrEncode :: Network -> CashVersion -> ByteString -> Maybe CashAddr Source #

High-Level: encode CashAddr string for the provided network and hash. Fails if the CashVersion or length of hash ByteString is invalid.

cash32decodeType :: Cash32 -> Maybe (CashPrefix, CashVersion, ByteString) Source #

Mid-Level: decode CashAddr string containing arbitrary prefix, plus a version byte before the ByteString that encodes type and length.

cash32encodeType :: CashPrefix -> CashVersion -> ByteString -> Maybe Cash32 Source #

Mid-Level: encode CashAddr string containing arbitrary prefix and CashVersion. Length must be among those allowed by the standard.

cash32decode :: Cash32 -> Maybe (CashPrefix, ByteString) Source #

Low-Level: decode Cash32 string. CashPrefix must be part of the string. No version or hash length validation is performed.

cash32encode :: CashPrefix -> ByteString -> Cash32 Source #

Low-Level: encode Cash32 string for CashPrefix provided. Can encode arbitrary data. No prefix or length validation is performed.