Private EVM Smart Contracts Using Homomorphic Encryption

EDCON 2023 · 20 May 2023 · 6:38

Rand Hindi, CEO of Zama, explains how fully homomorphic encryption allows computation on encrypted data without first decrypting it. He discusses private smart-contract applications such as blind auctions and confidential voting, and considers how encryption and zero-knowledge proofs could combine privacy with scalability.

Speakers

Topics

From EDCON 2023, hosted by EDCON.

Transcript

so my name is Rand and I'm going to be talking about private smart contracts using homomorphic encryption so on that blockchain today everything is public we need things to be public because we need to agree on what state is being computed so this creates a bunch of issues around theft surveillance Mev which fortunately we can solve with a new technology called homomorphic encryption so the idea of homomorphic encryption is that you can compute on data without actually having to decrypt it so this is great because it means that you can have encrypted transaction data encrypted State updates encrypted onshine data which opens up a bunch of really cool use cases such as trusted Bridges where you can do homomorphic

signatures on chain blind auctions where the nfts and the amounts being bid is not known confidential voting where the tokens used for voting in the Dao are basically not revealed basically FH G is for privacy what ZK has been for scalability and when you combine the two you can actually have some scalable private blockchain protocol the important thing about fhc to keep in mind also is that it guarantees data availability because the data is actually kept on chain at all times contrary to ZK you don't have to do the computation off chain you can actually do everything on chain so how does fhc work basically what you do is that you encrypt some data and you have to add some random noise to the

data because you're adding this random noise you basically also have a growth in the noise itself when you're Computing on the encrypted data for example if you're adding encrypted values the message itself is growing but the noise as well which means that after some point you're basically getting nose overflowing on the data which gives you an incorrect decryption so this is a problem in a smart contract because if you don't actually have a cap the ability to do infinite number of operations then eventually for example in a balance transfer you would have an incorrect result of the fhe computation so the way we solve that is through something called bootstrapping which is a special mathematical operation where you can basically clean up the noise so

that you can keep on Computing forever and bootstrapping is the reason why fhc is slow today the other problem with fhc is that if you can only do encrypted additions and multiplications how do you compute the comparisons in the non-linearities that are needed in a contract if you have to use a polynomial approximation to compare values you're not going to end up with a correct result every time so for this you need to use a new technology called tfhe which enables you to do encrypted arithmetics but also encrypted table lookups and table lookups are super important because they basically give you the capability to compute any function without any approximation the only thing that we're still missing today is a speed so even though we've

made fhc 20 times faster in the last couple of years we really need Asic acceleration to make this go a thousand times faster so it works great today you can do a few transactions per second but if you want a thousand TPS you're going to need Hardware acceleration which is coming in 2025. so fhc is basically a done deal in a couple of years so how do we use that for private smart contracts well what we want is a simple user experience a simple developer experience and a simple integration for blockchains what we created is a set of pre-compiles that augment the evm windows extra fhe data types that you can basically use for example here in your C20 contract without changing the

way you write your contracts so just replace your integers by encrypted integers and then you're basically done the unique thing here is that you also have now encrypted values on chains so you have to also decide who's allowed to decrypt which value so you need to add some extra level of access control logic which is being solved by effectively decrypting the value for the user based on some condition in the smart contract there are a few technical challenges first because we want composability it means that all the data on chain is encrypted under the same key if it's encrypted under the same key who has the private key for decryption the second problem is performance how do we increase throughput while keeping block sizes small considering that homomorphic

encryption has a very big expansion Factor versus plain Text data so for securing the private key we basically use threshold cryptography where we split the private key of the network into a bunch of nodes which need to agree at least two-thirds to decrypt in order to get a correct decryption so this guarantees that nobody actually has the decryption key to avoid people copying data from the blockchain that's encrypted in writing a contract to decrypt it we also provide zero analysis we also have to provide a zero knowledge proof when you're sending a transaction that are encrypted so that we're sure the user knows what he's doing so finally the next thing is how do we go from five to a thousand TPS first we need Trend ciphering so we need to

basically go from a very compact encryption scheme like AES and turn that into fhe so this would allow you to have block sizes which don't expand in size even though the inputs are encrypted the second thing we want for scalability is fhe Roll-Ups so we could do optimistic Roll-Ups today I think we could work today I mean today like soon but really what you want eventually is zkfhe rollup so in this particular case you don't care about the zero knowledge part of the ZK Roll-Ups you care about the verifiability part so what you want is verifiable fhe because if you do that you can basically have infinite scalability while keeping all of the data encrypted and finally as I mentioned Hardware acceleration which is

coming very soon so this is not hypothetical you know this is something that we've announced a year ago that we were working on and even though today homomorphic encryption isn't the fastest technology it actually works and it works so well in fact that we are going to be releasing a test net at ECC this summer where you're going to be able to build homomorphic smart contracts using you know a normal evm environment and basically start testing it so Zama isn't going to be launching a chain there is no such thing but we want people to start understanding that this technology works and to start basically thinking about all kinds of different use cases for it so if you want to access it zamba.ai test net thank you

[Applause]