pado-labs / pado-ao-process

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pado-ao-process

PADO AO Process is processes on AO. It mainly manage nodes, data and verifiable confidential computation tasks and results. It also handles computation cost. It includes Node Registry Process, Data Registry Process and Task Management Process.

Node Registry Process

Node Registry Process manages the public keys of PADO Node. It provides the functionality of add, update, delete and query. These operations are allowed only when the caller is in the white list. A node has the following attributes:

  • name: the name of the node
  • index: the index of the node, starting from 1, allocated when registered
  • publicKey: the public key of the node
  • desc: description of the node
  • from: the process which register the node

Add to white list

aos> Send({Target = <Node Manager ID>, Action = "AddWhiteList", Address = <Address>})

Query white list

aos> Send({Target = <Node Manager ID>, Action = "GetWhiteList"})

Remove from white list

aos> Send({Target = <Node Manager ID>, Action = "RemoveWhiteList", Address = <Address>})

Register a node:

aos> Send({Target = <Node Manager ID>, Action = "Register", Name = <Name>, Data = <Public Key>, Desc = <Desc>})

Update a node:

aos> Send({Target = <Node Manager ID>, Action = "Update", Name = <Name>, Data = <Public Key>, Desc = <Desc>})

Delete a node:

aos> Send({Target = <Node Manager ID>, Action = "Delete", Name = <Name>})

Get all nodes:

aos> Send({Target = <Node Manager ID>, Action = "Nodes"})

Get a node by its name:

aos> Send({Target = <Node Manager ID>, Action = "GetNodeByName", Name = <Name>})

Data Registry Process

Data Registry Process manages data uploaded by data provider.

The data has the following attributes:

  • id: the identify of the data
  • dataTag: the tag of the data
  • price: the price of the data
  • data: the content of the data
  • from: the process which upload the data

Upload data:

aos> Send({Target = <Data Manager ID>, Action = "Register", DataTag = <Data Tag>, Price = <Price>, Data = <EncSks>, Nonce = <Nonce>, EncMsg = <EncMsg>})

Get All Data

aos> Send({Target = <Data Manager ID>, Action = "AllData"})

Get Data By Id

aos> Send({Target = <Data Manager ID>, Action = "GetDataById", DataId = <Data ID>})

Delete Data

aos> Send({Target = <Data Manager ID>, Action = "Delete", DataId = <Data ID>})

Task Management Process

A task means the process that data user submits a request for purchase data, compute nodes operate on the data and provide their computation results, finally data user decrypt the data basing on the computation results.

The task has the following attributes:

  • id: the identity of the task
  • type: the task type of the task
  • inputData: the params of the task
  • computeLimit: the compute limit of the task
  • memoryLimit: the memory limit of the task
  • computeNodes: the nodes which participant in computing

Get computation price

aos> Send({Target = <Task Manager ID>, Action = "ComputationPrice"})

Submit a task:

aos> Send({Target = <Task Manager ID>, Action = "Submit", TaskType = <TaskType>, Data = <InputData>, ComputeLimit = <ComputeLimit>, MemoryLimit = <MemoryLimit>, ComputeNodes = <ComputeNodes>})

Report result on a task:

aos> Send({Target = <Task Manger ID>, Action = "ReportResult", TaskId = <TaskID>, NodeName = <NodeName>})

Get Pending Tasks

aos> Send({Target = <Task Manager ID>, Action = "GetPendingTasks"})

Get Completed Tasks

aos> Send({Target = <Task Manager ID>, Action = "GetCompletedTasks"})

Get Completed Task By Id

aos> Send({Target = <Task Manager ID>, Action = "GetCompletedById", TaskId = <TaskId>})

Get All Tasks

aos> Send({Target = <Task Manager ID>, Action = "GetAllTasks"})

Query Allowances

aos> Send({Target = <TaskManager ID>, Action = "Allowances"})

Withdraw

aos> Send({Target = <Task Manager ID>, Action = "Withdraw", Recipient = <Recipient>, Quantity = <Quantity>})

Manage Token

For now, PADO AO uses AOCRED to incentive data providers and PADO Nodes. The quantity of AOCRED tokens received from data user is decided by data price when uploading data. Every PADO Node participanting in the task will get a constant quantity of AOCRED tokens(0.001 AOCRED for now) from data users. Data user should transfer AOCRED tokens to the Task Management Process before submiting tasks. In Task Management Process, It maintains FreeAllowances and LockedAllowances to track the tokens of data users. It mainly consist of the following steps.

  • Preparation: Data users transfer AOCRED tokens to this process, which are kept in FreeAllowances.
  • Submit Tasks: If a task is submitted successfully, AOCRED tokens will be moved from FreeAllowances to LockedAllowances.
  • Report Results: If PADO Nodes finish computing tasks submitted, they will report result. AOCRED tokens will be transfered from this process to PADO Nodes and data providers. LockedAllowances will be decreased.
  • Withdraw: If some tokens is left in FreeAllowances, data users can withdraw.

About


Languages

Language:Lua 59.1%Language:TypeScript 40.9%