cardano-ledger-byron-0.1.0.0: The blockchain layer of Cardano during the Byron era
Safe Haskell None
Language Haskell2010

Cardano.Chain.Common

Synopsis

Documentation

data TxSizeLinear Source #

A linear equation on the transaction size. Represents the s -> a + b*s function where s is the transaction size in bytes, a and b are constant coefficients.

Instances

Instances details
Eq TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Ord TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Show TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Generic TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

NFData TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

ToJSON TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

ToCBOR TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

FromCBOR TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Buildable TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

NoThunks TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

type Rep TxSizeLinear Source #
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

data TxFeePolicy Source #

Transaction fee policy represents a formula to compute the minimal allowed Fee for a transaction. Transactions with lesser fees won't be accepted. The Minimal fee may depend on the properties of a transaction (for example, its Size in bytes), so the policy can't be represented simply as a number.

Recall that a transaction fee is the difference between the sum of its Inputs and the sum of its outputs. The transaction is accepted when minimal_fee(tx) <= fee(tx) , where minimal_fee is the function defined By the policy.

The policy can change during the lifetime of the blockchain (using the Update mechanism). At the moment we have just one policy type (a linear Equation on the transaction size), but in the future other policies may Be added. To make this future-proof, we also have an "unknown" policy used By older node versions (the ones that haven't updated yet).

Instances

Instances details
Eq TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Ord TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Show TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Generic TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

NFData TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

ToJSON TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

ToCBOR TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

FromCBOR TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Buildable TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

NoThunks TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Monad m => ToJSON m TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

MonadError SchemaError m => FromJSON m TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

type Rep TxFeePolicy Source #
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

type Rep TxFeePolicy = D1 (' MetaData "TxFeePolicy" "Cardano.Chain.Common.TxFeePolicy" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "TxFeePolicyTxSizeLinear" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TxSizeLinear )))

data NetworkMagic Source #

Instances

Instances details
Eq NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Ord NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Show NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Generic NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

NFData NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

ToJSON NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

ToCBOR NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

FromCBOR NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

HeapWords NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Buildable NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

NoThunks NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

type Rep NetworkMagic Source #
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

type Rep NetworkMagic = D1 (' MetaData "NetworkMagic" "Cardano.Chain.Common.NetworkMagic" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "NetworkMainOrStage" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "NetworkTestnet" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' SourceUnpack ' SourceStrict ' DecidedStrict ) ( Rec0 Word32 )))

MerkleRoot

newtype MerkleRoot a Source #

Data type for root of Merkle tree

Constructors

MerkleRoot

Fields

Instances

Instances details
Eq ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Ord ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Show ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Generic ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Associated Types

type Rep ( MerkleRoot a) :: Type -> Type Source #

NFData ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

ToJSON a => ToJSON ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

ToCBOR a => ToCBOR ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

FromCBOR a => FromCBOR ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Buildable ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

