zkBob 🛠️ Integrating zkBob - a privacy-enhanced smart contract wallet - Kirill Fedoseev

ETHGlobal Paris 2023 · 31 Jul 2023 · 22:49

Kirill Fedoseev, a core developer of the zkBob protocol, presents zkBob, a privacy-enhanced smart contract wallet built on zkSNARKs for private deposits, transfers and withdrawals on Polygon and Optimism. He walks through use cases such as private salary payments, mobile proof generation and the Li.Fi integration, then explains the compliance approach of address screening and optional KYC. A live demo of direct deposits and the hackathon bounties follow, with audience questions.

Speakers

Topics

From ETHGlobal Paris 2023, hosted by ETHGlobal.

Transcript

Okay, let's start. Welcome to the Zcash Bob workshop. Uh yeah, I'm uh Kirill Fedoseev. One of the core developers at the Zcash Bob protocol, and let's talk about how you can use Zcash Bob and how you can integrate it into your privacy applications using our privacy-enhanced smart contract wallet, which is what Zcash Bob really is. So, at Zcash Bob protocol, we really believe in this fundamental concept of personal financial privacy. We believe that it's crucial to have a choice, to have this privacy, and for people, for users, to have this option to decide which transactions they want to keep private public, and which they would prefer to really keep hidden,

private from the outside observers. But, we also believe that given though the currently all the available blockchain infrastructures mainly support only public transactions, and all the information is publicly available on a blockchain explorers, and everybody is able to see like the balances, the addresses, the transaction amounts, the history, that's is really inconvenient for most of the people who are getting on boarded from the traditional finance world, where something as important as financial privacy is something that really exists. And yeah, we believe that this is one of the reasons that prevents the crypto world from getting widespread adoption, which

is the lack of privacy. So, at Zcash Bob, we are trying to address this lack of privacy by building our own privacy protocols, which allows to overcome this challenges. So, yeah, let's dive into it. The Zcash Bob application is built on top of Zcash SNARKs, and it really allows you to make these privacy-preserving transactions, which are fast and easy payments within the all supported tokens. Which you can perform by generating locally the CK proofs. And yeah, within the ZK Bob, you can make the private deposits. You can transfer tokens freely within the pool, which are completely private and hidden from outside outside world.

And then, you can also withdraw it back to to the public blockchain to your public wallet and continue using it in the DeFi from the already privacy enhanced the tokens. The way it works is that once you send a transaction on ZK Bob and to perform some deposit, transfer, or withdrawal, only you and as a sender and the receiver of those operation, which can be yourself or a friend of yours, only they are able to access, decrypt, and actually get something useful from this data and to understand what really happened within this transaction.

So, right now, the ZK Bob is available on Polygon and Optimism layer twos with more chains coming with the within the nearest future. And it supports Bob and USDC stablecoins, which are mainly used for salary payments, and ETH token on the Optimism for anything that requires privacy for Ethereum native currency, which might be the private contract deployments, which is which happens to be useful in some specific cases. So, yeah. And we plan to add more chains and more tokens within the upcoming future whenever we're finding the demand for for the ZK Bob privacy.

So, that's the sneak peek from our UI. It will have a live demo of how it works later in the workshop, but really, yeah, our UI is quite simple and by using it you can deposit, transfer, and withdraw freely by just as you would normally do within the MetaMask or any similar wallet, just for other web browser dApp without any need to download anything, all the ZK-Bob proofs, ZK-Snark proofs are generated locally, so that's really that simple and convenient UI to use for your everyday needs to achieve this a little bit of privacy.

Of course, the opportunities you can use the ZK-Bob for are nearly limitless, but we're trying to come up with a certain way of use cases for which people are already using ZK-Bob and what are we endorsing them to start using the ZK-Bob for. And these use cases typically involve anything related to the peer-to-peer transactions. For example, when you want to split the dinner bill with your friends after hanging around after the ETH Global Hackathon, you can use it for receiving and paying salaries and wages to your employees or from the employer side and employee.

It can be used for anything related with the grants, donation, fundraising, crowdfunding or really any other use cases you just want to make your payments in stablecoins, ETH, or any other tokens private. So, yeah, let's take the the most common example for now, the the way how the salaries can be transferred with ZK-Bob. So, let's say we have our employer, Carl, who really wants to pay his employees on the public blockchain because he doesn't trust any centralized exchanges and he wants to keep all his budget accounting and the salaries on the blockchain, but his employees really ask him to do this privately and that they would prefer to receive the salary also on the

blockchain, but in some private way. And so, Carl found out about ZK-Bob and now he wants to start using it for salary example. So, the way it works is that Carl just chooses the stablecoin he wants to use and can be Bob, it can be USDC directly. Then, he deposits this stablecoin inside the Zk-Bob pool, let's say once a month. And then on the salary day, he's able to distribute all the salaries within one multi-transfer transactions to his employee addresses he obtained from the from the invoices. And yeah, so he just need to send once a month a single multi-transfer within the Zk-Bob through our UI, and then employees are able to freely withdraw in any amounts um

their salary on their public wallets once they once they want to do that. Something one of the features at Zk-Bob we think is really important for further widespread blockchain and privacy adoption is the good support for mobile devices when you can send and receive transactions on the fly, when you don't have access to your desktop or laptop. So, we spent quite the time to actually optimize Zk-Bob application for mobile devices. We made sure that the Zk-Bob is usable on the mobile, that the proof generation works fast enough, and now it takes only 10 to 15 seconds to actually generate the completely private ZK proof in your browser on a mobile modern smartphone.

One of the also one of the cool feature we have at Zk-Bob is the integration with the Li.Finance, which allows you to actually perform any cross-chain interactions from the chain and to the chains which are not natively supported by the Zk-Bob application. So, you can really deposit and withdraw freely not only from Optimism and Polygon, but you can simply connect to any other asset or chain within the same UI just by opening up the Li.Finance widget, which is really cool, and we are really happy to see how it all works. And then the last point I wanted to discuss throughout this workshop is the our accent on compliance side of things.

So, as regulatory requirements, as we've seen in the past couple of months, they became stricter to towards any privacy enhanced application or protocol. We believe that something that should be taken into account and as our mission, we see this um goal of finding the right balance and the compromise between the level of privacy you get as a user of the Zcash protocol and the way of compliance the government or different authorities can expect from such kind of protocols, so everyone kind of get what they want without hurting each others uh kind of painful points.

And so, at Zcash protocol, we are trying to build this compliance-friendly tool, which still supports the privacy within these transactions, but then meets certain regulatory requirements. And uh yeah. So, the way it works is that we employ several techniques within the Zcash protocol to support this uh compliance side of things. So, the first one is the address screen. So, anytime you make a deposit or withdrawal to the Zcash protocol, we make sure that your address and your wallet passes the necessary AML requirements. So, this way we can make sure that Zcash protocol is safe from the different malicious parties and users

that can try to access and use the applications. And right now, we are using the Ethereum Labs provider for such AML screening for automated checks, but we're always looking forward towards any other integrations and new protocols, which does similar kind of things. Then, the way it works is that our checks are not only employed on the UI side of things, but they they are deeply integrated within the sequencers code, so that malicious party are not able to access the protocol by bypassing the UI somehow. But, they are start integrated with the sequencers and sequencer is the only party which is able to

directly access the ZkBob pool contract. Then the next important feature we had at ZkBob is the this notion of optional KYC. So basically KYC is not a requirement for the for the ZkBob user and you are able to freely use ZkBob application to the certain limits without any need in KYC. But then if you're a big business who wants to pay the salaries or you're a big user wants to transfer big amounts in order to raise those limits, there is this concept of optional KYC which is something that you can pass. You can meet some mean some soulbound NFT on a wallet and then the protocol will automatically use this NFT as your access key towards this enhanced and

