ZKON x Mina Foundation: Integrating zkOracle with o1js

Unlocking a private data economy for Mina zkApp developers to integrate off-chain data into their apps with zkOracles.
ZKON x Mina Foundation: Integrating zkOracle with o1js

At ZKON, we're excited to present our innovative project within the Mina ecosystem. This isn't just a significant accomplishment for us, but a showcase of the potential and value of our technology.

This development marks a transformative moment for zkApp developers in the Mina Protocol ecosystem, opening new possibilities for incorporating verifiable and secure off-chain data into their applications using ZKON zkOracles.

In this article, we explore the concept of a zkOracle, the implications of this collaboration for the Mina Ecosystem and ZKON, and the potential use cases it opens for all Mina zkApp developers.

Join ZKON on Discord!

What is a zkOracle?

In blockchain technology, an oracle is a key link enabling blockchains to interact with external systems. This is essential as it allows smart contracts to access and use data from the outside world, surpassing the inherent limitations of blockchains as isolated systems. In essence, oracles greatly improve the functionality of smart contracts, which are automated contracts encoded within software.

A zkOracle is a specialized oracle that uses zero-knowledge proofs (zk-proofs) to provide information to smart contracts, ensuring both privacy and security. These zkOracles form a vital connection between the traditional web (Web 2.0) and the decentralized internet (Web 3.0), facilitating seamless data interactions. They uniquely enable the validation of statements about Web 2.0 data within Web 3.0 applications, allowing controlled data sharing without revealing the entire data set.

To ensure the accuracy of the information provided by the oracle, different schemes are used. For example, data can be sourced from multiple oracles and averaged to preserve its accuracy. However, to place this data on-chain, it must be pushed, which incurs high gas costs and transaction fees, especially on platforms like Ethereum.

The most common use of oracles today is price feeds, where the price of Bitcoin, for example, is provided to a specific smart contract. However, operating a price feed on some blockchains like Ethereum can be expensive since the price must be continually pushed to a smart contract and storage on Ethereum must be paid for, even without any plans to query it.

What distinguishes zkOracles, particularly when used on Mina with zkApps, is their unique two-step execution model. First, zkOracles prove off-chain that they have a piece of information and that they've performed some computation. This is then packed into a small proof which is verified on-chain. This initial off-chain proving step is unique as it allows a computation to run locally on a machine. For instance, in the price feed use case, various trusted APIs can be queried and the prices across them averaged. With zkOracles, it's possible to perform complex operations off-chain and query the price as often as needed at no cost. Only when the required price is received is the on-chain portion executed, resulting in a more efficient architecture.

The ZKON zkOracles solution enhances the capabilities available to Mina zkApp developers, making the integration of zk-Oracalized data into their projects simpler. This development ensures that attestations related to Web 2.0 data, represented as credentials held by wallet users, can be easily incorporated into the Mina zkApps ecosystem. As a result, this integration creates a new and secure link between Web 2.0 and Web 3.0 environments.

Mina RFP requirements and needs

On January 22, the Mina Foundation shared an RFP (Request for Proposal) with the goal of integrating a zkOracle solution for o1js. The proposal needed to include the following core features and functionalities:

  • User Experience Focus: The proposal should ensure a smooth and user-friendly experience for oracalizing Web 2.0 data, including:
    • Prescriptive example code covering:
      • UI components (e.g., React, VueJS)
      • Incorporation of data into a proof
      • How a Mina zkApp can query the proven statement.
  • Security Model: A robust security model that addresses potential risks and trust assumptions should be outlined. This should include details about:
    • MPC vs Proxy vs other trust models
    • The ZK implementation (interactive? non-interactive?)
    • The considered attack vectors.
  • Flexible Attestation Storage (optional but preferred): If the zkOracle plans to attest Web 2.0 data in credential form, which can be held or accessed by a wallet, does it allow attestations to be stored in any wallet, accommodating a range of user preferences?
  • Common Use Cases: The proposal should enable proving social media accounts, GitHub commits, and Google account ownership.
  • Extension Use Cases: Respondents should detail how a Mina zkApp developer could oraclize data not covered "out-of-the-box", e.g., how to build an 'integration' with a new source.

ZKON Approach - A Detailed Proposal for Real-World Impact

Oracles, as previously mentioned, are vital intermediaries that connect blockchain systems to the broader external world. They function as on-chain Application Programming Interfaces (APIs), allowing smart contracts to access off-chain information - a feature absent in Turing-complete systems. This function is especially critical in the DeFi sector, where secure and accurate data sourcing is essential.

Current oracle solutions like Chainlink, Band Protocol, and API3 have made progress in integrating real-world data, such as weather forecasts and financial data, into blockchain networks. However, securely and efficiently linking private and legacy data from Web2 to the decentralized framework of Web3 remains a significant challenge.

