First time writing a task? Start with the Development Guide.
Tasks operate within a periodic structure known as 'rounds'. Each round consists of the following steps:
- Perform the Task: Execute the necessary actions for the round.
- Audit Work: Review the work completed by other nodes.
- Rewards and Penalties: Distribute rewards and apply penalties as necessary.
For more detailed information about the task flow, refer to the runtime flow documentation.
Looking to bring better structure to your task? Explore our Task Organizer for better organization.
- Always ensure your secret files, such as
.env
files, are secure! Implement a robust.gitignore
strategy. - Continue innovating with Koii!
Should you encounter any issues, don't hesitate to reach out by opening a ticket on Discord.
Simulate rounds using simulateTask.js.
yarn test
Runs Jest unit tests.
yarn jest-test
Builds the project and generates the main script: dist/main.js
.
yarn webpack
Runs the live debugger (must have the task running in the desktop node).
yarn prod-debug
There are two ways to run your task during development:
-
With
GLOBAL_TIMERS="true"
(refer to.env.local.example
) - When this option is enabled, IPC calls are made by calculating the average time slots of all tasks running on your node. -
With
GLOBAL_TIMERS="false"
- This option allows for manual calls to K2 and disables the automatic triggers for round management on K2. Transactions are only accepted during the correct time period. Instructions for manual calls can be found in Manual K2 Calls.