Similar to Ancient Greek Oracles known to connect divine advice to mortals, blockchain oracles are a class of technologies that “know all things” from the real world and bring that information to the blockchain.
Mina ecosystem partner, O(1) Labs is working on developing a new type of blockchain oracle called zkOracles. In this blog and video, Brett Carter, a Product Manager from their team answers what oracles and zkOracles are at a high level. (Note: Interview has been edited for clarity).
What are Oracles?
“In today’s reality, we’re in a transition between what we call Web2 and Web3. What that means is that a lot of our personal lives and data still exist on the Web2 layer. And so there’s a question, how do we get that data onto the on-chain?
In order for blockchains to interact with the real world, they need an interface or a way to reach into the real world and grab data to bring it on-chain.”
How do you know that the oracle is giving you the right information?
“There are alternative schemes that, for example, will take data from many oracles and sort of average it across those oracles to ensure that the accuracy of that data is preserved.
In order to get this data on-chain, you essentially have to push it on-chain. There are high gas costs and transaction fees in order to do that. You have to pay to store the data on Ethereum, which is quite expensive.
The most common use case for oracles today is price feeds on Ethereum — where you want to provide the price of Bitcoin to a particular smart contract.
Today it’s really expensive to operate a price feed on Ethereum. You have to continually be pushing the price to a smart contract and paying for storage on Ethereum even if you don’t plan to query it.”
How are zkOracles different?
“What’s nice about using zkOracles on Mina, thanks to zkApps, is uniquely the two-step execution model. At first, we prove off-chain that we have some piece of information, and that we’ve performed some computation. Then we pack it up into a small proof at which point it is verified on-chain.
The first off-chain proving step is really unique because you can run a computation locally on your machine.
In the price feed use case example you can ask numerous APIs that you trust and average the prices across each other. With zkOracles, you’d be able to perform really sophisticated and exciting operations off-chain and query the price as many times as you want without paying any cost. Only at which point you’ve received the price that you needed would you execute the on-chain portion — which is just a much more efficient architecture.”
Can this work between home buyers and a bank to get a loan, for example?
“The way that this is done today is like a screenshot, if you can believe it or not. And it’s a really insecure process. But because this data exists on Web2, you can imagine maybe you’d like to use a zero knowledge (ZK) proof of your bank balance to get a loan on-chain.
How would we do that? It would be really nice if you could just call your bank and say, “Hey, would you be willing to sign a message with some private keys and I can put this message on-chain to get this loan?” But in reality, your bank would never do that. I call this the cooperation problem.
What do we do if our bank is not cooperative? How can we get that information and preserve the chain of trust such that we can bring that proof of a balance on-chain?
This is where zkOracles come in. They help solve this problem by adding an additional party to a web request to your bank — we call them a notary. In this case, the notary would be able to privately, without viewing any of your information, observe these web requests in your browser, for example, and sign them on behalf of your bank, just as a notary would in person. With really strong guarantees, this preserves the trust of that web request between you and your bank and that chain, such that you could use it, for example, to get a loan in DeFi.”
Are there any challenges in zkOracles’ development?
“Yeah – zkOracles are generally quite complex. One of the challenges is what I would describe as the MPC, or as we call it, the three-party handshake.
The way that it works is you need three parties — the client (you), the end user, and the data provider (perhaps your bank or the price feed). The notary needs to perform a little dance where all parties essentially talk to each other quite quickly in order to set up your request to the data provider. And it needs to preserve the privacy of your information all the way through this really elaborate process.
A solution like this has not yet been built so it would really be great to have the Mina ecosystem help us test this protocol and ensure its secureness. I’m also really excited for the Mina community to be able to build some really interesting tools that we haven’t even dreamt up yet with this.”
Stay Updated On The Latest News About zkOracles
Many developers will be able to use zkOracles to easily pull real-world information from websites on-chain, and use that data in Mina’s zero knowledge smart contracts, or zkApps.
For a more advanced overview of how oracles work and how to build a simple oracle using SnarkyJS, check out this tutorial.
If you’d like to stay up-to-date on the progress of zkOracles on Mina and new community-built zkApps, make sure you are signed up for our monthly newsletter.