NoThunks ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep ( MerkleRoot a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep ( MerkleRoot a) = D1 (' MetaData "MerkleRoot" "Cardano.Chain.Common.Merkle" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "MerkleRoot" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getMerkleRoot") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Hash Raw ))))

MerkleTree

data MerkleTree a Source #

Instances

Instances details
Foldable MerkleTree Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Eq a => Eq ( MerkleTree a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Show a => Show ( MerkleTree a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Generic ( MerkleTree a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Associated Types

type Rep ( MerkleTree a) :: Type -> Type Source #

NFData a => NFData ( MerkleTree a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

ToCBOR a => ToCBOR ( MerkleTree a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

( FromCBOR a, ToCBOR a) => FromCBOR ( MerkleTree a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep ( MerkleTree a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

mtRoot :: MerkleTree a -> MerkleRoot a Source #

Returns root of Merkle tree

MerkleNode

data MerkleNode a Source #

Constructors

MerkleBranch !( MerkleRoot a) !( MerkleNode a) !( MerkleNode a)

MerkleBranch mRoot mLeft mRight

MerkleLeaf !( MerkleRoot a) a

MerkleLeaf mRoot mVal

Instances

Instances details
Foldable MerkleNode Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Eq a => Eq ( MerkleNode a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Show a => Show ( MerkleNode a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Generic ( MerkleNode a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

Associated Types

type Rep ( MerkleNode a) :: Type -> Type Source #

NFData a => NFData ( MerkleNode a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep ( MerkleNode a) Source #
Instance details

Defined in Cardano.Chain.Common.Merkle

data LovelacePortion Source #

LovelacePortion is a legacy Byron type that we keep only for compatibility. It was originally intended to represent a fraction of stake in the system. It is used only for the thresholds used in the update system rules, most of which are now themselves unused. The remaining case is no longer interpreted as a fraction of all stake, but as a fraction of the number of genesis keys.

It has enormous precision, due to the fact that it was originally intended to represent a fraction of all stake and can cover the precision of all the Lovelace in the system.

It is represented as a rational nominator with a fixed implicit denominator of 1e15. So the nominator must be in the range [0..1e15] . This is also the representation used on-chain (in update proposals) and in the JSON genesis file.

It is interpreted as a Rational via the provided conversion functions.

Instances

Instances details
Eq LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Ord LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Show LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Generic LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

NFData LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

ToJSON LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

ToCBOR LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

FromCBOR LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

HeapWords LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Buildable LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

NoThunks LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Monad m => ToJSON m LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

MonadError SchemaError m => FromJSON m LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

type Rep LovelacePortion Source #
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

type Rep LovelacePortion = D1 (' MetaData "LovelacePortion" "Cardano.Chain.Common.LovelacePortion" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "LovelacePortion" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unLovelacePortion") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Word64 )))

Lovelace

data Lovelace Source #

Lovelace is the least possible unit of currency

Instances

Instances details
Bounded Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Eq Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Data Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Lovelace -> c Lovelace Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c Lovelace Source #

toConstr :: Lovelace -> Constr Source #

dataTypeOf :: Lovelace -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c Lovelace ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c Lovelace ) Source #

gmapT :: ( forall b. Data b => b -> b) -> Lovelace -> Lovelace Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Lovelace -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Lovelace -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> Lovelace -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> Lovelace -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Lovelace -> m Lovelace Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Lovelace -> m Lovelace Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Lovelace -> m Lovelace Source #

Ord Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Show Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Generic Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

NFData Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

ToJSON Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

ToCBOR Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

FromCBOR Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Buildable Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

NoThunks Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Monad m => ToJSON m Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

ReportSchemaErrors m => FromJSON m Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

type Rep Lovelace Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

type Rep Lovelace = D1 (' MetaData "Lovelace" "Cardano.Chain.Common.Lovelace" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "Lovelace" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unLovelace") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Word64 )))

data LovelaceError Source #

Instances

Instances details
Eq LovelaceError Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Data LovelaceError Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> LovelaceError -> c LovelaceError Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c LovelaceError Source #

toConstr :: LovelaceError -> Constr Source #

dataTypeOf :: LovelaceError -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c LovelaceError ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c LovelaceError ) Source #

gmapT :: ( forall b. Data b => b -> b) -> LovelaceError -> LovelaceError Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> LovelaceError -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> LovelaceError -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> LovelaceError -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> LovelaceError -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> LovelaceError -> m LovelaceError Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> LovelaceError -> m LovelaceError Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> LovelaceError -> m LovelaceError Source #

Show LovelaceError Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

ToCBOR LovelaceError Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

FromCBOR LovelaceError Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Buildable LovelaceError Source #
Instance details

Defined in Cardano.Chain.Common.Lovelace

Constructors

mkKnownLovelace :: forall n. ( KnownNat n, n <= 45000000000000000) => Lovelace Source #

Construct a Lovelace from a KnownNat , known to be less than maxLovelaceVal

Formatting

lovelaceF :: Format r ( Lovelace -> r) Source #

Lovelace formatter which restricts type.

Conversions

unsafeGetLovelace :: Lovelace -> Word64 Source #

Unwraps Lovelace . It's called “unsafe” so that people wouldn't use it willy-nilly if they want to sum lovelace or something. It's actually safe.

Arithmetic operations

sumLovelace :: ( Foldable t, Functor t) => t Lovelace -> Either LovelaceError Lovelace Source #

Compute sum of all lovelace in container. Result is Integer as a protection against possible overflow.

newtype KeyHash Source #

Instances

Instances details
Eq KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

Ord KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

Show KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

NFData KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

ToCBOR KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

FromCBOR KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

HeapWords KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

Buildable KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

NoThunks KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

Monad m => ToObjectKey m KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

MonadError SchemaError m => FromObjectKey m KeyHash Source #
Instance details

Defined in Cardano.Chain.Common.KeyHash

data CompactAddress Source #

A compact in-memory representation for an Address .

Convert using toCompactAddress and fromCompactAddress .

Instances

Instances details
Eq CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

Ord CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

Show CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

Generic CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

NFData CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

ToCBOR CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

FromCBOR CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

HeapWords CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

NoThunks CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

type Rep CompactAddress Source #
Instance details

Defined in Cardano.Chain.Common.Compact

type Rep CompactAddress = D1 (' MetaData "CompactAddress" "Cardano.Chain.Common.Compact" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "CompactAddress" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ShortByteString )))

newtype ChainDifficulty Source #

Chain difficulty represents necessary effort to generate a chain. In the simplest case it can be number of blocks in chain.

Instances

Instances details
Enum ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Eq ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Ord ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Show ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Generic ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

NFData ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

ToJSON ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

ToCBOR ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

FromCBOR ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Buildable ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

NoThunks ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

type Rep ChainDifficulty Source #
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

type Rep ChainDifficulty = D1 (' MetaData "ChainDifficulty" "Cardano.Chain.Common.ChainDifficulty" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "ChainDifficulty" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unChainDifficulty") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Word64 )))

CBOR in CBOR

These utilities are is used in the Byron-era chain encodings in cases where there are extensible parts of the encoding. In thse cases we have to be able to handle unknown extensions and thus decode values where we do not know the concrete type.

To solve this, the serialised representation uses nested CBOR-in-CBOR https://tools.ietf.org/html/rfc7049#section-2.4.4.1 . The nesting means that the size is known without having to decode the body in those cases where we cannot decode the body.

The functions in this module handle the encoding and decoding for the cases of the known and unknown types.

encodeKnownCborDataItem :: ToCBOR a => a -> Encoding Source #

This is an alias for encodeNestedCbor .

This function is used to handle the case of a known type, but compatible with the encoding used by encodeUnknownCborDataItem .

encodeUnknownCborDataItem :: LByteString -> Encoding Source #

This is an alias for encodeNestedCborBytes , so all its details apply.

This function is used to handle the case of an unknown type, so it takes an opaque blob that is the representation of the value of the unknown type.

decodeKnownCborDataItem :: FromCBOR a => Decoder s a Source #

This is an alias for decodeNestedCbor .

This function is used to handle the case of a known type, but compatible with the encoding used by decodeUnknownCborDataItem .

decodeUnknownCborDataItem :: Decoder s ByteString Source #

This is an alias for decodeNestedCborBytes , so all its details apply.

This function is used to handle the case of an unknown type, so it returns an opaque blob that is the representation of the value of the unknown type.

Cyclic redundancy check

The Byron era address format includes a CRC to help resist accidental corruption. These functions deal with encoding and decoding the format that is used.

encodeCrcProtected :: ToCBOR a => a -> Encoding Source #

Encodes a value of type a , protecting it from accidental corruption by protecting it with a CRC.

decodeCrcProtected :: forall s a. FromCBOR a => Decoder s a Source #

Decodes a CBOR blob into a value of type a , checking the serialised CRC corresponds to the computed one

newtype BlockCount Source #

Instances

Instances details
Enum BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

Eq BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

Ord BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

Read BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

Show BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

Generic BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

NFData BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

ToCBOR BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

FromCBOR BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

Buildable BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

NoThunks BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

type Rep BlockCount Source #
Instance details

Defined in Cardano.Chain.Common.BlockCount

type Rep BlockCount = D1 (' MetaData "BlockCount" "Cardano.Chain.Common.BlockCount" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "BlockCount" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unBlockCount") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Word64 )))

newtype UnparsedFields Source #

Representation of unparsed fields in Attributes. Newtype wrapper is used for clear backward compatibility between previous representation (which was just a single ByteString) during transition from Store to CBOR.

Instances

Instances details
Eq UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Ord UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Show UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Generic UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

NFData UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

ToJSON UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

HeapWords UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

NoThunks UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep UnparsedFields Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep UnparsedFields = D1 (' MetaData "UnparsedFields" "Cardano.Chain.Common.Attributes" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "UnparsedFields" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Map Word8 ByteString ))))

data Attributes h Source #

Convenient wrapper for the datatype to represent it (in binary format) as k-v map

Constructors

Attributes

Fields

Instances

Instances details
Eq h => Eq ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Ord h => Ord ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Show h => Show ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Generic ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Associated Types

type Rep ( Attributes h) :: Type -> Type Source #

NFData h => NFData ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

ToJSON a => ToJSON ( Attributes a) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

ToCBOR ( Attributes ()) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

ToCBOR ( Attributes AddrAttributes ) Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

FromCBOR ( Attributes ()) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

FromCBOR ( Attributes AddrAttributes ) Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

HeapWords h => HeapWords ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Buildable ( Attributes ()) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

Buildable h => Buildable ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

NoThunks h => NoThunks ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep ( Attributes h) Source #
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep ( Attributes h) = D1 (' MetaData "Attributes" "Cardano.Chain.Common.Attributes" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "Attributes" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "attrData") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 h) :*: S1 (' MetaSel (' Just "attrRemain") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 UnparsedFields )))

attributesAreKnown :: Attributes a -> Bool Source #

Check whether all data from Attributes is known, i. e. was successfully parsed into some structured data

dropEmptyAttributes :: Dropper s Source #

Drop `Attributes ()` making sure that the UnparsedFields are empty

type AddressHash = AbstractHash Blake2b_224 Source #

Hash used to identify address.

data Address Source #

Address is where you can send Lovelace

Constructors

Address

Fields

Instances

Instances details
Eq Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

Ord Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

Show Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

Generic Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

NFData Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

ToJSON Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

ToCBOR Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

FromCBOR Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

HeapWords Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

Buildable Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

NoThunks Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

Monad m => ToJSON m Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

MonadError SchemaError m => FromJSON m Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

Monad m => ToObjectKey m Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

MonadError SchemaError m => FromObjectKey m Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

Buildable [ Address ] Source #
Instance details

Defined in Cardano.Chain.Common.Address

type Rep Address Source #
Instance details

Defined in Cardano.Chain.Common.Address

newtype Address' Source #

Hash of this data is stored in Address . This type exists mostly for internal usage.

Instances

Instances details
Eq Address' Source #
Instance details

Defined in Cardano.Chain.Common.Address

Show Address' Source #
Instance details

Defined in Cardano.Chain.Common.Address

Generic Address' Source #
Instance details

Defined in Cardano.Chain.Common.Address

ToCBOR Address' Source #
Instance details

Defined in Cardano.Chain.Common.Address

FromCBOR Address' Source #
Instance details

Defined in Cardano.Chain.Common.Address

type Rep Address' Source #
Instance details

Defined in Cardano.Chain.Common.Address

type Rep Address' = D1 (' MetaData "Address'" "Cardano.Chain.Common.Address" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "Address'" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unAddress'") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( AddrType , AddrSpendingData , Attributes AddrAttributes ))))

Formatting

addressF :: Format r ( Address -> r) Source #

Specialized formatter for Address

addressDetailedF :: Format r ( Address -> r) Source #

A formatter showing guts of an Address

fromCBORTextAddress :: Text -> Either DecoderError Address Source #

Deprecated: Use decodeAddressBase58 instead

A function which decodes base58-encoded Address

Spending data checks

Encoding/Decoding

encodeAddressBase58 :: Address -> Text Source #

Encode an address to Text. `decodeAddressBase58 (encodeAddressBase58 x) === Right x`

Utilities

Pattern-matching helpers

isRedeemAddress :: Address -> Bool Source #

Check whether an Address is redeem address

Construction

makeVerKeyHdwAddress Source #

A function for making an HDW address

data AddrSpendingData Source #

Data which is bound to an address and must be revealed in order to spend lovelace belonging to this address.

Constructors

VerKeyASD ! VerificationKey

Funds can be spent by revealing a VerificationKey and providing a valid signature

RedeemASD ! RedeemVerificationKey

Funds can be spent by revealing a RedeemVerificationKey and providing a valid signature

Instances

Instances details
Eq AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Show AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Generic AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

NFData AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

ToCBOR AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

FromCBOR AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Buildable AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

type Rep AddrSpendingData Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

data AddrType Source #

Type of an address. It corresponds to constructors of AddrSpendingData . It's separated, because Address doesn't store AddrSpendingData , but we want to know its type.

Instances

Instances details
Eq AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Ord AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Show AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Generic AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

NFData AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

ToJSON AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

ToCBOR AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

FromCBOR AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

HeapWords AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

NoThunks AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

type Rep AddrType Source #
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

type Rep AddrType = D1 (' MetaData "AddrType" "Cardano.Chain.Common.AddrSpendingData" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "ATVerKey" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "ATRedeem" ' PrefixI ' False ) ( U1 :: Type -> Type ))

data AddrAttributes Source #

Additional information stored along with address. It's intended to be put into Attributes data type to make it extensible with softfork.

Instances

Instances details
Eq AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Ord AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Show AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Generic AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

NFData AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

ToJSON AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

HeapWords AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Buildable AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

NoThunks AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

ToCBOR ( Attributes AddrAttributes ) Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

FromCBOR ( Attributes AddrAttributes ) Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep AddrAttributes Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep AddrAttributes = D1 (' MetaData "AddrAttributes" "Cardano.Chain.Common.AddrAttributes" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "AddrAttributes" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "aaVKDerivationPath") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Maybe HDAddressPayload )) :*: S1 (' MetaSel (' Just "aaNetworkMagic") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 NetworkMagic )))

newtype HDAddressPayload Source #

HDAddressPayload is a specific address attribute that was used by the Cardano wallet at mainnet launch, prior to moving to a BIP-44 style scheme.

It consisted of

  • serialiazed and encrypted using HDPassphrase derivation path from the root key to given descendant key (using ChaChaPoly1305 algorithm)
  • cryptographic tag

It is still distinguished as an attribute, but not used by the ledger, because the attributes size limits treat this attribute specially.

Instances

Instances details
Eq HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Ord HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Show HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Generic HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

NFData HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

ToJSON HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

ToCBOR HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

FromCBOR HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

HeapWords HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

NoThunks HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep HDAddressPayload Source #
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep HDAddressPayload = D1 (' MetaData "HDAddressPayload" "Cardano.Chain.Common.AddrAttributes" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' True ) ( C1 (' MetaCons "HDAddressPayload" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getHDAddressPayload") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ByteString )))