cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Address.Byron

Description

Byron bootstrap addresses with checked payloads and checksums. Imported encodings are retained exactly; construction assigns fresh CBOR and Base58.

import qualified Cometa.Address.Byron as Byron

inspectRoot text = Byron.root $ Byron.fromText text
Synopsis

Documentation

data Address Source #

An address with its original checked encoding. Equality and ordering compare address bytes; Show is diagnostic output, not its Base58 representation.

Instances

Instances details
Show Address Source # 
Instance details

Defined in Cometa.Address.Byron

Eq Address Source # 
Instance details

Defined in Cometa.Address.Byron

Methods

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

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

Ord Address Source # 
Instance details

Defined in Cometa.Address.Byron

data Root Source #

A 28-byte address root. Equality and ordering compare exact bytes.

Instances

Instances details
Show Root Source # 
Instance details

Defined in Cometa.Address.Byron

Methods

showsPrec :: Int -> Root -> ShowS #

show :: Root -> String #

showList :: [Root] -> ShowS #

Eq Root Source # 
Instance details

Defined in Cometa.Address.Byron

Methods

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

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

Ord Root Source # 
Instance details

Defined in Cometa.Address.Byron

Methods

compare :: Root -> Root -> Ordering #

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

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

(>) :: Root -> Root -> Bool #

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

max :: Root -> Root -> Root #

min :: Root -> Root -> Root #

rootFromBytes :: ByteString -> Either Error Root Source #

Import a 28-byte root without hashing; other lengths return InvalidByronAddress.

rootBytes :: Root -> ByteString Source #

Exact root bytes.

data AddressType Source #

The authority used to spend a Byron output.

Constructors

PublicKey

Verification-key authority.

Script

Script authority.

Redeem

Initial-distribution redemption key.

data Attributes Source #

Optional encrypted derivation payload and network magic. The payload is at most 64 bytes; empty payloads are represented as absent. Magic ranges from zero through 2^63-1. Absence identifies the main/staging network convention.

attributes :: Maybe ByteString -> Maybe Word64 -> Either Error Attributes Source #

Validate an encrypted payload and network magic. Invalid bounds return InvalidByronAddress. This neither decrypts nor authenticates the payload.

derivationPayload :: Attributes -> Maybe ByteString Source #

Encrypted derivation payload, when present.

networkMagic :: Attributes -> Maybe Word64 Source #

Network magic; absence uses the main/staging network convention.

address :: Root -> Attributes -> AddressType -> Address Source #

Assemble an address with minimal CBOR and a checksum of the exact payload.

root :: Address -> Root Source #

Address root without recomputation.

addressType :: Address -> AddressType Source #

Spending-authority form.

addressAttributes :: Address -> Attributes Source #

Validated encrypted payload and network discriminator.

fromBytes :: ByteString -> Either Error Address Source #

Validate complete outer and inner CBOR, tag 24, CRC32, root length, known unique attributes and type. Malformed or trailing input returns InvalidByronAddress. Accepted nonminimal and indefinite array framing is retained exactly; attribute values must each contain one complete value.

toBytes :: Address -> ByteString Source #

Exact accepted address bytes, or fresh bytes assigned by address.

fromText :: Text -> Either Error Address Source #

Parse Base58 and validate its address/checksum. Invalid characters, empty input, more than 512 characters or malformed data return InvalidByronAddressText.

toText :: Address -> Text Source #

Encode Base58 with the Bitcoin alphabet, without whitespace or a prefix.