Plutus.V1.Ledger.ProtocolVersions
1. π Overview
2. π§ Imports
3. π·οΈ Protocol Version Constants
3.1 π shelleyPV
3.2 π§ͺ allegraPV
3.3 π¦ maryPV
3.4 π alonzoPV
3.5 π vasilPV
4. π‘ Example Usage
5. π Glossary
1 π Overview
The Plutus.V1.Ledger.ProtocolVersions
module defines named ProtocolVersion
values corresponding to the major Cardano ledger eras. These constants simplify referencing the protocol versions at which features or builtins were introduced.
Based on the IOHK Cardano Ledger Wiki.
2 π§ Imports
import Plutus.ApiCommon (ProtocolVersion(..))
Brings in the
ProtocolVersion
type (major/minor) fromPlutus.ApiCommon
.
3 π·οΈ Protocol Version Constants
Each constant is a ProtocolVersion
with pvMajor
and pvMinor
indicating the major and minor components.
3.1 π shelleyPV
shelleyPV :: ProtocolVersion
shelleyPV = ProtocolVersion 2 0
Era: Shelley (introduced in Cardano era Shelley)
Fields:
pvMajor = 2
,pvMinor = 0
3.2 π§ͺ allegraPV
allegraPV :: ProtocolVersion
allegraPV = ProtocolVersion 3 0
Era: Allegra
Fields:
pvMajor = 3
,pvMinor = 0
3.3 π¦ maryPV
maryPV :: ProtocolVersion
maryPV = ProtocolVersion 4 0
Era: Mary
Fields:
pvMajor = 4
,pvMinor = 0
3.4 π alonzoPV
alonzoPV :: ProtocolVersion
alonzoPV = ProtocolVersion 5 0
Era: Alonzo
Fields:
pvMajor = 5
,pvMinor = 0
3.5 π vasilPV
vasilPV :: ProtocolVersion
vasilPV = ProtocolVersion 7 0
Era: Vasil
Fields:
pvMajor = 7
,pvMinor = 0
4 π‘ Example Usage
Use these constants when decoding or validating scripts based on the eraβs protocol version. For example:
import Plutus.V1.Ledger.ProtocolVersions (alonzoPV)
import Plutus.V1.Ledger.ApiCommon (builtinsAvailableIn)
-- Check which builtins are available in Alonzo era:
available = builtinsAvailableIn PlutusV2 alonzoPV
5 π Glossary
ProtocolVersion: record with
pvMajor :: Int
andpvMinor :: Int
describing the ledgerβs software and hard fork version.Shelley / Allegra / Mary / Alonzo / Vasil: successive Cardano eras, each introducing new features and builtin functions.
PlutusV2: ledgerβs reference to the Plutus language version (used when calling
builtinsAvailableIn
).builtinsAvailableIn: function from
Plutus.ApiCommon
to retrieve allowed builtin functions for a given ledger and protocol version.
Last updated