Our Proposal: A trustless, decentralized network of zkOracles, combining MPC with Co-ZKPs

ZKON offers an innovative solution to these challenges. We propose a trustless, decentralized network of zkOracles that combines Multiparty Computation (MPC) with Collaborative Zero-Knowledge Proofs (Collaborative ZK). This unique approach allows multiple parties to jointly perform computations and verify data integrity without a central authority. By implementing Collaborative ZK, our network guarantees data accuracy and confidentiality, enabling smart contracts to securely confirm and utilize information from various sources.

This combination of MPC and Collaborative ZK is a significant advancement towards overcoming the current limitations of blockchain oracles. It offers improved security and efficiency in data management within blockchain and DeFi, leading in a new era of decentralized data processing and verification. This progress by ZKON not only enhances the functionality and reliability of data integration in DeFi, but also paves the way for innovative approaches to decentralized data handling and authentication.

Improving UX by Implementing Collaborative ZK Distributed Secret Sharing

Our user experience revolves around our zkApp, which serves as a verifier of the collaborative proofs provided by our independent attestators (nodes).

In other words, our solution is made for developers who are building zkApps for end-users. The sequence diagram below illustrates how a user can obtain verifiable data on a given zkApp on Mina that uses ZKON with the help of two nodes part of the ZKON Network. Firstly, the user requests API keys, and the MPC secrets are divided into shares (shards) that are distributed among the oracles, creating a distributed secret sharing scheme. This guarantees that no single ZKON oracle possesses the complete API Key. Following this, the zkApp sends these shares to the ZKON oracles and constructs a "Message Request".

ZKON User Experience
ZKON User Experience

Each oracle plays a role in processing the data, yet no single oracle has complete access to all the information. Together, they collaborate effectively to generate a proof that verifies the accuracy of the data processing. An oracle sends a request to a data source for the necessary information. Upon verifying the validity of this request, the data source then sends the requested data back to the oracle. The oracles process this data, and the user receives it with a proof of authenticity. This allows the user to verify the data's integrity before using it. This method guarantees a secure and verifiable data exchange, maintaining privacy and trust among all parties involved.

Security & Privacy: The Pivotal and Revolutionary Aspect of Our Proposal

This section will explore the unique solutions provided by Multiparty Computation (MPC) and Zero-Knowledge Proof (ZKP). Both these implementations considerably enhance data security and privacy.

Enhancing Secret Sharing Security Through Multi-Party Computation (MPC)

Multiparty Computation (MPC) offers a way to securely transmit secrets, such as API keys, to an oracle. This cooperative procedure safeguards the confidentiality of the keys. Below is an overview of how MPC is used to securely provide API keys to an oracle.

  • Splitting the API Key: In Multi-party Computation (MPC), the API key is divided into multiple parts, known as secret shares. These shares are given to various participants, including the dApp or smart contract owner and the Oracle nodes. Each party possesses a unique, private piece of the API key.
  • Communicating Payload and Shares: After calculating the share, API owners send these shares to the Oracle. They also send the payload that needs to be signed before making a request to the Exchange.
  • Collaborative Signing: Oracle nodes use their shares to generate local signatures with a distributed signing algorithm. They then send this signature to the API owner. The API owner combines the local signatures to create the final signature and uses the payload to make a request to the exchange.
How d-Auth works
ZKON Security Model

The API key remains secure throughout the process thanks to the use of Multi-Party Computation (MPC). Since no single entity possesses the entire key, it eliminates the risk of a single point of failure or unauthorized key access. MPC adds an extra layer of security when transmitting API keys to Oracles, reducing the risk of key exposure and unauthorized access. It facilitates secure and private communication, preserving the privacy and security of the API keys in a decentralized setting.

Additionally, we aim to ensure that the API keys are not reconstructed without the consent of the key owner. To achieve this, an access structure is established using MPC within Trusted Execution Environments (TEE). This structure prevents malicious Oracle nodes from conspiring to reconstruct the keys without the key owner's consent.

Privacy through ZK Implementation

Zero-knowledge proofs (ZKPs) and zk-SNARKs allow verification of a statement's truth without revealing extra details. Zk-SNARKs are efficient and applicable to any relation representable by a finite-sized arithmetic circuit. However, they have limitations: the proof generation process is computationally expensive and they don't support scenarios where secret data is shared among multiple parties. To address this, we propose collaborative zk-SNARK proofs through the o1js framework. This extends traditional zk-SNARKs into secure protocols among multiple provers, allowing them to collectively create a single proof over a distributed witness using algebraic techniques for multiparty computation (MPC).

