Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch query fee processing contract #48

Open
dzhelezov opened this issue Jun 26, 2023 · 1 comment
Open

Batch query fee processing contract #48

dzhelezov opened this issue Jun 26, 2023 · 1 comment

Comments

@dzhelezov
Copy link
Contributor

  • The router submits batched query execution logs on-chain, including the query signatures, query response metrics (scanned data, result set size)

  • The contract verifies the signatures, calculates the fees to be extracted and deducts from the client deposits

  • What are the limitations for the size of the processed queries?

  • Should we consider going after a dedicated rollup?

@dzhelezov
Copy link
Contributor Author

Merkle-tree based solution:

  • A receipt consists of the following structure:
    • input query hash
    • client address
    • client query nonce
    • client signature
    • worker address
    • scanned data size
    • query result data size
    • query result hash
    • worker signature
  • The router assembles query execution receipts and builds a merkle tree by sorting the client addresses lexicographically, and for each address sorting the receipts by the query nonce.
  • The root of the resulting merkle tree is submitted by the router, together with the withdrawal data for each client. The withdrawal amount is calculated based on the query processed and retrieved data.
  • The remaining task is to provide a proof that the router knows the data with the signatures, proving that the commitment is sound.
    • ZKP -- potentially the best scenario but requires more R&D
    • Commitment reveal -- after the commitment, the processor has to reveal a path to a pseudo-randomly selected leaf of the merkle tree. The contract will be able to verify the signatures and that the merkle tree path satisfies the root commitment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant