Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.Genesis
Synopsis
- data ShelleyGenesis = ShelleyGenesis {
- sgSystemStart :: !UTCTime
- sgNetworkMagic :: !Word32
- sgNetworkId :: !Network
- sgActiveSlotsCoeff :: !PositiveUnitInterval
- sgSecurityParam :: !(NonZero Word64)
- sgEpochLength :: !EpochSize
- sgSlotsPerKESPeriod :: !Word64
- sgMaxKESEvolutions :: !Word64
- sgSlotLength :: !NominalDiffTimeMicro
- sgUpdateQuorum :: !Word64
- sgMaxLovelaceSupply :: !Word64
- sgProtocolParams :: !(PParams ShelleyEra)
- sgGenDelegs :: !(Map (KeyHash 'Genesis) GenDelegPair)
- sgInitialFunds :: ListMap Addr Coin
- sgStaking :: ShelleyGenesisStaking
- shelleyGenesisDefaults :: ShelleyGenesis
- alonzoGenesisDefaults :: CardanoEra era -> AlonzoGenesis
- decodeAlonzoGenesis :: forall era t (m :: Type -> Type). MonadTransError String t m => Maybe (CardanoEra era) -> ByteString -> t m AlonzoGenesis
- conwayGenesisDefaults :: ConwayGenesis
- type ByronGenesisConfig = Config
- type ShelleyGenesisConfig = ShelleyConfig
- type AlonzoGenesisConfig = AlonzoGenesis
- type ConwayGenesisConfig = ConwayGenesis
- data ShelleyConfig = ShelleyConfig {}
- newtype GenesisHashByron = GenesisHashByron {}
- newtype GenesisHashShelley = GenesisHashShelley {}
- newtype GenesisHashAlonzo = GenesisHashAlonzo {}
- newtype GenesisHashConway = GenesisHashConway {}
- type ByronGenesisFile = File ByronGenesisConfig
- type ShelleyGenesisFile = File ShelleyGenesisConfig
- type AlonzoGenesisFile = File AlonzoGenesisConfig
- type ConwayGenesisFile = File ConwayGenesisConfig
- data GenesisParameters era = GenesisParameters {
- protocolParamSystemStart :: UTCTime
- protocolParamNetworkId :: NetworkId
- protocolParamActiveSlotsCoefficient :: Rational
- protocolParamSecurity :: NonZero Word64
- protocolParamEpochLength :: EpochSize
- protocolParamSlotLength :: NominalDiffTime
- protocolParamSlotsPerKESPeriod :: Int
- protocolParamMaxKESEvolutions :: Int
- protocolParamUpdateQuorum :: Int
- protocolParamMaxLovelaceSupply :: Coin
- protocolInitialUpdateableProtocolParameters :: PParams (ShelleyLedgerEra era)
- newtype EpochSize = EpochSize {}
- unsafeBoundedRational :: (HasCallStack, Typeable r, BoundedRational r) => Rational -> r
Documentation
data ShelleyGenesis Source #
Shelley genesis information
Note that this is needed only for a pure Shelley network, hence it being defined here rather than in its own module. In mainnet, Shelley will transition naturally from Byron, and thus will never have its own genesis information.
Constructors
ShelleyGenesis | |
Fields
|
Instances
shelleyGenesisDefaults :: ShelleyGenesis Source #
Some reasonable starting defaults for constructing a ShelleyGenesis
.
You must override at least the following fields for this to be useful:
sgSystemStart
the time of the first blocksgNetworkMagic
to a suitable testnet or mainnet network magic number.sgGenDelegs
to have some initial nodessgInitialFunds
to have any money in the systemsgMaxLovelaceSupply
must be at least the sum of thesgInitialFunds
but more if you want to allow for rewards.
alonzoGenesisDefaults :: CardanoEra era -> AlonzoGenesis Source #
Some reasonable starting defaults for constructing a AlonzoGenesis
.
Based on https://github.com/IntersectMBO/cardano-node/blob/master/cardano-testnet/src/Testnet/Defaults.hs
The era determines Plutus V2 cost model parameters:
* Conway: 185
* <= Babbage: 175
Arguments
:: forall era t (m :: Type -> Type). MonadTransError String t m | |
=> Maybe (CardanoEra era) | An optional era witness in which we're reading the genesis |
-> ByteString | Genesis JSON |
-> t m AlonzoGenesis |
Decode Alonzo genesis in an optionally era sensitive way.
Because the Plutus V2 cost model has changed between Babbage and Conway era, we need to know the era if we want to decde Alonzo Genesis with a cost model baked in. If the V2 cost model is present in genesis, you need to provide an era witness.
When an era witness is provided, for Plutus V2 model the function additionally: 1. Does extra cost model parameters name validation: Checks for mandatory 175 parameters if provided in a map form. 2. If >= Conway: adds defaults for new 10 parameters, if they were not provided (maxBound) 3. Removes extra parameters above the max count: Babbage - 175, Conway - 185.
conwayGenesisDefaults :: ConwayGenesis Source #
Some reasonable starting defaults for constructing a ConwayGenesis
.
Based on https://github.com/IntersectMBO/cardano-node/blob/master/cardano-testnet/src/Testnet/Defaults.hs
Configuration
type ByronGenesisConfig = Config Source #
type ShelleyGenesisConfig = ShelleyConfig Source #
type AlonzoGenesisConfig = AlonzoGenesis Source #
type ConwayGenesisConfig = ConwayGenesis Source #
data ShelleyConfig Source #
Constructors
ShelleyConfig | |
Fields |
newtype GenesisHashByron Source #
Constructors
GenesisHashByron | |
Fields |
Instances
Show GenesisHashByron Source # | |
Defined in Cardano.Api.Genesis.Internal | |
Eq GenesisHashByron Source # | |
Defined in Cardano.Api.Genesis.Internal Methods (==) :: GenesisHashByron -> GenesisHashByron -> Bool Source # (/=) :: GenesisHashByron -> GenesisHashByron -> Bool Source # |
newtype GenesisHashShelley Source #
Constructors
GenesisHashShelley | |
Fields |
Instances
Show GenesisHashShelley Source # | |
Defined in Cardano.Api.Genesis.Internal | |
Eq GenesisHashShelley Source # | |
Defined in Cardano.Api.Genesis.Internal Methods (==) :: GenesisHashShelley -> GenesisHashShelley -> Bool Source # (/=) :: GenesisHashShelley -> GenesisHashShelley -> Bool Source # |
newtype GenesisHashAlonzo Source #
Constructors
GenesisHashAlonzo | |
Fields |
Instances
Show GenesisHashAlonzo Source # | |
Defined in Cardano.Api.Genesis.Internal | |
Eq GenesisHashAlonzo Source # | |
Defined in Cardano.Api.Genesis.Internal Methods (==) :: GenesisHashAlonzo -> GenesisHashAlonzo -> Bool Source # (/=) :: GenesisHashAlonzo -> GenesisHashAlonzo -> Bool Source # |
newtype GenesisHashConway Source #
Constructors
GenesisHashConway | |
Fields |
Instances
Show GenesisHashConway Source # | |
Defined in Cardano.Api.Genesis.Internal | |
Eq GenesisHashConway Source # | |
Defined in Cardano.Api.Genesis.Internal Methods (==) :: GenesisHashConway -> GenesisHashConway -> Bool Source # (/=) :: GenesisHashConway -> GenesisHashConway -> Bool Source # |
Files
Protocol parameters fixed in the genesis file
data GenesisParameters era Source #
Constructors
GenesisParameters | |
Fields
|
Constructors
EpochSize | |
Fields |
Instances
FromJSON EpochSize | |||||
Defined in Cardano.Slotting.Slot | |||||
ToJSON EpochSize | |||||
Defined in Cardano.Slotting.Slot | |||||
Enum EpochSize | |||||
Defined in Cardano.Slotting.Slot Methods succ :: EpochSize -> EpochSize Source # pred :: EpochSize -> EpochSize Source # toEnum :: Int -> EpochSize Source # fromEnum :: EpochSize -> Int Source # enumFrom :: EpochSize -> [EpochSize] Source # enumFromThen :: EpochSize -> EpochSize -> [EpochSize] Source # enumFromTo :: EpochSize -> EpochSize -> [EpochSize] Source # enumFromThenTo :: EpochSize -> EpochSize -> EpochSize -> [EpochSize] Source # | |||||
Generic EpochSize | |||||
Defined in Cardano.Slotting.Slot Associated Types
| |||||
Show EpochSize | |||||
FromCBOR EpochSize | |||||
ToCBOR EpochSize | |||||
DecCBOR EpochSize | |||||
EncCBOR EpochSize | |||||
NFData EpochSize | |||||
Defined in Cardano.Slotting.Slot | |||||
Eq EpochSize | |||||
Ord EpochSize | |||||
Defined in Cardano.Slotting.Slot | |||||
NoThunks EpochSize | |||||
type Rep EpochSize | |||||
Defined in Cardano.Slotting.Slot type Rep EpochSize = D1 ('MetaData "EpochSize" "Cardano.Slotting.Slot" "cardano-slotting-0.2.0.0-5e3cb584da1cb4492348d9102c3fae026617ad9eee92a938e6b627df3b251a08" 'True) (C1 ('MetaCons "EpochSize" 'PrefixI 'True) (S1 ('MetaSel ('Just "unEpochSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) |
Utilities
unsafeBoundedRational :: (HasCallStack, Typeable r, BoundedRational r) => Rational -> r Source #
Convert Rational to a bounded rational. Throw an exception when the rational is out of bounds.