An Introduction to Privacy on Ethereum with Arnaud Schenk

ETHWaterloo 2019 · November 2019 · 25:11

Arnaud Schenk, tech lead at Aztec Protocol, asks why privacy matters on Ethereum and why it has been so hard for users and developers. They introduce Aztec's zero-knowledge asset model, a one-line JavaScript SDK, low-gas private transfers and proofs such as collateralization, then demonstrate a private ERC-20 flow end to end. The talk also answers questions on zero-knowledge proofs, UTXO notes and what remains visible on chain.

Speakers

Topics

From ETHWaterloo 2019, hosted by ETHGlobal.

Transcript

Um, cool. My name is Arno. I'm tech lead at Aztec. Aztec is a privacy protocol on Ethereum. Um, we're really focusing on making hopefully privacy as easy as possible to integrate and to add to daps and exchanges and all these kinds of things. Um, before we get started, we have a Discord on which you can ask any questions. We also have a channel um, on the EthWaterloo Discord. So, feel free to join either our own Discord or just post on EthWaterloo or on on either.

And we are going to be giving out prizes. Uh, so we're going to give a thousand USD for the best overall use of Aztec. Um, and we're going to give another 500 USD for the most surprising use of Aztec. There's a full disclaimer that we may at any point choose to divvy up these prizes differently depending on the uh, the number of submissions. Um, and we may choose to give out more money than we already or that than we planned. Uh, so yeah. Um, yeah, like I said, I'm Arno. This is Leyla and that is Charlie. Uh, we're going to be around all weekend if you have questions about Aztec specifically or about privacy in in general. Uh, we're

Please do come in. We just we just started. Um, yeah, please do please do come and talk to us. We're very happy very happy to chat about everything privacy. The most the most important question, I guess, that we we started with initially when when we're starting Aztec is, you know, why why is privacy important? Because I think as a space, it's not really a question that most people worry about too much. And I like to think about it as hypotheticals. So, does the cashier at your local supermarket know how much money you make every month?

Does your boss know how much money you're putting away every month and might they use that to reduce your salary? Because if you're paid in crypto, uh they certainly do. Um and I think that's what most people underestimates uh with mass adoption of crypto is it's not only state surveillance that warrants privacy. Uh it's it's just surveillance of any kind. It's uh your colleagues being able to say uh I'm paid less than my colleague for the same work. It's uh your your cashier being able to say uh that your you know, you're not paid a lot in your current role or whatever it is. It's really it's really just surveillance uh of any kind that I think is is a is going to be a big hamper to mass

adoption. The problem though is privacy is pretty hard uh for users and for developers. Um for users, privacy usually means weird UX flows, usually means keeping track of secrets like if you get ever used Tornado Cash or any kind of mixer, um you have to kind of keep track of this long string of characters that you can't lose otherwise you lose your money. Um it means for it means waiting for zero knowledge proofs to be constructed and sometimes it means waiting like half an hour to an hour for these zero knowledge proofs to be constructed.

For developers, it means uh something pretty hard to build and pretty error prone and if you mess up basically your users can lose all their funds. Um it's uh has pretty high overheads uh if anyone has heard of trusted setups uh or even just the the complexity of auditing zero knowledge uh code. Uh it's not it's not the nicest thing to go through. Oop, feel free to come in. Oop, or not. His loss. Um we think that privacy should be pretty easy uh and we think that a lot of these costs, so uh trusted setups and complex audits should be something that uh the privacy protocols take on.

For developers, what we're uh building and what we're producing is an audited protocol. No application specific trust is set up, and I can go into what that means a bit more at the end of it. Uh and pretty high-level APIs to make common flow pretty easy. Um so we're building a toolbox of plug-and-play zero-knowledge proofs. Uh you can build it straight into dapps. You can build dapps around these zero-knowledge proofs. Um these zero-knowledge proofs are made to be uh usable in dapps in an interoperable way. So, something again people don't really um or haven't really thought about is if you build something with traditional ZK snarks uh

just by their very nature, two circuits that are ever so slightly different uh are very hard to make compatible with each other. So, if you build an ERC-20 um replication in zero-knowledge and an ERC-721 replication in zero-knowledge, those two things are pretty difficult to make work together. Um we think interoperability is is a pretty fundamental thing in the space. Uh and gas-efficient. So, after Istanbul, uh to make a private transaction, it's about 200k gas, uh and we hope to make that cheaper over time. So, we've been working uh pretty hard on making using Aztec as easy as possible for developers. Um and I'm just going to take you through uh yeah, just a quick

