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) from Plutus.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 and pvMinor :: 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