Loading player…

Write your first Daml Contract I Jatin Pandya

Thu, Jul 2, 2026, 12:00 AM

In this workshop, Jatin Pandya walks through writing a first DAML smart contract on the Canton network and building, testing, and inspecting it using DPM, the DAML package manager. He starts by pointing developers to docs.canton.network where they can find tutorials including Module 2, which compares Canton to Ethereum for hackathon builders coming from a Solidity background. Jatin explains that DPM is a CLI tool covering the full lifecycle of DAML development, from scaffolding new projects to building, testing, and interacting with smart contracts. Jatin live codes an invoice smart contract featuring two parties (seller and buyer), an amount, a paid status, and a description. He explains DAML's core concepts: templates instead of smart contracts, choices instead of functions, and the proof of stakeholders model using signatories (who must sign actions) and observers (who can see state changes). The contract includes ensure clauses to validate positive amounts, a pay choice that returns a receipt, and a dispute choice with a required reason. He runs dpm build to compile the DAML code into a DAR file ready for ledger deployment, dpm test to execute test scripts achieving 100% pass rate, and dpm damlc inspect-dar to retrieve the package hex string used as the contract's identity on the Canton ledger. 00:00 Introduction 00:20 Where to Find Canton Documentation 01:19 What Is DPM (DAML Package Manager) 02:00 Installing DPM and Checking Versions 03:43 Exploring DPM Commands 04:51 Listing Available DAML Templates 06:01 Creating a New DAML Project from Scratch 07:23 Setting Up the Invoice DAML File 07:58 DAML VS Code Extensions Overview 08:53 Writing the Module and Importing DAML Script 09:50 Defining a Template with Parameters 11:14 Understanding Parties as Canton Addresses 12:27 Signatories vs Observers: Proof of Stakeholders 14:09 Using Ensure to Validate Amount 15:23 Choices: The DAML Version of Functions 16:18 Writing the Pay Choice with Controller 19:47 Adding a Dispute Choice with Reason 22:07 Completed Smart Contract Walkthrough 23:18 Writing Test Scripts with Alice and Bob 24:44 Running DPM Build to Generate the DAR File 26:01 Running DPM Test for Coverage Summary 27:13 Using DPM DAMLC to Inspect DAR Files 28:04 Extracting Package Hex String for Ledger Identity 29:44 Closing Remarks _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ✅ *Follow ETHGlobal* X: https://x.com/ETHGlobal​ Website: https://ethglobal.com YouTube: https://www.youtube.com/c/ETHGlobal _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Are you interested in Ethereum development and entrepreneurship?_ 👉 Sign up for the next ETHGlobal event: https://ethglobal.com/events 🎁 Get exclusive access and perks with ETHGlobal Plus! https://ethglobal.com/plus 📣 Want us to throw an event in your city? Tell us where! https://ethglobal.com/city _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _