Andamio Logo
Protocol/Protocol V2/Transactions/Project/Contributor/Task

Task Commit

Enroll in a project and commit to a task

Project Contributor Task Commit

Enroll in a project (if not already enrolled) and commit to a task. This transaction combines enrollment with task commitment, similar to how course enrollment now requires assignment commitment.

API Endpoint

POST /v2/tx/project/contributor/task/commit

Cost Summary

Cost TypeAmountNotes
Transaction Fee~0.51 ADANetwork fee
Protocol Fee0 ADANo service fee
Contributor State Deposit~14.5 ADAHolds enrollment data (from escrow)

Request Body

{
  "alias": "student_001",
  "project_id": "3b20d771fff69738127691ec3aea3803cdae1b1292ed1e1ca62a5f30",
  "contributor_state_id": "c69d2d5d5889edda8aa30550c340303ff7c9e74dd01c028528e24495",
  "task_hash": "33668fb12ca84cb6676e84a29aaa1a7bee46f156c7c2a88f86ad400e829e34cb",
  "task_info": "Some task completion info."
}
FieldTypeRequiredDescription
aliasstringYesContributor's access token alias
project_idstringYesProject NFT policy ID (56 char hex)
contributor_state_idstringYesContributor state policy ID (from project prerequisites)
task_hashstringYesHash of the task to commit to (64 char hex)
task_infostringYesEvidence/info for the task submission

Transaction Pattern

Mint, Update Global State, and Commit with Observer - This is the project equivalent of course enrollment.

+---------------------------------------------------------------------+
|                    TASK COMMIT TRANSACTION                           |
+---------------------------------------------------------------------+
|                                                                      |
|  INPUTS                           OUTPUTS                            |
|  ------                           -------                            |
|  +------------------+             +------------------+               |
|  | Global State V2  |------------>| Global State V2  |               |
|  | (g-token + datum |   SPEND     | (updated creds   |               |
|  |  with cred map)  |             |  map with proj)  |               |
|  +------------------+             +------------------+               |
|                                                                      |
|  +------------------+             +------------------+               |
|  | Task Escrow      |------------>| Task Escrow      |               |
|  | (treasury-token  |   SPEND     | (updated task    |               |
|  |  + task hashes)  |             |  hash list)      |               |
|  +------------------+             +------------------+               |
|                                                                      |
|  +------------------+             +------------------+               |
|  | Task Deposit     |------------>| Contributor      |  NEW OUTPUT   |
|  | (escrow deposit) |   SPEND     | State            |               |
|  +------------------+             | (with task       |               |
|                                   |  commitment)     |               |
|  +------------------+             +------------------+               |
|  | Wallet           |                                                |
|  | (u-token + ADA)  |             +------------------+               |
|  +------------------+             | User Wallet      |               |
|                                   | (u-token +       |               |
|  MINTS: contributor-state-token   |  change)         |               |
|  -------------------------------- +------------------+               |
|  Token name = contributor alias                                      |
|                                                                      |
|  OBSERVER VALIDATION                                                 |
|  -------------------                                                 |
|  task-commit-observer validates commitment operation                 |
|                                                                      |
+---------------------------------------------------------------------+

Critical Design: On first enrollment, this transaction MINTS a contributor-state token. The mint redeemer includes prerequisite verification (proof that the contributor holds required course credentials).

Key Concepts

Prerequisites: contributor_state_id

The contributor_state_id defines the credential a contributor must hold. Rather than listing individual SLT hashes, this single policy ID encapsulates "has completed course X" - the on-chain logic verifies they hold the appropriate course-state credential.

Global State Update

The global-state-v2 UTxO is spent and recreated with the project credential added to the contributor's credentials map. The redeemer flag = -1 indicates an enrollment action.

Contributor State Datum

The contributor-state token is held in a validator with a datum describing the commitment:

  • Constructor 0: No active commitment (just enrolled, completed_tasks list)
  • Constructor 1: Has active commitment (task_definition + task_info + completed_tasks)

This is analogous to course-state datum structure.

Parameterized Validators

Both task-escrow-validator and contributor-state-validator addresses vary per project. The stake credential remains the same, but payment credentials differ based on project parameters.

Prerequisite Verification

The mint redeemer includes prerequisite proof:

  • List of {courseId, completed_slts, metadata} entries
  • Map of courseId -> completed_slts

This proves the contributor has the required course credentials.

Inputs

InputTypeValidatorDescription
Global State V2Scriptglobal-state-v2Contributor's global state UTxO
Task EscrowScripttask-escrow-validatorTask escrow with available tasks
Task DepositScripttask-escrow-validatorDeposit UTxO for contributor-state creation
Access TokenWallet-Contributor's u-token
Wallet UTxOsWallet-ADA for fees

Outputs

OutputValidatorValueDescription
Global State V2global-state-v2g-token + ~2 ADAUpdated credentials map
Contributor Statecontributor-state-validatorcontributor-state-token + ~14.5 ADANEW - holds task commitment
Task Escrowtask-escrow-validatortreasury-token + ~5 ADAUpdated task list
User Walletwalletu-token + changeAccess token returned

Mints

PolicyTokenQuantityDescription
contributor-state-policy{alias}1Contributor state token (first enrollment only)

Observer Validation

The task-commit-observer validates the commitment operation:

Redeemer: {
  constructor: 0,
  fields: [
    "student_001",           // alias
    {                        // task_definition
      project_content: "...",
      expiration_time: 1234567890000,
      lovelace_amount: 5000000,
      native_assets: []
    },
    [],                      // empty list
    "Some task completion info."  // task_info
  ]
}

Key Notes

  • Mints on first enrollment - Contributor-state token minted only on first project enrollment
  • No protocol fee - Only network transaction fee applies
  • Combined enrollment + commit - Cannot enroll without committing to a task
  • Parameterized validators - Addresses vary per project

See Also