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

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

Network.Haskoin.Address.Bech32

Description

Support for Bitcoin SegWit (BTC) Bech32 addresses. This module is a modified version of Marko Bencun's reference implementation.

Synopsis

Documentation

type HRP = Text Source #

Human-readable part of Bech32 address.

type Bech32 = Text Source #

Bech32 human-readable string.

type Data = [Word8] Source #

Data part of Bech32 address.

bech32Encode :: HRP -> [Word5] -> Maybe Bech32 Source #

Encode string of five-bit words into Bech32 using a provided human-readable part. Can fail if HRP is invalid or result would be longer than 90 characters.

bech32Decode :: Bech32 -> Maybe (HRP, [Word5]) Source #

Decode human-readable Bech32 string into a human-readable part and a string of five-bit words.

toBase32 :: [Word8] -> [Word5] Source #

Convert from eight-bit to five-bit word string, adding padding as required.

toBase256 :: [Word5] -> Maybe [Word8] Source #

Convert from five-bit word string to eight-bit word string, ignoring padding.

segwitEncode :: HRP -> Word8 -> Data -> Maybe Text Source #

Encode Data as a SegWit Bech32 address. Needs human-readable part and witness program version.

segwitDecode :: HRP -> Bech32 -> Maybe (Word8, Data) Source #

Decode SegWit Bech32 address from a string and expected human-readable part.

newtype Word5 Source #

Five-bit word for Bech32.

Constructors

UnsafeWord5 Word8 
Instances
Eq Word5 Source # 
Instance details

Defined in Network.Haskoin.Address.Bech32

Methods

(==) :: Word5 -> Word5 -> Bool #

(/=) :: Word5 -> Word5 -> Bool #

Ord Word5 Source # 
Instance details

Defined in Network.Haskoin.Address.Bech32

Methods

compare :: Word5 -> Word5 -> Ordering #

(<) :: Word5 -> Word5 -> Bool #

(<=) :: Word5 -> Word5 -> Bool #

(>) :: Word5 -> Word5 -> Bool #

(>=) :: Word5 -> Word5 -> Bool #

max :: Word5 -> Word5 -> Word5 #

min :: Word5 -> Word5 -> Word5 #

Ix Word5 Source # 
Instance details

Defined in Network.Haskoin.Address.Bech32

word5 :: Integral a => a -> Word5 Source #

Convert an integer number into a five-bit word.

fromWord5 :: Num a => Word5 -> a Source #

Convert a five-bit word into a number.