Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Cardano.Api.Block
Description
Blocks in the blockchain
Synopsis
- data Block era where
- ByronBlock ∷ ByronBlock → Block ByronEra
- ShelleyBlock ∷ ShelleyBasedEra era → ShelleyBlock (ConsensusProtocol era) (ShelleyLedgerEra era) → Block era
- pattern Block ∷ BlockHeader → [Tx era] → Block era
- data BlockHeader = BlockHeader !SlotNo !(Hash BlockHeader) !BlockNo
- getBlockHeader ∷ ∀ era. Block era → BlockHeader
- data BlockInMode mode where
- BlockInMode ∷ IsCardanoEra era ⇒ Block era → EraInMode era mode → BlockInMode mode
- fromConsensusBlock ∷ ConsensusBlockForMode mode ~ block ⇒ LedgerSupportsProtocol (ShelleyBlock (TPraos StandardCrypto) (ShelleyEra StandardCrypto)) ⇒ ConsensusMode mode → block → BlockInMode mode
- toConsensusBlock ∷ ConsensusBlockForMode mode ~ block ⇒ LedgerSupportsProtocol (ShelleyBlock (TPraos StandardCrypto) (ShelleyEra StandardCrypto)) ⇒ BlockInMode mode → block
- data ChainPoint
- newtype SlotNo = SlotNo {}
- newtype EpochNo = EpochNo {}
- toConsensusPoint ∷ ∀ ledgerera protocol. ShelleyCompatible protocol ledgerera ⇒ ChainPoint → Point (ShelleyBlock protocol ledgerera)
- fromConsensusPoint ∷ ∀ protocol ledgerera. ShelleyCompatible protocol ledgerera ⇒ Point (ShelleyBlock protocol ledgerera) → ChainPoint
- toConsensusPointInMode ∷ ConsensusMode mode → ChainPoint → Point (ConsensusBlockForMode mode)
- fromConsensusPointInMode ∷ ConsensusMode mode → Point (ConsensusBlockForMode mode) → ChainPoint
- toConsensusPointHF ∷ HeaderHash block ~ OneEraHash xs ⇒ ChainPoint → Point block
- data ChainTip
- newtype BlockNo = BlockNo {}
- chainTipToChainPoint ∷ ChainTip → ChainPoint
- fromConsensusTip ∷ ConsensusBlockForMode mode ~ block ⇒ ConsensusMode mode → Tip block → ChainTip
- data family Hash keyrole ∷ Type
- chainPointToHeaderHash ∷ ChainPoint → Maybe (Hash BlockHeader)
- chainPointToSlotNo ∷ ChainPoint → Maybe SlotNo
- makeChainTip ∷ WithOrigin BlockNo → ChainPoint → ChainTip
Blocks in the context of an era
A blockchain block in a particular Cardano era.
Constructors
ByronBlock ∷ ByronBlock → Block ByronEra | |
ShelleyBlock ∷ ShelleyBasedEra era → ShelleyBlock (ConsensusProtocol era) (ShelleyLedgerEra era) → Block era |
Bundled Patterns
pattern Block ∷ BlockHeader → [Tx era] → Block era | A block consists of a header and a body containing transactions. |
data BlockHeader Source #
Constructors
BlockHeader !SlotNo !(Hash BlockHeader) !BlockNo |
Instances
getBlockHeader ∷ ∀ era. Block era → BlockHeader Source #
Blocks in the context of a consensus mode
data BlockInMode mode where Source #
A Block
in one of the eras supported by a given protocol mode.
For multi-era modes such as the CardanoMode
this type is a sum of the
different block types for all the eras. It is used in the ChainSync protocol.
Constructors
BlockInMode ∷ IsCardanoEra era ⇒ Block era → EraInMode era mode → BlockInMode mode |
Instances
Show (BlockInMode mode) Source # | |
Defined in Cardano.Api.Block |
fromConsensusBlock ∷ ConsensusBlockForMode mode ~ block ⇒ LedgerSupportsProtocol (ShelleyBlock (TPraos StandardCrypto) (ShelleyEra StandardCrypto)) ⇒ ConsensusMode mode → block → BlockInMode mode Source #
toConsensusBlock ∷ ConsensusBlockForMode mode ~ block ⇒ LedgerSupportsProtocol (ShelleyBlock (TPraos StandardCrypto) (ShelleyEra StandardCrypto)) ⇒ BlockInMode mode → block Source #
Points on the chain
data ChainPoint Source #
Constructors
ChainPointAtGenesis | |
ChainPoint !SlotNo !(Hash BlockHeader) |
Instances
FromJSON ChainPoint Source # | |
Defined in Cardano.Api.Block | |
ToJSON ChainPoint Source # | |
Defined in Cardano.Api.Block Methods toJSON ∷ ChainPoint → Value # toEncoding ∷ ChainPoint → Encoding # toJSONList ∷ [ChainPoint] → Value # toEncodingList ∷ [ChainPoint] → Encoding # | |
Show ChainPoint Source # | |
Defined in Cardano.Api.Block | |
Eq ChainPoint Source # | |
Defined in Cardano.Api.Block | |
Ord ChainPoint Source # | |
Defined in Cardano.Api.Block Methods compare ∷ ChainPoint → ChainPoint → Ordering Source # (<) ∷ ChainPoint → ChainPoint → Bool Source # (<=) ∷ ChainPoint → ChainPoint → Bool Source # (>) ∷ ChainPoint → ChainPoint → Bool Source # (>=) ∷ ChainPoint → ChainPoint → Bool Source # max ∷ ChainPoint → ChainPoint → ChainPoint Source # min ∷ ChainPoint → ChainPoint → ChainPoint Source # |
Instances
Instances
toConsensusPoint ∷ ∀ ledgerera protocol. ShelleyCompatible protocol ledgerera ⇒ ChainPoint → Point (ShelleyBlock protocol ledgerera) Source #
Convert a Point
for single Shelley-era block type
fromConsensusPoint ∷ ∀ protocol ledgerera. ShelleyCompatible protocol ledgerera ⇒ Point (ShelleyBlock protocol ledgerera) → ChainPoint Source #
Convert a Point
for single Shelley-era block type
toConsensusPointInMode ∷ ConsensusMode mode → ChainPoint → Point (ConsensusBlockForMode mode) Source #
fromConsensusPointInMode ∷ ConsensusMode mode → Point (ConsensusBlockForMode mode) → ChainPoint Source #
toConsensusPointHF ∷ HeaderHash block ~ OneEraHash xs ⇒ ChainPoint → Point block Source #
Convert a Point
for multi-era block type
Tip of the chain
This is like a ChainPoint
but is conventionally used for the tip of the
chain: that is the most recent block at the end of the chain.
It also carries the BlockNo
of the chain tip.
Constructors
ChainTipAtGenesis | |
ChainTip !SlotNo !(Hash BlockHeader) !BlockNo |
Instances
fromConsensusTip ∷ ConsensusBlockForMode mode ~ block ⇒ ConsensusMode mode → Tip block → ChainTip Source #
Data family instances
data family Hash keyrole ∷ Type Source #
Instances
makeChainTip ∷ WithOrigin BlockNo → ChainPoint → ChainTip Source #