How to Contribute

To contribute your zk-tasks to the UBI Task Pool, please follow these steps. For each task, submit a separate application. If you have multiple tasks, kindly submit individual applications for each.

Step 1: Fill out Information:

Provide details below and create a new GitHub Issue.

ZK-Task Information:

  • Describe your zk-task, including task details, completion requirements, and minimal resource prerequisites.

  • Resource Requirements:

    • RAM:

    • Storage:

    • vCPU numbers:

    • GPU:

  • Input Parameters:

    • Specify input parameters required for your zk-task.

  • Task Completion:

    • Clarify the method to complete your task (customized binary, or other).

  • Output:

    • Describe the zk proof generated as output.

  • Verification:

    • Explain how to verify your proof.

  • Additional Parameters:

    • Mention any other necessary parameters.

  • A complete example: Include the task sample, proof, verify result etc.

Note: Repeat these steps for each zk-task if multiple tasks are being submitted.

Example Application:

ZK-Task Information:

  • Description: Implementing a customized binary for secure data processing.

  • Resource Requirements:

    • RAM: 16GB

    • Storage: 200GB

    • vCPU numbers: 4

    • GPU: Nvidia GTX 1080

  • Input Parameters: JSON file with task specifications.

  • Task Completion: Utilize the provided binary for data processing.

  • Output: ZK proof generated after task completion.

  • Verification: Refer to the attached verification guide.

  • Additional Parameters: Any additional information, requirements, or dependencies.

  • A complete example: Include the task sample, proof, verify result etc.

Submission Guidelines:

  1. Fill out the information above.

  2. Create a new GitHub Issue. with this information.Once the issue is reviewed and approved, we will provide you with the "ubi_engine_base_url" for you to submit your zk-task.

  3. Label the issue with "zk-task" and any specific task identifiers.

We appreciate your contributions to elevate the UBI Task Pool with your innovative zk-tasks.

Step 2: Submit your ZK-task to the UBI Task Pool

You can submit your zk-task to the pool through the API.

  • Method: [POST] {ubi_hub_base_url}/v1/tasks

  • Request Parameters:

//Parameters examples:
{
  "name": "example_task",
  "type": 1,
  "zk_type": "fil-c2-512M",
  "input_param": "example_input_zsdt_url",
  "verify_param": "example_verify_url",
  "resource_id": 1
}
  • Response:

// return the task_id
{
  "task_id": 1,
}

Request Demo

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"github.com/swanchain/ubi-benchmark/utils"
	"net/http"
)

func main() {
	var task = Task{
		Name:        "example_task",
		Type:        1,
		ZkType:      "fil-c2-512M",
		InputParam:  "example_input_zsdt_url",
		VerifyParam: "example_verify_url",
		ResourceID:  GPU512,
	}

	jsonData, err := json.Marshal(task)
	if err != nil {
		log.Errorf("JSON encoding failed: %v", err)
		return
	}

	resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("POST request failed: %v", err)
		return
	}
	defer resp.Body.Close()

	if resp.StatusCode == http.StatusOK {
		fmt.Printf("Request successful, status code: %d \n", resp.StatusCode)
	} else {
		fmt.Printf("Request failed, status code: %d \n", resp.StatusCode)
	}
}

type Task struct {
	Name        string `json:"name"`
	Type        int    `json:"type"`
	ZkType      string `json:"zk_type"`
	InputParam  string `json:"input_param"`
	VerifyParam string `json:"verify_param"`
	ResourceID  int    `json:"resource_id"`
}

const (
	CPU512 = 1
	CPU32G = 2
	GPU512 = 3
	GPU32G = 4
)

Note: If the configurations mentioned above (GPU/CPU) do not meet your requirements, please leave your specific requirements in the GitHub issue.

Step 3: Get the ZK-Task Proof

You can request your zk-task's result from the pool through the API.

  • Method: [GET] {ubi_hub_base_url}/v1/tasks/{taskId}

  • Request Parameters:

// Parameters Examples:
{
  "id": 1,
  "type": 1,
  "zk_type": "fil-c2-512M",
  "proof": "xxxxx"
}
  • Response:

// return the task result.
{
  "proof": "xxxxx",
}

Thank you for your contribution, and we hope your zk-task brings added value to the Swan decentralized computing ecosystem!

Last updated