Validation Service

Overview

The Validation Service is a container with the task validation logic that can be called by the attester nodes. It acts as a micro-service for task validation and can be written in any code language.

Tasks are being gossiped across the p2p network to Task Attesters for validation and approval. Task Attesters interface with the Validation Service endpoint for task validation by sending a POST HTTP request with the following params:

curl -X POST \
  http://localhost/validate_task \
  -H 'Content-Type: application/json' \
  -d '{
    "proofOfTask": "{your_proof_of_task_data}",
    "data": "{Represent an additional data to be added to the Consensus}",
    "taskDefinitionID": "{The ID of specific Task definition}",
    "performer": "{The address of the Task Performer}"
  }'
ParameterTypeDescription

string

Any string that the Attesters can use to verify that the Performer has executed its task as expected

data

bytes

Represent an additional data to be added to the consensus

taskDefinitionID

uint16

The ID of specific Task definition

performer

address

The address of the Task Performer

The Validation Service uses the task details to conclude whether the task was executed as expected. All validity-related information must be contained in the Proof of Task.

Task Attesters can only return a signed approval or rejection and are not authorized to change or edit the task details.

Endpoint

In the Othentic CLI, the Task Attesters call the /task/validate endpoint on the Validation Service. When spinning up the Task Attesters, you need to specify the ipv4 address of the Validation Service server.

Each Task Attester must spin up its own Validation Service and perform local endpoint calls to ensure an immutable and distributed task validation process.

Example

You can check the Validation Service example of the Price Oracle repo.

In the Price Oracle example, the Validation Service exposes the /task/validate endpoint in an express server that the Task Attesters can call.

The attester node calls the endpoint to initiate the validation logic. In the Price Oracle example, the Validation Service fetches the data source price and matches the result with the corresponding results of the Task Performer. If the results are within a defined threshold or margin of error, the service approves the task and returns it back to the Task Attester, which signs the response and propagates its attestation back to the network for aggregation discovery.

Last updated