ZKON Security Model
ZK Implementation

For more information about collaborative zk-Snarks, visit our latest article You can also find our Cryptography Paper.

Flexible Attestation

ZKON not only provides flexible attestation, but also an unparalleled independent attestation system. By using MPC, randomly selected zkOracles can witness different data points using SnarkyJS without ever possessing the full secret to access the underlying data.

Once the oracles reach sufficient consensus (with at least 3-n agreeing on the data output), the Smart Contract requester can utilize the output in any smart contract. This can either update any user wallet interacting with your dApp or update any other smart contract.

Find more details about our proposal by reading the documentation or by accessing Mina Foundation's RFP on GitHub.

Impact of ZKON zkOracle on Mina Ecosystem

The integration of ZKON as a zkOracle within the Mina ecosystem significantly enhances its capabilities and broadens the range of potential applications. ZKON's innovative Collaborative Zero-Knowledge approach allows for the secure importation of off-chain data, maintaining its authenticity and integrity without exposing underlying details. This groundbreaking method, which will be open-sourced for the Mina community, incorporates redundancy and a consensus mechanism to bolster security against single points of failure or malicious actors. This enhancement not only diversifies potential use cases in the Mina ecosystem but also strengthens its overall robustness.

In addition to technical advancements, ZKON's integration is set to invigorate the Mina community. ZKON is committed to fostering an inclusive environment that attracts and inspires developers to contribute to the platform. Furthermore, the introduction of ZKON zkOracle unlocks new, exciting potential use cases for the entire ecosystem:

  • SocialFi: Create innovative smart contract-based social applications (quests, reputation systems, loyalty programs, etc.) by verifying data from off-chain sources like social media, centralized exchanges (CEXes), traditional banks, fintech companies (e.g., PayPal, VISA), or work management tools (e.g., Asana, Notion).
  • KYC/ID: Generate a Zero-Knowledge Proof of your KYC verification completed at centralized institutions like banks or CEXes, proving your identity and adulthood.
  • Gaming: Seamlessly integrate your games with the blockchain, transferring data from local servers to smart contracts.
  • DAOs: Participate in DAO governance by voting with tokens held on centralized exchanges.
  • RWA & Insurance: Improve insurance policies by incorporating comprehensive off-chain data such as historical crop yields, weather reports, and soil quality assessments, which helps in evaluating potential risks.
  • Payments: Add a privacy layer to off-chain and on-chain payments. Initiate fiat payments based on balances in off-chain exchanges, simulating withdrawals and settling with the end-point-of-sale in fiat currency.
  • Off-Chain Lending: As DeFi evolves, integrating a wide array of Web 2.0 financial data as collateral could revolutionize lending.
  • Credential Verifications: Effortlessly verify credentials and represent them in Web 3, simplifying access to decentralized job platforms and academic networks.
  • And many more exciting possibilities!

For real-life examples of ZKON's transformative impact, visit our Customer Stories. If you have specific needs for your project or believe there’s an unexplored use case of interest, we’d love to hear from you. Reach out to us on Twitter or join our Discord server. We're eager to explore your unique situation in detail.

Lastly, the ability to attest Web 2.0 data in the form of credentials empowers end-users to bring aspects of their Web 2.0 identity and activities into the Mina zkApps domain. This approach not only ensures the authenticity and integrity of imported off-chain data but also introduces added layers of redundancy and consensus mechanisms. These additions strengthen the system’s defenses against single points of failure or malicious attacks, paving the way for a more scalable and secure ecosystem. Consequently, a wider range of off-chain data sources can be confidently utilized, vastly expanding the potential applications within the Mina ecosystem.

Final Thoughts

To conclude, we want to thank the Mina Foundation and its entire ecosystem for trusting ZKON to integrate our zkOracles solution.

As part of our commitment to add value to the Mina community, and in gratitude for this incredible opportunity, we are pleased to announce that we will be launching a Contributors Program with several objectives: help us build a vibrant community, collaborate on improving our solutions, and build on top of the ZKON infrastructure.

We invite the entire community to continue exploring this fascinating technology with us. We are available through our social networks and will provide support in our Discord community. We encourage you to join so you won't miss our latest updates, and we can answer all your questions 👇🏼

Join ZKON on Discord!

We are thrilled about the endless possibilities unlocked by this integration. It will surely solidify Mina's position as the leading blockchain for privacy and security with the best Zero-Knowledge ecosystem.

Thank you for reading the ZKON Network Blog. Stay tuned for future updates regarding our Contributors Program!

Website 🔹 X 🔹LinkedIn 🔹Discord 🔹Telegram 🔹Medium

Never miss a ZKON update.

Subscribe for spam-free updates and articles.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.