Create Task
Last updated
Last updated
We need a Koii account and network setup first. We provide the Koii CLI tool to easily set up K2 locally and generate a wallet; check here.
Using the Koii CLINow that we have our account and the network setup, let's move on to actually creating a task and registering it with the network.
Install the create-koii-task-cli from NPM and run the tool by running npx @_koii/create-task-cli
in your terminal; it prompts for your wallet path. Use the path to your Koii account id.json
that we mentioned as input.
After successful input for the wallet path, the following are the prompts for the creation of the task.
Enter the name of the task: Any Name .. Seriously your choice! E.g: Blazing-Fast-Execution
Enter short description of your task: A brief explanation of the task you're creating.
Enter the network to be used to upload your executable [IPFS / ARWEAVE / DEVELOPMENT]: Choose IPFS or ARWEAVE for storage of your executable file, or DEVELOPMENT if you haven’t developed your task yet.
Note — The next prompt depends on your answer to the prompt above.
[For IPFS] Enter the web3.storage API key: If you choose to store your task executable on IPFS, you’ll be required to add your web3.storage API key, visit here to create a web3.storage account. After creating an account, create an API Token for your project, paste the API token on this prompt. e.g: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9....
[For Arweave] Enter Arweave id of the deployed Koii task executable program: If you choose your task executable on Arweave, you have to upload your executable on Arweave and provide the ID to the uploaded file.
[For DEVELOPMENT] Enter the name of executable you want to run on task-nodes: Enter a desired name for your task executable, this will be the same name of the executable file that will exist in the task node's executables folder.
[For IPFS and ARWEAVE] Enter the path to your executable webpack: Add the absolute path to your executable file. E.g: /Users/<YOUR_HOME>/Documents/testing-task/dist/main.js
Enter the round time in slots: The preferred number of slots per round for the task. E.g: 1000
Enter the audit window in slots: The number of slots to be allocated to the audit window. E.g: 500
Enter the submission window in slots: The number of slots to be allocated to the submission window. E.g: 300
Note — The number of slots in the audit window and submission must be lower than the number of slots per round.
Enter the minimum staking amount in lamports: Add the minimum amount node operators should be able to stake on the task. E.g: 50
Enter the total bounty you want to allocate for the task (In KOII): Any amount not more than what you have in your wallet though. E.g: 1000
(We suggest the amount could be run at least 4 epochs)
Enter the bounty amount per round: Total amount would be divided equally for each number until the bounty fund is exhausted. E.g: 10
Enter TaskMetadata CID hosted on IPFS (Leave empty for None): If you've hosted the metadata for your task on IPFS, add the CID here; otherwise, leave blank. Use your web3.storage account, click the Upload Files button, and then upload a JSON file containing the metadata for your task. Add the CID for the uploaded file to this prompt. Check out a metadata example.
Enter CID for environment variables hosted on IPFS (Leave empty for None): If your task requires environment variables to be run by node runners, upload a JSON file that contains those variables to IPFS using web3.storage. Add the uploaded file's CID to this prompt.
Enter the space, you want to allocate for task account (in MBs): Each task would need some storage for persistence, in general in MBs. E.g: 10
After the final confirmation of y
, your task would be created along with a taskStateInfoKeypair.json
which is used to control the task state info.
Strong measures should be taken to protect this JSON file.
The output of the command should be similar to the following.
Whenever we refer to task account, we mean the task State Info Pubkey
.
The bounty amount will be present in Stake Pot Account