Skip to content

besiwims/plutus-tx-template

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

82 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🧭 1. Auction Validator Project

Updated by Coxygen Global – Bernard Sibanda

πŸ’‘ Plinth currently supports GHC 9.6.x and Cabal 3.8+ (recommended).

πŸ“‘ 2. Table of Contents

  1. 🧭 Auction Validator Project
  2. πŸ“‘ Table of Contents
  3. βš™οΈ Overview
  4. ✨ Features
  5. πŸ—οΈ Architecture
  6. πŸ“‹ Prerequisites
  7. ⚑ Quick Start
  8. πŸ› οΈ Installation & Build
  9. πŸ§ͺ Testing
  10. πŸ” Property-Based Testing
  11. πŸš€ Usage
  12. βš™οΈ Configuration
  13. πŸ“‚ Directory Structure
  14. πŸ”„ Development Workflow
  15. πŸ€– CI/CD (Optional)
  16. 🧯 Troubleshooting
  17. πŸ’¬ FAQ
  18. 🀝 Contributing
  19. πŸ“œ License
  20. πŸ“– Glossary

βš™οΈ 3. Overview

This repository contains a Plutus-based Auction Validator and Minting Policy.
It includes Blueprint generators, property-based tests, and development tooling.
The project is based on the Plinth Template for teaching on-chain Cardano smart contract development.

✨ 4. Features

  • πŸͺ™ On-chain Auction Validator (bid, close, payout logic)
  • 🧱 Minting Policy for auction tokens
  • 🧩 Blueprint generation tools for off-chain deployment
  • πŸ§ͺ Unit tests and property-based tests
  • 🧰 Nix and Devcontainer support for reproducibility
  • πŸ”„ Modular Cabal/Nix structure for teaching and reuse

πŸ—οΈ 5. Architecture

Layer Purpose
🧠 On-chain Logic Implemented in src/AuctionValidator.hs.
🧰 Executables Blueprint generators under app/.
πŸ§ͺ Tests Unit + property suites under test/.
βš™οΈ Infrastructure Cabal/Nix build environment.

πŸ“‹ 6. Prerequisites

  • GHC 9.6.x
  • Cabal 3.8+
  • Nix (optional)
  • Docker / Devcontainer (optional)

🧩 If not using Nix, install via Haskell Platform or ghcup.

⚑ 7. Quick Start

# 1️⃣ Enter Nix shell (recommended)
nix-shell

# 2️⃣ Update Cabal package index
cabal update

# 3️⃣ Build project and tests
cabal build --enable-tests

# 4️⃣ Run test suite
cabal test

πŸ› οΈ 8. Installation & Build

  1. Enter Nix shell (optional)

    nix-shell
  2. Update Cabal index

    cabal update
  3. Build project

    cabal build --enable-tests
  4. Generate Blueprints

    cabal run gen-auction-validator-blueprint -- ./blueprint-auction.json
    cabal run gen-minting-policy-blueprint -- ./blueprint-minting.json

πŸ§ͺ 9. Testing

🧩 Unit Tests

cabal test auction-tests

πŸ” Run All Tests

cabal test

πŸ” 10. Property-Based Testing

Example Cabal config:

test-suite auction-properties
  type: exitcode-stdio-1.0
  main-is: AuctionValidatorProperties.hs
  hs-source-dirs: test
  build-depends:
      base >=4.7 && <5
    , QuickCheck
    , plutus-ledger-api
    , plutus-tx
    , scripts
  default-language: Haskell2010

Run:

cabal test auction-properties

πŸš€ 11. Usage

  1. Customize parameters in app/GenAuctionValidatorBlueprint.hs (e.g. seller, token name, min bid, end time).
  2. Generate blueprint JSONs via Cabal commands.
  3. Deploy the compiled Plutus scripts to Cardano network.
  4. Verify with unit and property-based tests.

βš™οΈ 12. Configuration

  • Project settings: cabal.project, auction.cabal

  • Local overrides: cabal.project.local

  • To ignore local configs:

    echo "cabal.project.local" >> .gitignore

πŸ“‚ 13. Directory Structure

auction/
β”œβ”€β”€ app/                        # Executables (Blueprint generators)
β”‚   β”œβ”€β”€ GenAuctionValidatorBlueprint.hs
β”‚   └── GenMintingPolicyBlueprint.hs
β”œβ”€β”€ src/                        # On-chain modules
β”‚   └── AuctionValidator.hs
β”œβ”€β”€ test/                       # Tests
β”‚   β”œβ”€β”€ AuctionValidatorSpec.hs
β”‚   β”œβ”€β”€ AuctionMintingPolicySpec.hs
β”‚   └── AuctionValidatorProperties.hs
β”œβ”€β”€ default.nix
β”œβ”€β”€ shell.nix
β”œβ”€β”€ auction.cabal
β”œβ”€β”€ cabal.project
└── cabal.project.local

πŸ”„ 14. Development Workflow

  1. 🌿 Create a new branch
  2. 🧱 Make modular commits
  3. βœ… Run cabal test
  4. 🧹 Format and lint
  5. πŸ”€ Merge via PR
  6. 🏷️ Tag releases

πŸ€– 15. CI/CD (Optional)

  • 🧰 Build & Test: cabal build --enable-tests && cabal test
  • πŸ“¦ Artifacts: Upload blueprint JSONs, logs, etc.
  • ⚑ Cache: Use Cabal store caching for faster pipelines.

🧯 16. Troubleshooting

Issue Fix
Build fails cabal clean && cabal update && cabal build --enable-tests
Wrong compiler Use ghc --version β†’ must be 9.6.x
Nix errors Try nix develop or update flakes
Devcontainer fails Check Docker Desktop / VSCode extensions

πŸ’¬ 17. FAQ

Q: Do I need Nix? A: No. It’s optional but ensures reproducibility.

Q: Where do I change auction parameters? A: In GenAuctionValidatorBlueprint.hs.

Q: How do I run only property tests? A: cabal test auction-properties

🀝 18. Contributing

  1. 🍴 Fork this repo
  2. 🌿 Branch from main
  3. 🧩 Add code + tests
  4. πŸ” Verify with cabal test
  5. πŸ“¨ Open a Pull Request

πŸ“œ 19. License

Released under the MIT License (or your organization’s chosen license). See the LICENSE file for details.

πŸ“– 20. Glossary

Icon Term Description
βš™οΈ Cabal Haskell’s package manager and build tool.
🧠 GHC The Glasgow Haskell Compiler.
πŸ’Ž Plutus Cardano’s smart contract platform.
🧾 Blueprint JSON representation of a Plutus script and parameters.
🧩 ScriptContext Context for execution (TxInfo, ScriptPurpose).
πŸ”— TxInfo Transaction metadata passed to the validator.
πŸ§ͺ QuickCheck Haskell property-based testing framework.
🧭 hspec Behavior-driven testing framework for Haskell.
πŸ—ΊοΈ AssocMap Plutus internal key–value map type.

🧠 Maintained by Coxygen Global – Bernard Sibanda πŸ“… Last updated: 15 September 2025 Developer: Balogun Muiz Dolapo

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 81.4%
  • Nix 18.6%