increased limits. And right now we're using this integration with the Opium No KYC protocol and underneath that it uses the Binance BAB soulbound NFT token. And further down the line we are considering multiple approaches towards the further improvements on the compliance size of the ZkBob. We are looking forward how we can employ the and implement the selective de-anonymization of user transactions if they're willing to do so, how users can generate the cryptographically verifiable account statements with their transactions, how they can export and give someone read-only account access keys.

And yeah, how we can support multiple ways not only the Binance BAB tokens, but yeah, more on-chain KYCs. So yeah, let's have a few words about the hackathon bounty we have. So yeah, one of the bounty is related with this direct deposit feature. Basically it's a way how you can integrate the deposits towards ZkBob protocol into any third-party protocol, smart contract, open source wallet. And its purpose is to minimize the required effort and the entrance barrier, coding requirement needed for accessing the ZigBee deposits. The cool thing about direct deposits is that in order to make one, you don't actually need to generate

or communicate with our SDK to generate any start proof. You just need to submit a simple smart contract call, which is something that you can do from any smart contract integration, any third-party protocol, and you don't need any SDK for that. So, yeah, the way it works is that we have a like um dedicated to separate smart contract, which aggregates all those direct deposits, and then they which may come from all of those protocols on the left. It can be anything related to taxes, bridges, aggregators, wallets, anything related to the payroll. And then, after all of these direct deposits are aggregated on the special contract, the sequencer will, on its turn, generate the batch ZK start proof, and actually include those

deposits in the ZK pool contract, where the receiver of those deposits and users will be able to access them a few minutes later. So, as I said, the first bounty is related with the implementation and the integration of those ZigBee direct deposits. So, we have a basically, any best use of this particular feature will get the price. So, we have three places, three, two, and one K for each. And then, the second layer of bounty, if you are not feeling well about integrating the ZigBee deposits into your own application because you have a a bit different um project that doesn't involve any stablecoin transfers, let's say, then we have this open track price pool for

basically anyone, any team that is able to just go through the onboarding flow in the ZigBee application, generate the receiving address, open an account, then we'll ask you a couple of feedback questions during the judging session and it really takes 5 minutes to be a part of this price pool. So, what we're going to do is just we'll take this 4K and distribute across all teams which completed their onboarding flow and yeah, basically created a ZK Bob account. And yeah, just once again, a few ideas how you can integrate direct deposits into your hacks is to integrate with with any open source wallet, let's say MetaMask apps. It can be integrated with the different taxes, bridges, aggregators,

or any other smart contracts. And yeah, any awesome ideas, of course, are welcome here as well. So, yeah, let's have a small demo of the the ZK Bob UI to see how it all works and what we can really do with it. So, here we're going to log in into our dApp. We're going to select the Yeah, we recently deployed the Ethereum pool for ETH token on Optimism. So, let's use it for for the purpose of this demo, but really all the pools are very similar and you can use any of them in your hacks and in your workflows.

So, we're going to connect our ZK account by using our Web3 wallet. So, the UI is going to ask me to sign the message and then use my signature to generate the the private key for my account. I'm going to skip the password for now. Yeah, the my ZK account is now synchronized and in the right right upper corner, I can see that I have public balance of some ETH and wrapped Ethereum. And then I have also private balance, which is completely hidden and is part of the ZK Bob pool smart contract.

So, now that I'm connected with my ZK account, I can make the deposits of both ETH and wrapped ETH. I can transfer it to to different people within the pool who also created a CK account. So, yeah, I just make a transfer to myself. So, in order to make a transfer, I need to ask the receiver side receiver person to generate a receiving address. So, each time I click this button in the account tab, it generates and outputs me a random address and so, the number of total addresses is limitless. So, you can just generate a new one each time somebody asks you to send it. So, this way it helps you to preserve some some way some level of

