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

Opacity Verifiable Interference zkTLS Plugin #1673

Open
wants to merge 67 commits into
base: develop
Choose a base branch
from

Conversation

RonTuretzky
Copy link

@RonTuretzky RonTuretzky commented Jan 2, 2025

Co-authored @Hmac512 @RonTuretzky @Gajesh2007

Background

A few weeks ago, issues with aixbt were observed, where users mistakenly believed the moderation was performed by humans. This misconception caused a public relations disaster and raised concerns about the AI's autonomy. As a result, the team had to make logs public to maintain transparency and trust.

This problem can be mitigated using zkTLS. zkTLS enables the generation of zero-knowledge proofs and MPC for TLS sessions, also known as "web proofs." With zkTLS, any off-chain data can be proven either on-chain or off-chain, ensuring authenticity without compromising privacy.

Here is a high-level diagram of the process.

sequenceDiagram
    autonumber
    participant Eliza
    participant Cloudflare
    participant OpenAI
    Eliza ->> Cloudflare : Prompt Req
    Cloudflare ->> OpenAI : Prompt Req
    OpenAI ->> Cloudflare : Prompt Response
    Cloudflare ->> Cloudflare : Log Prompt Response
    Cloudflare ->> Eliza : Prompt Response
    create participant Opacity
    Eliza ->> Opacity : Generate Proof for Prompt Response
    Opacity ->> Cloudflare : Fetch Prompt Response Log in MPC-TLS
    Cloudflare ->> Opacity : Respond with Prompt Response Log
    Opacity ->> Eliza : Return Proof of Prompt Response Log
Loading

What does this PR do?

This PR integrates Opacity as an adapter into the framework without introducing breaking changes. Opacity is a zkTLS platform built on EigenLayer as an Actively Validated Service (AVS).

What kind of change is this?

Introducing a new adaptor to produce verifiable inference.

Why are we doing this? Any context or related work?

This update addresses the critical need for transparency and trust in AI interactions, as highlighted by the PR disaster involving aixbt. By integrating Opacity as a zkTLS adapter, we ensure that all inferences and interactions are verifiable without compromising privacy. This addition strengthens the framework's credibility by enabling zk/MPC proof generation and verification for TLS sessions.

The integration aligns with EigenLayer's/Opacity's mission to build secure and verifiable systems, leveraging Actively Validated Services (AVS) to enhance both functionality and trustworthiness. This is especially relevant as more AI systems require robust mechanisms to prove autonomy and authenticity in a seamless and privacy-preserving manner.

Cloudflare's AI Gateway provides logs for all prompt request responses , which are the target of the mpc-tls , ensuring that all AVS validators are performing MPC-TLS on the same date.

Documentation changes needed?

Documentation has been updated in the adapter-opacity README.md and .example.env
No further changes to the project documentation are required.

Proof Verification Example

Here is proof of a prompt request. This can be verified using the adapter or otherwise through https://opacity-ai-zktls-demo.vercel.app/api/verify

By writing the proof to proof.json, you can also verify using

curl --location 'https://opacity-ai-zktls-demo.vercel.app/api/verify' \
--header 'Content-Type: application/json' \
--data @proof.json

This invokes a shared mpc-tls session as listed in step 7.

Testing
Automated tests are sufficient; no manual testing is required for deployment.

Where should a reviewer start?

packages/adapter-opacity/README.md and then packages/adapter-opacity/src/index.ts

Detailed testing steps

Follow steps in packages/adapter-opacity/README.md
Start the client: pnpm start:client
Interact with the agent via chat and check the logs for proof generation and verification.

Additional Notes

No database changes or additional deployment instructions are necessary.

Discord username
turetzkyron#0000

@RonTuretzky RonTuretzky changed the base branch from main to develop January 2, 2025 03:02
@RonTuretzky
Copy link
Author

Some possible action items for future iterations:

  • Proof Generation Unit Tests
  • Verification Unit Tests
  • ECDSA > BLS Proof migration
  • Self-hosted CF Logging

@fabianhug
Copy link
Member

Great! Thanks for adding the changes - I will test in a bit

@fabianhug fabianhug self-assigned this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants