/
Examples.hs
84 lines (73 loc) · 3.35 KB
/
Examples.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
module Test.Cardano.Api.Examples
( exampleShelleyGenesis
) where
import Cardano.Prelude
import qualified Data.Map.Strict as Map
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Cardano.Crypto.ProtocolMagic (ProtocolMagicId (..))
import Cardano.Slotting.Slot (EpochSize (..))
import Ouroboros.Consensus.Shelley.Protocol (TPraosStandardCrypto)
import Ouroboros.Consensus.Shelley.Node (emptyGenesisStaking)
import Ouroboros.Consensus.Util.Time
import Shelley.Spec.Ledger.Address (Addr (..))
import Shelley.Spec.Ledger.BaseTypes (Network (..), truncateUnitInterval)
import Shelley.Spec.Ledger.Coin (Coin(..))
import Shelley.Spec.Ledger.Credential
(Credential (..), StakeReference(..),
PaymentCredential, StakeCredential)
import Shelley.Spec.Ledger.Keys (KeyHash(..), KeyRole(..), Hash,
VerKeyVRF, GenDelegPair(..))
import Shelley.Spec.Ledger.PParams (PParams' (..), emptyPParams)
import Cardano.Api.Shelley.Genesis
exampleShelleyGenesis :: ShelleyGenesis TPraosStandardCrypto
exampleShelleyGenesis =
ShelleyGenesis
{ sgSystemStart = posixSecondsToUTCTime $ realToFrac (1234566789 :: Integer)
, sgNetworkMagic = 4036000900
, sgNetworkId = Testnet
, sgProtocolMagicId = ProtocolMagicId 838299499
, sgActiveSlotsCoeff = 6.259
, sgSecurityParam = 120842
, sgEpochLength = EpochSize 1215
, sgSlotsPerKESPeriod = 8541
, sgMaxKESEvolutions = 28899
, sgSlotLength = secondsToNominalDiffTime 8
, sgUpdateQuorum = 16991
, sgMaxLovelaceSupply = 71
, sgProtocolParams = emptyPParams
{ _d = truncateUnitInterval (fromRational 1.9e-2)
, _maxBBSize = 239857
, _maxBHSize = 217569
}
, sgGenDelegs = Map.fromList
[( genesisVerKeyHash
, GenDelegPair delegVerKeyHash delegVrfKeyHash)
]
, sgInitialFunds = Map.fromList [(initialFundedAddress,initialFunds)]
, sgStaking = emptyGenesisStaking
}
where
-- hash of the genesis verification key
genesisVerKeyHash :: KeyHash Genesis TPraosStandardCrypto
genesisVerKeyHash = KeyHash "23d51e91ae5adc7ae801e9de4cd54175fb7464ec2680b25686bbb194"
-- hash of the delegators verififation key
delegVerKeyHash :: KeyHash GenesisDelegate TPraosStandardCrypto
delegVerKeyHash = KeyHash "839b047f56e50654bdb504832186dc1ee0c73c8de2daec7ae6273827"
delegVrfKeyHash :: Hash TPraosStandardCrypto (VerKeyVRF TPraosStandardCrypto)
delegVrfKeyHash = "231391e7ec1c450a8518134cf6fad1a8e0ed7ffd66d740f8e8271347a6de7bf2"
initialFundedAddress :: Addr TPraosStandardCrypto
initialFundedAddress = Addr Testnet paymentCredential (StakeRefBase stakingCredential)
where
paymentCredential :: PaymentCredential TPraosStandardCrypto
paymentCredential =
KeyHashObj $ KeyHash
"1c14ee8e58fbcbd48dc7367c95a63fd1d937ba989820015db16ac7e5"
stakingCredential :: StakeCredential TPraosStandardCrypto
stakingCredential =
KeyHashObj $ KeyHash
"e37a65ea2f9bcefb645de4312cf13d8ac12ae61cf242a9aa2973c9ee"
initialFunds :: Coin
initialFunds = Coin 12157196