Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Chain.Genesis
Synopsis
- data GenesisSpec = UnsafeGenesisSpec { }
- mkGenesisSpec :: GenesisAvvmBalances -> GenesisDelegation -> ProtocolParameters -> BlockCount -> ProtocolMagic -> GenesisInitializer -> Either Text GenesisSpec
- newtype GenesisNonAvvmBalances = GenesisNonAvvmBalances { }
- convertNonAvvmDataToBalances :: forall m. MonadError NonAvvmBalancesError m => Map Text Integer -> m GenesisNonAvvmBalances
- newtype GenesisKeyHashes = GenesisKeyHashes { }
- data GenesisInitializer = GenesisInitializer { }
-
data
TestnetBalanceOptions
=
TestnetBalanceOptions
{
- tboPoors :: ! Word
- tboRichmen :: ! Word
- tboTotalBalance :: ! Lovelace
- tboRichmenShare :: ! Rational
-
data
FakeAvvmOptions
=
FakeAvvmOptions
{
- faoCount :: ! Word
- faoOneBalance :: ! Lovelace
-
newtype
GenesisHash
=
GenesisHash
{
- unGenesisHash :: Hash Raw
-
data
GeneratedSecrets
=
GeneratedSecrets
{
- gsDlgIssuersSecrets :: ![ SigningKey ]
- gsRichSecrets :: ![ SigningKey ]
- gsPoorSecrets :: ![ PoorSecret ]
- gsFakeAvvmSecrets :: ![ RedeemSigningKey ]
- gsSigningKeys :: GeneratedSecrets -> [ SigningKey ]
- gsSigningKeysPoor :: GeneratedSecrets -> [ SigningKey ]
- newtype PoorSecret = PoorSecret { }
- generateGenesisData :: UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError IO ( GenesisData , GeneratedSecrets )
- generateGenesisDataWithEntropy :: MonadRandom m => UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError m ( GenesisData , GeneratedSecrets )
- generateGenesisConfig :: UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError IO ( Config , GeneratedSecrets )
- generateGenesisConfigWithEntropy :: MonadRandom m => UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError m ( Config , GeneratedSecrets )
-
data
GenesisDataGenerationError
- = GenesisDataAddressBalanceMismatch Text Int Int
- | GenesisDataGenerationDelegationError GenesisDelegationError
- | GenesisDataGenerationDistributionMismatch Lovelace Lovelace
- | GenesisDataGenerationLovelaceError LovelaceError
- | GenesisDataGenerationPassPhraseMismatch
- | GenesisDataGenerationRedeemKeyGen
- newtype GenesisDelegation = UnsafeGenesisDelegation { }
- data GenesisDelegationError
- mkGenesisDelegation :: MonadError GenesisDelegationError m => [ Certificate ] -> m GenesisDelegation
- data GenesisData = GenesisData { }
- data GenesisDataError
- mainnetProtocolMagicId :: ProtocolMagicId
- readGenesisData :: ( MonadError GenesisDataError m, MonadIO m) => FilePath -> m ( GenesisData , GenesisHash )
- data Config = Config { }
- data ConfigurationError
- configGenesisHeaderHash :: Config -> HeaderHash
- configK :: Config -> BlockCount
- configSlotSecurityParam :: Config -> SlotCount
- configChainQualityThreshold :: Fractional f => Config -> f
- configEpochSlots :: Config -> EpochSlots
- configProtocolMagic :: Config -> ProtocolMagic
- configProtocolMagicId :: Config -> ProtocolMagicId
- configGenesisKeyHashes :: Config -> GenesisKeyHashes
- configHeavyDelegation :: Config -> GenesisDelegation
- configStartTime :: Config -> UTCTime
- configNonAvvmBalances :: Config -> GenesisNonAvvmBalances
- configProtocolParameters :: Config -> ProtocolParameters
- configAvvmDistr :: Config -> GenesisAvvmBalances
- mkConfigFromFile :: ( MonadError ConfigurationError m, MonadIO m) => RequiresNetworkMagic -> FilePath -> Hash Raw -> m Config
- newtype GenesisAvvmBalances = GenesisAvvmBalances { }
Documentation
data GenesisSpec Source #
Specification how to generate full
GenesisData
Constructors
UnsafeGenesisSpec | |
Fields
|
Instances
mkGenesisSpec :: GenesisAvvmBalances -> GenesisDelegation -> ProtocolParameters -> BlockCount -> ProtocolMagic -> GenesisInitializer -> Either Text GenesisSpec Source #
Safe constructor for
GenesisSpec
. Throws error if something
goes wrong.
newtype GenesisNonAvvmBalances Source #
Predefined balances of non avvm entries.
Constructors
GenesisNonAvvmBalances | |
Fields |
Instances
convertNonAvvmDataToBalances :: forall m. MonadError NonAvvmBalancesError m => Map Text Integer -> m GenesisNonAvvmBalances Source #
Generate genesis address distribution out of avvm parameters. Txdistr of the utxo is all empty. Redelegate it in calling function.
newtype GenesisKeyHashes Source #
The set of genesis keys, who are able to produce blocks and submit votes and proposals in the Byron era
Constructors
GenesisKeyHashes | |
Fields |
Instances
data GenesisInitializer Source #
Options determining generated genesis stakes, balances, and delegation
Constructors
GenesisInitializer | |
Fields
|
Instances
Eq GenesisInitializer Source # | |
Defined in Cardano.Chain.Genesis.Initializer Methods (==) :: GenesisInitializer -> GenesisInitializer -> Bool Source # (/=) :: GenesisInitializer -> GenesisInitializer -> Bool Source # |
|
Show GenesisInitializer Source # | |
Defined in Cardano.Chain.Genesis.Initializer |
data TestnetBalanceOptions Source #
These options determine balances of nodes specific for testnet
Constructors
TestnetBalanceOptions | |
Fields
|
Instances
Eq TestnetBalanceOptions Source # | |
Defined in Cardano.Chain.Genesis.Initializer Methods (==) :: TestnetBalanceOptions -> TestnetBalanceOptions -> Bool Source # (/=) :: TestnetBalanceOptions -> TestnetBalanceOptions -> Bool Source # |
|
Show TestnetBalanceOptions Source # | |
Defined in Cardano.Chain.Genesis.Initializer |
data FakeAvvmOptions Source #
These options determines balances of fake AVVM nodes which didn't really go through vending, but pretend they did
Constructors
FakeAvvmOptions | |
Fields
|
Instances
Eq FakeAvvmOptions Source # | |
Defined in Cardano.Chain.Genesis.Initializer Methods (==) :: FakeAvvmOptions -> FakeAvvmOptions -> Bool Source # (/=) :: FakeAvvmOptions -> FakeAvvmOptions -> Bool Source # |
|
Show FakeAvvmOptions Source # | |
Defined in Cardano.Chain.Genesis.Initializer |
|
Generic FakeAvvmOptions Source # | |
Defined in Cardano.Chain.Genesis.Initializer Methods from :: FakeAvvmOptions -> Rep FakeAvvmOptions x Source # to :: Rep FakeAvvmOptions x -> FakeAvvmOptions Source # |
|
type Rep FakeAvvmOptions Source # | |
Defined in Cardano.Chain.Genesis.Initializer
type
Rep
FakeAvvmOptions
=
D1
('
MetaData
"FakeAvvmOptions" "Cardano.Chain.Genesis.Initializer" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" '
False
) (
C1
('
MetaCons
"FakeAvvmOptions" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"faoCount") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
Word
)
:*:
S1
('
MetaSel
('
Just
"faoOneBalance") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
Lovelace
)))
|
newtype GenesisHash Source #
Constructors
GenesisHash | |
Fields
|
Instances
data GeneratedSecrets Source #
Valuable secrets which can unlock genesis data.
Constructors
GeneratedSecrets | |
Fields
|
Instances
gsSigningKeys :: GeneratedSecrets -> [ SigningKey ] Source #
gsSigningKeysPoor :: GeneratedSecrets -> [ SigningKey ] Source #
newtype PoorSecret Source #
Poor node secret
Constructors
PoorSecret | |
Fields |
Instances
Generic PoorSecret Source # | |
Defined in Cardano.Chain.Genesis.Generate Methods from :: PoorSecret -> Rep PoorSecret x Source # to :: Rep PoorSecret x -> PoorSecret Source # |
|
NoThunks PoorSecret Source # | |
Defined in Cardano.Chain.Genesis.Generate |
|
type Rep PoorSecret Source # | |
Defined in Cardano.Chain.Genesis.Generate
type
Rep
PoorSecret
=
D1
('
MetaData
"PoorSecret" "Cardano.Chain.Genesis.Generate" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" '
True
) (
C1
('
MetaCons
"PoorSecret" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"poorSecretToKey") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
SigningKey
)))
|
generateGenesisData :: UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError IO ( GenesisData , GeneratedSecrets ) Source #
Generate a genesis
GenesisData
and
GeneratedSecrets
from a
GenesisSpec
. This is used only for tests blockhains. For a real blockcain
you must use the external key generation tool so that each stakeholder can
generate their keys privately.
generateGenesisDataWithEntropy :: MonadRandom m => UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError m ( GenesisData , GeneratedSecrets ) Source #
A version of
generateGenesisData
parametrised over
MonadRandom
.
For testing purposes this allows using a completely pure deterministic
entropy source, rather than a cryptographically secure entropy source.
generateGenesisConfig :: UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError IO ( Config , GeneratedSecrets ) Source #
Generate a genesis
Config
from a
GenesisSpec
. This is used only for
tests. For the real node we always generate an external JSON genesis file.
generateGenesisConfigWithEntropy :: MonadRandom m => UTCTime -> GenesisSpec -> ExceptT GenesisDataGenerationError m ( Config , GeneratedSecrets ) Source #
A version of
generateGenesisConfig
parametrised over
MonadRandom
.
For testing purposes this allows using a completely pure deterministic
entropy source, rather than a cryptographically secure entropy source.
data GenesisDataGenerationError Source #
Constructors
Instances
Eq GenesisDataGenerationError Source # | |
Defined in Cardano.Chain.Genesis.Generate Methods (==) :: GenesisDataGenerationError -> GenesisDataGenerationError -> Bool Source # (/=) :: GenesisDataGenerationError -> GenesisDataGenerationError -> Bool Source # |
|
Show GenesisDataGenerationError Source # | |
Defined in Cardano.Chain.Genesis.Generate |
|
Buildable GenesisDataGenerationError Source # | |
Defined in Cardano.Chain.Genesis.Generate Methods |
newtype GenesisDelegation Source #
This type contains genesis state of heavyweight delegation. It wraps a map where keys are issuers and values are delegation certificates. There are some invariants:
- In each pair delegate must differ from issuer, i. e. no revocations.
- PSKs must be consistent with keys in the map, i. e. issuer's ID must be equal to the key in the map.
- Delegates can't be issuers, i. e. transitive delegation is not supported. It's not needed in genesis, it can always be reduced.
Constructors
UnsafeGenesisDelegation | |
Fields |
Instances
data GenesisDelegationError Source #
Instances
Eq GenesisDelegationError Source # | |
Defined in Cardano.Chain.Genesis.Delegation Methods (==) :: GenesisDelegationError -> GenesisDelegationError -> Bool Source # (/=) :: GenesisDelegationError -> GenesisDelegationError -> Bool Source # |
|
Show GenesisDelegationError Source # | |
Defined in Cardano.Chain.Genesis.Delegation |
|
Buildable GenesisDelegationError Source # | |
Defined in Cardano.Chain.Genesis.Delegation Methods |
mkGenesisDelegation :: MonadError GenesisDelegationError m => [ Certificate ] -> m GenesisDelegation Source #
Safe constructor of
GenesisDelegation
from a list of
Certificate
s
data GenesisData Source #
Genesis data contains all data which determines consensus rules. It must be same for all nodes. It's used to initialize global state, slotting, etc.
Constructors
GenesisData | |
Fields |
Instances
data GenesisDataError Source #
Constructors
GenesisDataParseError Text | |
GenesisDataSchemaError SchemaError | |
GenesisDataIOError IOException |
Instances
Show GenesisDataError Source # | |
Defined in Cardano.Chain.Genesis.Data |
|
Buildable GenesisDataError Source # | |
Defined in Cardano.Chain.Genesis.Data Methods build :: GenesisDataError -> Builder Source # |
readGenesisData :: ( MonadError GenesisDataError m, MonadIO m) => FilePath -> m ( GenesisData , GenesisHash ) Source #
Parse
GenesisData
from a JSON file and annotate with Canonical JSON hash
Constructors
Config | |
Fields
|
Instances
Eq Config Source # | |
Show Config Source # | |
Generic Config Source # | |
ToCBOR Config Source # | |
FromCBOR Config Source # | |
NoThunks Config Source # | |
type Rep Config Source # | |
Defined in Cardano.Chain.Genesis.Config
type
Rep
Config
=
D1
('
MetaData
"Config" "Cardano.Chain.Genesis.Config" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" '
False
) (
C1
('
MetaCons
"Config" '
PrefixI
'
True
) ((
S1
('
MetaSel
('
Just
"configGenesisData") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
GenesisData
)
:*:
S1
('
MetaSel
('
Just
"configGenesisHash") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
GenesisHash
))
:*:
(
S1
('
MetaSel
('
Just
"configReqNetMagic") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
RequiresNetworkMagic
)
:*:
S1
('
MetaSel
('
Just
"configUTxOConfiguration") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
UTxOConfiguration
))))
|
data ConfigurationError Source #
Constructors
ConfigurationGenesisDataError GenesisDataError |
An error in constructing
|
GenesisHashMismatch GenesisHash ( Hash Raw ) |
The GenesisData canonical JSON hash is different than expected |
GenesisHashDecodeError Text |
An error occured while decoding the genesis hash. |
Instances
Show ConfigurationError Source # | |
Defined in Cardano.Chain.Genesis.Config |
configK :: Config -> BlockCount Source #
configChainQualityThreshold :: Fractional f => Config -> f Source #
configEpochSlots :: Config -> EpochSlots Source #
configProtocolMagic :: Config -> ProtocolMagic Source #
There isn't a full
ProtocolMagic
in
Config
, but the requisite
ProtocolMagicId
and
RequiresNetworkMagic
are stored separately.
We use them to construct and return a
ProtocolMagic
.
configStartTime :: Config -> UTCTime Source #
Arguments
:: ( MonadError ConfigurationError m, MonadIO m) | |
=> RequiresNetworkMagic | |
-> FilePath | |
-> Hash Raw |
The expected hash of the file |
-> m Config |
newtype GenesisAvvmBalances Source #
Predefined balances of AVVM (Ada Voucher Vending Machine) entries. People who purchased Ada at a pre-sale were issued a certificate during the pre-sale period. These certificates allow customers to redeem ADA.
Constructors
GenesisAvvmBalances | |