uh show-and-tell of what we've been building and how you can use it this weekend. Um something that we've been working on over the past couple weeks is our SDK, um which you can add to your dapp uh with just one line of JavaScript. Uh it's literally that. That gives you everything you need for client-side uh use of zero-knowledge. And with that, you can uh basically make any ERC-20 into a zero-knowledge asset. Uh you can send that asset around. You can make that back into public again.

Um, and you can use slightly more complex proofs, uh, for example, uh, creating uh, proofs that some zero knowledge notes are larger or smaller than either public amounts or private amounts. You can mint burn, uh, on ZK assets like you can on ERC-20s, and you can prove, uh, that an asset notes or zero knowledge notes is a percentage of some other notes. Um, the kinds of flows that you can build with this is, for example, uh, with the last one, uh, proofs of collateralization, uh, all in zero knowledge.

Um, you can build a a dapp, uh, which is just a payment dapp, uh, but so you can say, for example, I'm going to pay you for, uh, taking me from Toronto to Waterloo, but before I accept, uh, your proposal of this this ride, you're going to have to prove to me that you have enough funds to pay me when the ride is over. But, of course, you don't want the person which is going to be who's going to be driving you just have access to all your financial data. So, you can very easily prove that you have $100, uh, without having to prove, uh, to just show the world how much money total you have.

On chain, uh, again, we've worked pretty hard to make this as easy as possible. Um, you don't have to use a domain-specific language like Zk-Snarks or anything like that, uh, to use Aztec. Uh, it's literally a a smart contract call. Um, you pass in the proof data that our client-side code gives you. Uh, that gives you back an instruction object, uh, which is pretty easy to deal with in your smart contracts directly. Uh, so if you have a proof, uh, which says, for example, I'm going to transfer you a a couple of, uh, zero knowledge assets, the instruction set that you're going to get back is create these, uh, notes, destroy these notes, uh, give them to these addresses, uh, on which you can add your own custom logic,

for example, white listing. For users, there's no particular secrets to keep track of. That's all abstracted by the SDK. Proof construction is in the order of 10 milliseconds, which is basically instant. And again, the low gas costs after after Istanbul mean that for the first time these kinds of private transaction on Ethereum are in the realm of doable for for users. Hello.

Um Um yeah, so it's it's pretty easy to get started. The SDK that I spoke about comes with docs that take you through a starter kits which show you basically everything you need to actually get started with zero knowledge transactions on Ethereum. Um That QR code takes you to it. That tiny CC URL as well. And we also have a full spec for our protocol that that you can go through to create your own smart contracts, to create your own client-side codes, to to create zero knowledge apps. The kinds of things that we've seen built in the past to give you an idea is everything from ZK Dow where

every vote is in zero knowledge which helps with both both corruption protection and and just just collusion. Um Two things like proving in all zero knowledge attestations of identity. So, the idea being you can prove that you went to a particular university, you can prove you have a certain age, you have a certain net worth to institutions on chain. Those people can give you services only if you can prove such facts, but they don't get access to any of the underlying data.

And as a as a last bit um this is an alpha demo. Um so I'm going to just going to show you basically what a user interaction with the SDK is from account creation all the way through to sending uh money. It's going to be on Ringby, so no promises on speed um just because of the the Ringby network uh and then I'll open it up to questions. Actually, while I get set up, is there any questions about privacy uh on Ethereum uh or privacy in general? Go ahead.

I don't know a lot about it, but what is a zero knowledge asset? Cool. Okay. Um zero knowledge in general is the idea of uh being able to prove a statement without revealing any of the inputs to that statement. So, you can say for example uh I'm going to transfer you I'm going to create a a transaction uh which is in our world a UTXO transaction, so very similar to Bitcoin where you have input notes and output notes. And the thing that you want that transaction to enact is your input notes are equal to your output notes, so you can you can't double spend and all that kind of stuff. So, your inputs to the transactions are equal to your outputs.

And to do that, you need to be able to prove uh that every the value of every notes summed uh on the input side and the output side are equal to the same thing. And uh on Bitcoin for example, that's really easy because everything is just an integer, right? So, you can just say uh 10 + 4 uh is equal to uh 8 + 6, right? It's the same thing. In uh when you're trying to do things in zero knowledge, you want to be able to say this encrypted number plus this encrypted number is equal to that encrypted number plus this uh plus that other encrypted number. And zero knowledge proofs are basically that.

They're basically the idea of being able to create statements uh or create well, proofs um that you know some kind of private information and that that private information abides by either a certain program or abides by a certain equation on all without revealing the actual inputs to those things. Does that answer your question? Um, so yeah, you you can basically get uh for example, privacy without compromising on consensus. So, you can have every transaction on Bitcoin or every transaction on uh Ethereum all the inputs be completely private, but still have the the strong guarantees of the blockchain.

Yeah. Correct. Correct. Yeah, exactly. So, UTXOs have quite a few benefits when it comes to privacy. Um, and when you transfer so, you can you can basically make an ERC-20 into an Aztec uh zero-knowledge asset. Um, and in that world, yeah, the main difference is basically your balance instead of being a balance is a bunch of UTXOs. Uh where is All right.

So, part of that very thing is effectively your uh your balance is not given that it's not uh an account uh an account-based model and given that it's a UTXO-based model, you actually have quite a few different objects that you need to keep track of when you're dealing with Aztec. Uh and our SDK, the purpose of the SDK is to abstract that all away from both the developer and the user. So, uh Sorry, I may need to uh

Sorry, I was giving demos and that ended up messing with the demo script. Um And so, the SDK uh I'll show you through the the methods, but basically allows you to do deposits, to do sends, and all that kind of stuff without the developer, without the user worrying about UTXO. Um because we think that fundamentally we need, like I said at the beginning, we need to make privacy as easy as possible. Um and that also means that we need to get rid of things that are technically very advantageous, um but that fundamentally uh diminish the usability of um of privacy.

All right, so hopefully Sorry, this is loading a JavaScript um uh bundle on the conference Wi-Fi, so I'm not sure if the demo gods are going to be with me. Laila, do you have one running on Ganache otherwise? Maybe while we're waiting I can ask you a question.

Mhm. It's a good question that I feel like I should already know the answer to. Um how would like hierarchical wallets work zero knowledge assets? Is that possible to do that? What do you mean? So like you don't have to you don't want to have to keep track of a huge database of private keys, one for every single one of your UTXOs. You want to be able to derive all of these things Mhm. Yeah, so the spending key of these UTXO objects is always your Ethereum private key. So, you don't have a different account for Aztec um transactions. What you do have though is for every note, uh you have what's called a viewing key.

That viewing key allows you to see the value of the note and it's an input to proof construction and these kinds of things and that is generated through some kind of not some kind is it's through defeat Diffie-Hellman key exchange. So you can always basically generate it if you know the recipient of the note and the sender of the note. Um Okay, so this is different from Zcash then. They have their uh their viewing keys and spending keys. So those aren't Diffie-Hellman Yeah, so basically this the way to think about in in this first version of Aztec Uh can you plug this in here? It's a USB thing. Um yeah, the effectively underneath it all this secret this shared secret this viewing

key that is just that just needs to be quite a large random number that adds randomness to something called Boneh-Boyen signatures. So we we don't use AK-SNARKs which is where before universal ZK-SNARKs came along we can have basically a zero-knowledge system with only one trusted setup where everything is compatible with each other. You can easily trade assets with each other etc. Um but to do that we needed yeah, we we built these signature objects called Boneh-Boyen signatures and to effectively make the use of these Boneh-Boyen signatures without revealing which one in a list it is

you need to add randomness to each one and that's where the viewing key comes in. Uh you probably need to install Uh something's going to pop up and you're going to have to install it. So what is is Aztec.js like something that works behind the SDK or Yeah, correct. So the SDK basically there's a there's a bunch of proofs. So we have seven proofs in total that allow you to do custom flows. There's quite a few of them which we think most users are probably not going to interact with. The SDK gives you

kind of for most use cases a really really easy API where you don't have to deal with UTXOs. You didn't don't have to deal with notes or anything like that. And then gives you access to more advanced proofs if you so if you need them. But fundamentally the SDK is about abstracting away the UTXO model more than anything else. And then you can you can kind of break out of that model if you want to do custom proofs. Yeah so if I go back actually I'm not I'm not showing the presentation anymore but for example in in the SDK deposit send withdraw we were able because the the parameters

are are pretty standard in those proofs. We were able to I think we're about to get help. We were able to basically abstract away a lot of the of the options that you typically go that typically go into proof construction. Um You need to click allow I think. Sorry for having to switch laptops halfway through. Um So you basically have simplified parameters in like deposit send withdraw.

If you want to do something like range proof there you break out of the SDK tiny bit. You go into some advanced proofs and the SDK will still help you get access to the notes for example that you need to use within this range proof Um, but the parameters are a slightly more advanced. Cool.

Um, so this is part of the demos demo scripts uh, that we uh, that are included in the docs. Uh, so it's a basically a two-line run uh, that you can have to get access to SDK as it stands. Um, and uh, like I said, it is it is uh, alpha software, so uh, don't deploy this in production if you even have the inkling to. Um, but if we give the Wi-Fi a bit of uh, a bit of patience, so what uh, Lila is doing right now is um, some some setup, so it's just the

the starter kit it will deploy an ERC-20, uh, which you can mint on. Uh, that's just a standard ERC-20. It'll then deploy as ZK assets, uh, which is uh, zero-knowledge version of the ERC-20. It has confidential approve, confidential transfer, confidential transfer from. Um, and once that is set up, uh, you'll basically see uh, different proofs being so deposit uh, withdraw and sends uh, being available. So, right now there's a balance of 200 in the ERC-20 in the public token. Um, the first thing we're going to do is just make some of that balance into private assets.

Uh, so if we let's say put 50 in there, uh, that will um, create five notes basically that sum to 50 total. Uh, and you'll see the Right, so from a user's perspective, a deposit into the zero knowledge world is just this small pop-up SDK. This doesn't have custody of your public assets. This is just again abstracting away these notes. So, MetaMask is still your custody provider. You still have all your assets in there. You still have your private key in there. You never have to export it.

And as So, in in that flow, I should have highlighted it, but it was it was fast enough that to to miss it is you create a zero knowledge proof. You send that proof to Ganache, and that gets validated by what what we call Ace. And then those that instruction set that I talked about gets sent back to the ZK asset, and the ZK asset decides what to do. So, now that address 0x E207 has in private a balance of 50. If you go on the network this occurs on, you will know that 50 has been deposited um because it's the first transaction. That 50 can now be sent to any Ethereum address, but you won't know what each note is

worth, basically. That person can then withdraw whatever notes they get um and back into public if they if they so desire. But again, the the transactions themselves will be you won't know the amounts being sent unless there's a conversion back into public. So, sender receiver addresses are still publicly visible. It's not anonymous. Correct. Yeah. So, the first version of Aztec is just amounts. Something that we released a month or so ago is something called Plonk. So, one of the big kind of design uh constraints that we had when we started is one proof construction needed to be fast enough for a user to basically not notice it. And second, there had to be

this interoperability. So, everything from Groth16 basically just was out out of the window. Um and it's what led us to not use SNARKs in the first place. But with universal SNARKs now, basically the next version of the proofs that we deploy, it'll be the same protocol, just new proofs. Um we'll add anonymity. So, in that world, you basically have uh full privacy. Right now, it's it's really just the amounts being being hidden. So, yeah. Hopefully, uh the docs will speak to to you about like how how to do this uh better than I could, but effectively this uh what what just happened is you adding

privacy to your dApp. Um so, if you want to build a a dApp with a private flow, it's literally one line of JavaScript um and a couple of deployed contracts on Ganache, uh which are just handled by the starter kit. Um and you can you can effectively just have privacy uh available to you. Cool. Um I said at the beginning that my talk was short and sweet. Um and I meant it. Um it was a short and sweet talk. Um this is the kind of stuff, because it's ever so slightly different to uh the things that you've dealt with if you've built on Ethereum before, like so it's not an account-based model, it's in zero knowledge and all that kind of

stuff. The best way to get familiar with it is just to play around with it. Um I think we uh have hopefully made it as easy as possible uh for you to just tinker with it as possible. But uh if you get any questions, if you're not sure how to proceed, uh we're going to be hanging around uh the whole weekend. Um we're going to try to wear the same hoodies uh along the weekends, but they might get dirty. Uh so, try and memorize our faces somewhat. Um uh otherwise, just hit us up on Discord. Cool.

Any last questions before I leave the the next person on? I'll take it as a compliment to my clarity then. Have a good morning, guys.