zkSummit6: Introduction to Starling Studio Zinc developer tools - Ronald Mannak - Starling Protocol

10 Dec 2020 · 9:26

Ronald Mannak demonstrates Starling Studio, an integrated development environment (IDE) that ships with the Zinc compiler and virtual machine built in, so a developer can start writing zero-knowledge programs on a clean machine. He builds a puzzle contest app in which a contestant proves a magic square solution that stays private as a witness, then adds an ID to the public output so that nobody can copy a valid proof. A companion wallet runs the finished application, and he argues that moving general computation from miners to wallets could make blockchains more scalable and more private. In the Q&A he notes that on-chain verification is still missing and that the demo relies on a trusted setup.

Speakers

Topics

Transcript

The story starts earlier this year when my computer died. Um I got to borrow a very old low-spec 2015 MacBook Air from one of our investors. And that turned out to be a blessing in disguise because what happened around the time was that Matter Labs released Zinc. And I started experimenting with Zinc on this old MacBook Air and I was blown away by the performance. Even on this old computer, it was lightning fast. So, here's a scenario.

Um we are organizing a online puzzle contest. The first person to solve our puzzle will win the first prize. The second person to solve our puzzle will win the second prize, et cetera. So, it's important that the contestants are able to prove that they have solved the puzzle without disclosing the solution of the uh the puzzle. Now, let's take a very easy easy easy puzzle that nobody will ever use for an online contest and it's called a uh magic square. The way it works is that the sum of all rows is 15, the sum of all columns is is 15, and the sum of both diagonals is 15. So, let's build an app for this scenario. An app that can

verify the user's solution and publishes the proof of a correct on a blockchain. This is a clean computer and I can show that by typing in Zargo, which is the cargo equivalent of Zinc, which is not there. The only thing I need to do to install the tools, which is Starting Studio, the IDE, and Vivo Pay, which is the wallet, is simply drag them to applications. That's all there is to it. So, let's open Studio. Um it comes internally with an internal version of um Zinc, both the compiler and everything you need, including VM. Uh you can also use an external version. Uh there's none

here, of course, on this computer. Um so we're going to use the internal version. Um what comes with starting Studio is a number of example projects. So for example, a proof of hash pre-image. Uh let's call this uh CK summit's demo. And create the the project. So this is an example you can can can uh simply run.

Um and you'll see all the um results here in on the bottom of the screen. So what is happening is is is that what we try to achieve is to make it as as easy to understand as possible for new users. Um the interface you see is not the final version yet. Uh but you can like like kind of see um we're trying to explain what a witness is, what the public output is, and the way it works, by the way, in Zinc is that there's one main function, um just like like C, for example. Um the input the inputs here are the witness, so that's the data that you're not going to share, that you keep secret. You're not going to share that with the

verifier as a prover. Um the output is public output, which is the input used by the verifier. So the output as a prover is the input you need for the verifier. So we've created a new project. An empty project, and that will be our puzzle app. Um the idea is is that the user will uh pass their solution, which is an array of nine integers, as a witness into the in the the application and the application will check whether that's uh nine um digit is is is a is the solution um or not a valid solution.

Um the way we're doing it is using a search. Um there are many ways of doing it. In our case um how it will work is that the app will only produce a proof if the values are the values we're expecting. Um So uh what you notice is is that uh Studio automatically parses the code. So on the right bar automatically you can see the nine um elements and the nine items of the the witness uh automatically generated by uh by Studio.

So here we're adding the asserts. I'm going to skip a little bit here um because uh it's pretty clear I guess how that will will work. There we are. Um we can interact now with uh um the code. Uh but there's one issue and the issue is that if I generate a valid proof, everybody can copy the proof from from that moment on. So what we need is a kind of way to link the output to me and me only. And the way we do that is to add a ID to the witness um that also will be the public output and that is the public input to the uh

the verifier. That way uh nobody can copy the uh um the solution. Um we can check that. So what we can do is uh change the uh um input the verifier and see if it still uh verifies, which it will will not. Now, how will the user interact with this? Um simply through the wallet. Uh you can uh start the wallets and pass the uh, zero-knowledge application to uh, the wallets and uh, about this how the uh, wallet looks like. Uh, it's a originally mobile wallet and not all uh, user interface elements um,

came through correctly um, but as you can see uh, the wallet has applications built in. Um, I've cheated a little bit here because I already uh, created the uh, interface uh, beforehand. So, what we've seen is not ready for production yet. But it does show it's possible and one the most important takeaway for me is is that it is possible to offload general computation from the miners to the edge nodes, meaning wallets. And if we do that we can have a blockchain architecture that's not only scalable but also much more private than current blockchains.

If you have any questions, this is my email. Feel free to contact me. I'm happy to chat more. Thank you. Cool. So, um, let's take So, I don't know if there are any questions right now in the chat, but I know that I have a question. Um, in the case of this uh, work in Starling Studio, is there are there any parts that you feel like are still kind of like untouched, things that you that are missing somehow in the build?

Yeah, I mean there are parts missing still. Uh, the biggest part is missing is the uh, verification on chain. Um, so uh, the way we envision it like like in in the first place is something similar to to Zopertees in that you have a smart contract um, produced um, as a verifier by the um, mini compilation step by the developer. Um, that's not happening right now. Um, that's not finished yet. Um, and the the other thing is is is uh, Zinc itself um, is still in development as as we've seen in the previous presentation by Alex. And there's a lot of like things that that that that are in development there as well. Yeah.

Cool. So, how far along is the project? We have the demo working as as as as you saw. There's still a lot to do to make it like ready for for production. And that's both on our side and in the part of of of Zinc for example. Because right now there's like a trusted setup in the in the demo. That of course cannot be cannot happen in like like like the real life project. What is the connection between Matter and the work you're doing and sort of Starling protocol?

So, there's there's there's none none official at least. I mean I met Alex like like earlier this year at the I think it was the the Stanford conference. Yeah, I was there too. And yeah yeah yeah yeah. The last time we were all together at the conference. Yeah. Wild. Completely different world back then. So, no I mean I I like the this was the first time I saw a language that that that had almost everything built in to to do like a smart contract was easy to use was performant. And what have you.

Afterwards Aleo came came came on the scene. But yeah, I mean Zinc has everything that that that we kind of needed for for for this project. So, that's why we use it. But there's no official link between Starling and and Matter Labs. Cool. Well, thank you so much for the presentation Ronald. Thank you. Thank you for having me.