**Title : Coxy Haskell Plutus Builder (CHPB)** **Company : Coxygen Global (Pty) Ltd** **Author : Bernard Sibanda** **Date : 20 November 2025** ## Table of Contents 1. 📘 Introduction to Coxy Haskell Plutus Builder 2. 🧭 Core Concepts: Industries, Datum, Redeemer and Constraints 3. 🖥️ Getting Started with the CHPB Interface 4. 🔍 Searching and Selecting a Smart Contract Industry 5. 🧱 Working with Template Industries 6. 🧮 Configuring Coxy Datum and Custom Datum Fields 7. 🎛️ Configuring Coxy Redeemer and Action Constraints 8. 🧩 Using Parameter Datum (CoxyParamDatum) 9. 🧪 Creating a Custom Smart Contract Industry 10. ⚙️ Generating JSON Specifications and Haskell Code 11. 📂 Downloading and Integrating `ValidatorLogic.hs` 12. 🧷 End-to-End Example: Coxy / Marketplace Escrow 13. 🛠️ Troubleshooting and Practical Tips 14. 📚 Glossary of Terms ### 1. 📘 Introduction to Coxy Haskell Plutus Builder Coxy Haskell Plutus Builder (CHPB) is an interactive web-based tool that helps you design Plutus validator logic without manually wiring every data type and constraint from scratch. It gives you a curated library of “industries” such as marketplaces, auctions, AMMs and credit primitives, each with pre-defined datum fields, redeemer actions and safety constraints. From a single screen, you can select the industry you want, choose the data you care about, enable or disable constraints, and then generate machine-readable JSON specifications together with a ready-to-integrate Haskell module containing your `mkValidator` skeleton and associated types. CHPB has two modes of use. The first mode is template-based, where you simply pick one of the pre-packaged industries such as “Coxy / Marketplace”, “Membership SBT / DAO” or “Stable-swap AMM (Curve-like)” and specialise it by ticking fields and constraints. The second mode is fully custom, where you define your own contract title, datum type, redeemer type, datum fields and actions from scratch in a guided way, while still benefiting from the same export pipeline to JSON and Haskell code. ### 2. 🧭 Core Concepts: Industries, Datum, Redeemer and Constraints In CHPB, an “industry” represents a reusable contract archetype for a particular DeFi or Web3 use case. Each industry entry in `coxy-industries.js` specifies a datum type name, a redeemer type name, a list of datum fields, a list of redeemer actions and a set of constraints that can be attached to each action. For example, the “Coxy / Marketplace” industry defines a `CoxyDatum` with fields such as `seller`, `buyer`, `amount` and `deadline`, and a `CoxyRedeemer` with actions like `PaySeller` and `RefundBuyer`. A datum field is a typed on-chain value that describes the state of a contract instance, such as the seller’s public key hash or an auction deadline. Redeemer actions represent user-triggered events or flows, such as joining a DAO, placing a bid or executing a time-weighted order. Constraints are named logical conditions which will be checked in the final validator, for example “signedByBuyer” or “currentPriceComputedCorrectly”. In CHPB you bind constraints to actions using simple checkboxes, and the builder later converts this selection into Haskell `traceIfFalse` checks that call corresponding constraint functions like `constraint_signedByBuyer dat ctx`. ### 3. 🖥️ Getting Started with the CHPB Interface The CHPB interface is a single-page layout with a header, three-step top row, configuration panels for datum and redeemer, a preview area and an output section for JSON and Haskell code. The layout is styled with a modern card-based design and rounded buttons so that each logical block of the workflow is visually separated. At the very top you will see the title “Coxy Haskell Plutus Builder” which introduces the page as the main playground for your contract design session. Below the header, the interface walks you through a natural workflow: first you search or select an industry, then you adjust datum and redeemer settings, optionally configure parameter datum fields, and finally you click “Generate Logic Spec” to populate the JSON and Haskell output areas. A dedicated “Download ValidatorLogic.hs” button allows you to export the generated module as a file which you can drop directly into your Haskell project. ### 4. 🔍 Searching and Selecting a Smart Contract Industry The first row of CHPB contains three blocks that guide how you select or define your contract. The left block contains a search input labelled “1. Search Smart Contract Or Industry”. This search box filters the available industries by both their identifier and their label as you type, so you can quickly narrow down to, for example, “englishAuction”, “stableSwapAmm” or “membership” by entering any part of the industry name. The middle block is titled “2. Smart Contract Industry” and presents a `