Copyright | © 2018-2021 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
Derivation of policy keys which are used to create scripts for the purposes of minting and burning. Derived according to CIP-1855 (https:/ github.com cardano-foundation CIPs blob b2e9d02cb9a71ba9e754a432c78197428abf7e4c CIP-1855/CIP-1855.md).
The policy keys are derived from the following path:
m purpose' coin_type' / policy_ix' m 1855' 1815' / [2^31 .. 2^32-1]'
Where purpose' and coin_type' are fixed, and each new policy_ix' represents a different policy key.
Synopsis
- purposeCIP1855 :: Index ' Hardened ' PurposeK
- derivePolicyKeyAndHash :: WalletKey key => Passphrase "encryption" -> key ' RootK XPrv -> Index ' Hardened ' PolicyK -> (key ' PolicyK XPrv , KeyHash )
- derivePolicyPrivateKey :: Passphrase purpose -> XPrv -> Index ' Hardened ' PolicyK -> XPrv
- policyDerivationPath :: NonEmpty DerivationIndex
- toTokenMapAndScript :: forall key. WalletKey key => Script Cosigner -> Map Cosigner XPub -> TokenName -> Natural -> ( AssetId , TokenQuantity , Script KeyHash )
- toTokenPolicyId :: forall key. WalletKey key => Script Cosigner -> Map Cosigner XPub -> TokenPolicyId
- scriptSlotIntervals :: Script a -> [ Interval Natural ]
- withinSlotInterval :: SlotNo -> SlotNo -> [ Interval Natural ] -> Bool
Constants
purposeCIP1855 :: Index ' Hardened ' PurposeK Source #
Purpose for forged policy keys is a constant set to 1855' (or 0x8000073F) following the original CIP-1855: "Forging policy keys for HD Wallets".
It indicates that the subtree of this node is used according to this specification.
Hardened derivation is used at this level.
Helpers
derivePolicyKeyAndHash Source #
:: WalletKey key | |
=> Passphrase "encryption" |
Passphrase for wallet |
-> key ' RootK XPrv |
Root private key to derive policy private key from |
-> Index ' Hardened ' PolicyK |
Index of policy script |
-> (key ' PolicyK XPrv , KeyHash ) |
Policy private key |
Derive the policy private key that should be used to create mint/burn scripts, as well as the key hash of the policy public key.
derivePolicyPrivateKey Source #
:: Passphrase purpose |
Passphrase for wallet |
-> XPrv |
Root private key to derive policy private key from |
-> Index ' Hardened ' PolicyK |
Index of policy script |
-> XPrv |
Policy private key |
Derive the policy private key that should be used to create mint/burn scripts.
toTokenMapAndScript :: forall key. WalletKey key => Script Cosigner -> Map Cosigner XPub -> TokenName -> Natural -> ( AssetId , TokenQuantity , Script KeyHash ) Source #
toTokenPolicyId :: forall key. WalletKey key => Script Cosigner -> Map Cosigner XPub -> TokenPolicyId Source #