Create Tasks
Overview
The Othentic CLI allows you to define different Tasks to be performed by Operators. This guide covers the commands needed to define these tasks via Task Definitions.
Read More
Prerequisites
Access to AVS Governance multisig owner account
Attestation Center contract address of the AVS
Create Tasks
Run the following command:
otcli network create-task-definition
Pass --browser-sign
flag to connect your wallet and sign using a web browser UI.
Follow these steps when prompted:
Provide the private key of the multi-sig address.
Enter the Attestation Center contract address.
Enter all the Task details
Task Name
Base Rewards (e.g. 0.001 ether; default: 0)
Attester rewards
Performer rewards
Aggregator rewards
Minimum voting power
Restricted attester IDs
Max number of Attesters
Expiry block – When the task expires (leave blank for never)
Implement Task Execution Service Logic
Write the logic that the Performer will execute.
In your implementation, make sure to execute the task based on the appropriate Task Definition ID.
curl -X POST http://localhost:4003/task/execute \
-H "Content-Type: application/json" \
-d '{
"taskDefinitionId": 123
}'
Implement Task Validation Service Logic
Write the logic that the Attester will execute.
In your implementation, make sure to validate the task based on the appropriate Task Definition ID received as part of the `sendTask` RPC request.
{
"taskDefinitionId": 123,
"proofOfTask": "abcs",
"data": "0x1232",
"performer": "0x1234567890abcdef1234567890abcdef12345678"
}
Verify Tasks creation
Refer to the following Task specific methods in the Attestation center to get details about the tasks created. These methods allow you to query Task specific data like Minimum Voting Power, Restricted Operator Set etc.
Using scripts
New Task Definitions are created on-chain via the AttestationCenter
smart contract. To create a task definition, call createNewTaskDefinition
as shown in the example below:
const attestationCenter = new ethers.Contract(
ATTESTATION_CENTER_ADDRESS,
['function createNewTaskDefinition(string,(uint256,uint256,uint256,uint256,uint256,uint256,uint256[])) external']
);
const tx = await attestationCenter.createNewTaskDefinition(
"Example Task", // Human-readable name
{
ethers.MaxUint256, // Never expires
ethers.parseEther('0.01'), // Reward for attestation
ethers.parseEther('0.1'), // Reward for performer
ethers.parseEther('0.005'), // Reward for aggregation
0, // Disable disputes
0, // Minimum Voting Power
[] // Restricted Operator Set
}
);
await tx.wait();
Last updated