privacy as well. So, yeah, I'm just let's transfer some ETH. So, yeah, what right now is happening is my web browser is using our SDK to generate a start proof. So, on the laptop, it should take about 5 to 6 seconds. On a mobile, it takes about 10 to 15. So, yeah, right now proof is generated. It's submitted to the sequencer and our sequencer has sent his transaction. And yeah, it's already included. And if you go to the history tab, then we'll see all the actions I have I have done few hours ago and yeah, 20 seconds ago I've completed this transfer.

And of course, all the history I see here is only I and myself is able to actually decrypt this history and access those details to see what amounts to what addresses have been sent and so, the rest of the information to the rest of the blockchain is hidden and it stays private. And so, yeah, I can access my history and see what have I done within my account. Um so, yeah, let's now see how we can make the direct deposit and how they can be integrated to your application. So, the simple way to test direct deposits is to for the block explorer UI. So, basically that's all we need. So, I'm going to go

to this awesome block scout user interface to to see how we can send a direct deposit from there. So, basically in order to send a direct deposit, I'm also will be required to get this receiving address, which is a different from different one from the one we used before. So, I'm going to copy that. I'm going to select the direct deposit function. I'm going to paste my CK address here. I'm going to Yeah, let's say I want to deposit 100 of ETH.

And yeah, as a fallback user, I'm going to specify myself as well. So, yeah, basically these three arguments is all you need to send a direct deposit on chain. And as you can imagine, this function call can be easily incorporated into any smart contract application, any protocol, and it's really that simple. So, yeah, I'm going to send the transaction. Yeah, let's see its sending details. Yeah, and we see that 0.01 ETH were transferred to the direct deposit smart contract. Now, it will take some seconds for it to be displayed in the history.

So, yeah, let's wait and test how much time does it take for the graph service to to synchronize this deposit. So, yeah, it's already here. Yeah, we are seeing I'm able to see that 30 seconds ago I made this deposit. So, we deposited 0.01 ETH, but the some fee was subtracted on the smart contract level. And yeah, now I'm seeing that my deposit is pending, and it will be credited to my account in like 10 minutes. So, yeah. That's how the direct deposits work, and we have a more extensive documentation on all of that in in our documentation page within our docs on the Zcash Bob portal.

So, yeah. Feel free to try to yourself the Zcash Bob application, create an account, apply for our bounties, check out the documentation we are in direct deposits, the SDK, and the rest of the application on our Zcash Bob website. If you have any questions, please stop by our booth. We have also We also have some cool merch. You can ask questions, have a chat with us, and if if you are not on site, you can freely ask questions in the Discord channel of the EthGlobal. So, yeah. And uh yeah, I think we have a couple of minutes for on-site questions, so I will be happy to answer.

So, with direct deposit, if I understand what you're saying is you can anonymize a transaction. So, maybe if we make an app here in a decentralized app, and we want users to run our functions from our smart contract without knowing who they are, could we easily black this in to make it work or not really? Yeah, I think you can. So, basically, the direct deposit is a very very simplified version of the deposit plus transfer combination. So, if you want to do kind of similar thing in the UI, the way it works is that you first need to deposit. In order for that, you need to calculate the start proof, and then you can make a transfer. But, direct deposit just allows smart contracts to

bypass this complicated flow with the start proof generation and just call a function on the smart contract level, passing a few arguments, and yeah, it will do this deposit and transfer to the receiver side. So, of course, this the sender address is public because the deposit is coming from the public network. The amount can also be seen, but then the receiver is actually anonymous party. So, nobody can really know to whom this receiver address belongs.

So, what if I want the opposite since I have my smart contract with a function um someone needs to call it. Um I just don't want anyone publicly to know who is calling my smart contract. Yeah, for that So, in the ZK-Bob, we are using our own sequencer and some sort of account abstraction. But, so yeah, for your own builds and smart contracts, there are a few services that does the same and a similar thing. So, there are a few frameworks for account abstraction or like magic transactions. So, yeah, you can connect to any of those. I think they also have bounty on this hackathon.

So yeah might be done. Yeah. Okay, thanks a lot. Thank you.