Assignment Commit
Enroll in a course and commit to an assignment
Course Student Assignment Commit
Enroll in a course and commit to an assignment. This transaction replaces the deprecated /enroll endpoint - commitment is now required. Students cannot enroll without committing to an assignment.
API Endpoint
POST /v2/tx/course/student/assignment/commitCost Summary
| Cost Type | Amount | Notes |
|---|---|---|
| Transaction Fee | ~0.36 ADA | Network fee |
| Protocol Fee | 0 ADA | No service fee for enrollment |
| Course State Deposit | ~2 ADA | Locked in course-state UTxO (recoverable on credential claim) |
| Global State Delta | ~0.29 ADA | Increased minUTxO for larger datum |
| Total Wallet Delta | ~2.14 ADA | First-time enrollment with commitment |
Request Body
{
"alias": "student_001",
"course_id": "e276a1f2729f06036299998f046765ffdde7ad8fd47f689690fbe2b1",
"slt_hash": "10dde6f0936b3dba3339356838e59b1af0f511a777a8701c49d941351b3abcf0",
"assignment_info": "some assignment evidence hash"
}| Field | Type | Required | Description |
|---|---|---|---|
alias | string | Yes | Student's access token alias (1-31 chars) |
course_id | string | Yes | Course NFT policy ID (56 char hex) |
slt_hash | string | Yes | Module token name to commit to (64 char hex) |
assignment_info | string | Yes | Evidence hash or description for the assignment |
Transaction Pattern
Mint + Spend Pattern - This transaction mints a new course-state token (if not enrolled) and spends the global state to record enrollment.
┌─────────────────────────────────────────────────────────────────┐
│ ASSIGNMENT COMMIT TRANSACTION │
├─────────────────────────────────────────────────────────────────┤
│ │
│ INPUTS OUTPUTS │
│ ────── ─────── │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Global State │───────────▶│ Global State │ │
│ │ (g-token) │ SPEND │ (enrollment │ │
│ │ │ │ added to map) │ │
│ └─────────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Wallet │───────────▶│ Course State │ NEW UTxO │
│ │ (u-token + ADA) │ │ (constructor 1) │ │
│ └─────────────────┘ └─────────────────┘ │
│ │
│ MINTS ┌─────────────────┐ │
│ ───── │ User Wallet │ │
│ course-state-policy │ (u-token + │ │
│ • +1 {student_alias} ────────│ change) │ │
│ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘Inputs
| Input | Type | Validator | Description |
|---|---|---|---|
| Global State | Script | global-state-v2 | Student's global state with g-token |
| Access Token | Wallet | - | Student's u-prefixed access token (proves identity) |
| Wallet UTxOs | Wallet | - | ADA for fees and deposits |
Outputs
| Output | Type | Validator | Value | Description |
|---|---|---|---|---|
| Global State | Script | global-state-v2 | ~1.84 ADA + g-token | Updated with enrollment hash |
| Course State | Script | course-state-validator | ~2 ADA + course-state token | New course enrollment UTxO |
| User Wallet | Wallet | - | u-token + change | Access token returned |
Minting Operations
| Policy | Token Name | Quantity | Description |
|---|---|---|---|
| course-state-policy | {student_alias} | +1 | Minted for new enrollment |
Note: The course-state-policy is parameterized per course - each course has its own minting policy.
Datum Structures
Global State Datum (Updated)
Constructor 0:
├── alias: "student_001"
└── local_state_information: Map
└── {course_id}: {enrollment_hash} ← NEW ENTRYCourse State Datum (Created)
Constructor 1 (Active Commitment):
├── slt_hash: {module_token_name}
├── assignment_info: {evidence_hash}
└── completed_modules: []Redeemers
| Script | Constructor | Fields | Description |
|---|---|---|---|
| global-state-v2 (spend) | 0 | course_id, flag=-1, "", course_state_policy | Enrollment action |
| course-state-policy (mint) | 0 | alias, [], commit_data | Mint with commitment |
Reference Inputs
| UTxO | Description |
|---|---|
0d1344689b1a2d2eafad032d9b5e36f899092751274b659cf8600a978bcbe10e#2 | Script ref for global-state-v2 |
2ac1be2d55cf5097eaa1b24d871c60bbbeb178b7fc5a3f2cfda5c7a99fb7ff8e#2 | Course's LocalStateToken (contains validator script_ref) |
957a855b5ae7fefe3d13c051f2f3234674c765c7cf986244ae5a2a5960d59fd4#1 | Script ref for course-state-policy |
Key Notes
Replaces Deprecated /enroll Endpoint
The old /v2/tx/course/student/enroll endpoint is deprecated. This new endpoint combines enrollment and commitment into a single transaction. Commitment is mandatory - students must specify an slt_hash and assignment_info when enrolling.
Enrollment Hash
When enrolling, an enrollment_hash is derived from the commitment data and stored in the global state's local_state_information map. This hash changes to a credential_hash when the student claims their credential.
Course State Constructors
| Constructor | State | Fields |
|---|---|---|
| 0 | Enrolled, no active commitment | [completed_modules] |
| 1 | Enrolled, has active commitment | [slt_hash, assignment_info, completed_modules] |
Student Journey
┌──────────────────────────────────────────────────────────────────┐
│ STUDENT COURSE JOURNEY │
├──────────────────────────────────────────────────────────────────┤
│ │
│ assignment/commit ──▶ assignment/update ──▶ (teacher assesses) │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Enroll + │ │ Update │ │ Accept/ │ │
│ │ Commit │ │ Evidence │ │ Refuse │ │
│ └───────────┘ └───────────┘ └───────────┘ │
│ │ │
│ ┌─────────────────────┘ │
│ ▼ │
│ credential/claim │
│ │ │
│ ▼ │
│ ┌───────────┐ │
│ │ Burn │ │
│ │ Course │ │
│ │ State │ │
│ └───────────┘ │
│ │
└──────────────────────────────────────────────────────────────────┘See Also
- Assignment Update - Update assignment submission
- Assignments Assess - Teacher assessment
- Credential Claim - Claim course credential