# Task Development Guide

## **Easy-Peasy, JavaScript**

Our mission is to improve access to decentralized technology, which is why Koii Tasks are written and configured entirely in JavaScript (NodeJS 16, to be exact) and support the majority of popular [NPM Modules](https://npmjs.org). It can help to think of Task Executables as [Express.js](https://expressjs.com/) nodes for hire, each of which stake tokens and reputation to participate. Combined with[ Koii-X](https://koii-network.gitbook.io/getting-started/build-dapps-with-koii/welcome-to-koii-x), that means you can deploy an entire stack, decentralized, with just JavaScript, while taking advantage of all the existing Node.js modules.&#x20;

## **Developing Tasks**

When creating a new task, there are three main functions that define the task's logic, how results should be verified, and how rewards will be distributed. These are the functions:

1. **The Task Function**\
   This function contains the core logic of the Koii task and submits the proof of the work done by participating nodes to K2. <br>
2. **The Audit Function**

   This function verifies the validity of the submissions made by nodes.  If a node's submission is invalid, an Audit is initiated, and other participating nodes vote for or against the Audit. If they cast a negative vote, the malicious node's stake is slashed and they are not eligible to receive rewards for completing the task.&#x20;

   Any significant aspects of the task, regardless of whether they are directly associated with bounties or not, should be subject to audits.\
   \
   Please see the [audit section ](https://koii-network.gitbook.io/getting-started/microservices-and-tasks/what-are-tasks/what-are-audits)for details.
3. **The Distribution Function**&#x20;

   This function generates a distribution list and submits it on-chain. A distribution list is a JSON object containing a key-value pair, where the key is the public key of the node that made the submission and the value is the number of KOII tokens to be rewarded to the node.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://koii-network.gitbook.io/getting-started/microservices-and-tasks/task-development-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
