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
ProtocolVersiontype (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 0Era: Shelley (introduced in Cardano era Shelley)
Fields:
pvMajor = 2,pvMinor = 0
3.2 🧪 allegraPV
allegraPV :: ProtocolVersion
allegraPV = ProtocolVersion 3 0Era: Allegra
Fields:
pvMajor = 3,pvMinor = 0
3.3 📦 maryPV
maryPV :: ProtocolVersion
maryPV = ProtocolVersion 4 0Era: Mary
Fields:
pvMajor = 4,pvMinor = 0
3.4 🚀 alonzoPV
alonzoPV :: ProtocolVersion
alonzoPV = ProtocolVersion 5 0Era: Alonzo
Fields:
pvMajor = 5,pvMinor = 0
3.5 🌊 vasilPV
vasilPV :: ProtocolVersion
vasilPV = ProtocolVersion 7 0Era: 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 alonzoPV5 📚 Glossary
ProtocolVersion: record with
pvMajor :: IntandpvMinor :: Intdescribing 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.ApiCommonto retrieve allowed builtin functions for a given ledger and protocol version.
Last updated