Andamio LogoAndamio
Protocol/Protocol V2/Transactions/Course/Student/Assignment

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/commit

Cost Summary

Cost TypeAmountNotes
Transaction Fee~0.36 ADANetwork fee
Protocol Fee0 ADANo service fee for enrollment
Course State Deposit~2 ADALocked in course-state UTxO (recoverable on credential claim)
Global State Delta~0.29 ADAIncreased minUTxO for larger datum
Total Wallet Delta~2.14 ADAFirst-time enrollment with commitment

Request Body

{
  "alias": "student_001",
  "course_id": "e276a1f2729f06036299998f046765ffdde7ad8fd47f689690fbe2b1",
  "slt_hash": "10dde6f0936b3dba3339356838e59b1af0f511a777a8701c49d941351b3abcf0",
  "assignment_info": "some assignment evidence hash"
}
FieldTypeRequiredDescription
aliasstringYesStudent's access token alias (1-31 chars)
course_idstringYesCourse NFT policy ID (56 char hex)
slt_hashstringYesModule token name to commit to (64 char hex)
assignment_infostringYesEvidence 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

InputTypeValidatorDescription
Global StateScriptglobal-state-v2Student's global state with g-token
Access TokenWallet-Student's u-prefixed access token (proves identity)
Wallet UTxOsWallet-ADA for fees and deposits

Outputs

OutputTypeValidatorValueDescription
Global StateScriptglobal-state-v2~1.84 ADA + g-tokenUpdated with enrollment hash
Course StateScriptcourse-state-validator~2 ADA + course-state tokenNew course enrollment UTxO
User WalletWallet-u-token + changeAccess token returned

Minting Operations

PolicyToken NameQuantityDescription
course-state-policy{student_alias}+1Minted 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 ENTRY

Course State Datum (Created)

Constructor 1 (Active Commitment):
├── slt_hash: {module_token_name}
├── assignment_info: {evidence_hash}
└── completed_modules: []

Redeemers

ScriptConstructorFieldsDescription
global-state-v2 (spend)0course_id, flag=-1, "", course_state_policyEnrollment action
course-state-policy (mint)0alias, [], commit_dataMint with commitment

Reference Inputs

UTxODescription
0d1344689b1a2d2eafad032d9b5e36f899092751274b659cf8600a978bcbe10e#2Script ref for global-state-v2
2ac1be2d55cf5097eaa1b24d871c60bbbeb178b7fc5a3f2cfda5c7a99fb7ff8e#2Course's LocalStateToken (contains validator script_ref)
957a855b5ae7fefe3d13c051f2f3234674c765c7cf986244ae5a2a5960d59fd4#1Script 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

ConstructorStateFields
0Enrolled, no active commitment[completed_modules]
1Enrolled, 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