Session 7 - Intro to Aztec
ZK & Privacy Bootcamp · 52:46
An introduction to Aztec explains private and public state, client-side proving and composable private smart contracts. A Noir code walkthrough and local sandbox demo show an OTC escrow using partial notes, followed by questions on performance, wallets and private gaming.
Speakers
Topics
From ZK & Privacy Bootcamp, published by dev3pack; community: dev3pack.
Transcript
Um >> uh normally it's it's okay like >> yeah sorry for this >> uh by the way I shared the reading material to Google classroom but I don't know if everyone see it or not >> let me check um >> welcome [snorts] right Um >> oh um let's just wait for you know a few minutes I think people are coming >> how are you harsh harsh right? Uh
>> uh yeah yeah yeah I'm harsh >> I thought that it's kind of nickname but I I I believe it's it's your name directly harsh. >> Yeah. So, so like in my language it doesn't means like what it usually mean in every other language. So >> my parents never thought that I would interact with anyone outside of India. So the name >> I see now what what does it mean in your language? >> I couldn't get you. Sorry. >> Oh sorry. What is the meaning in your language?
>> Hush means excitement. Oh yeah, it means someone who's happy and >> complete opposite of whatever it means. No, like [laughter] in English. >> Okay. >> I feel that you have big lucky. >> What? >> Uh my my nickname uh surname in in India like no in like normal one is like su but in India is mean something else. [laughter] >> Oh really?
>> I don't know. I think it's a bad meaning or something like that. >> Yeah. Yeah. It's mean. >> Oh, really? [laughter] >> So, yeah, my my nickname is a bad name is a bad word in in India. You know, >> from now on I will use for you. [laughter] >> It's better. >> So, let me just put a message uh on the chat. Um, that's not good.
>> All right. Oh, >> let's just wait for two minutes and after we can start. >> Sure. Um, we k >> Wow. Okay. Okay. [laughter] All right. Let me just put I'm present. >> I think in the invitation it says session six, but it's session seven, right?
>> Yeah. >> Yeah. >> Session seven. >> Yeah. >> Week four, session seven. Uh, week five. Four. >> Week four. Four. Four. Yeah. >> That's five. it all books. >> Um, >> by the way, >> someone was talking. >> Sorry, I couldn't. >> Uh, where do you live? >> Are you digital nomad like? >> Yeah, kind of digital nomad for quite some time, but right now the bike.
>> Okay. >> Okay. Like so. Someone was talking. I'm sorry I interrupt. category. >> Yeah. So I was like happy Diwali all my Indian folks here it's Diwali and I'm celebrating it with you guys. So >> yeah it's it's a big Hindu festival. >> Oh really? >> Yeah it's a festival of lights and uh yeah happiness. >> Did we say congratulations or I don't know what to say how to say happy. [laughter] Okay, >> that should be good enough.
>> Okay, I think we can start. People um attend later a few minutes. We shouldn't wait more. I think let's just start if you're ready for >> just a second. Let me just like do some I'm just making sure that you know like I am switching off all sorts of notifications so that I don't get disturbed because I have this thing where like if I see a notification like my mind just goes like this. I guess I have some sort of PK probably. Uh >> and also we don't read your private message to >> ah no not like this just like even Yeah, that that's definitely true as well.
Like I work in privacy. I don't want people to be Yeah. Uh cool. Uh is my screen visible? >> Yes. >> Cool. Yep. Uh oh. Why is it at slide number something something? Uh so what is this going to be about? So uh so I had thought about it you know that like what's the best way uh to probably present this right like like introduce the concept of aic to you all and I thought that rather than you know like me talking about every concept about a me talking about everything that exists there I will just try to nerd
snipe you all. So basically I will give you a general gist of things. I will try to give you you know like what's the problem that you're trying to solve what cool stuff can you do with it some small concepts you know like I I won't go like into too much depth of the architecture because I don't want you all to get bored like I want you to organically go through our talks and you know like slowly like absorb more and more but right now this workshop is going to be like what's why we are building it what's something cool that you can do some basic architecture around it reading some basic noir code and we're going to do like a real real demo of a real privacy app that we have been building inside Aastic and then we can see how things goes like I'm more than
happy to answer any questions around anything. Uh I'm not the best slide maker so uh you would have to deal with very uh you know like uh childishl looking handdrawn slides but yeah let's get started. Uh so my name is S. I work at Aztec. I do a lot of experimental projects inside Aztec. I would say my job right now is like one of the most interesting one to a lot of people which is like to nerd snipe people into Aztec. So I just built cool [ __ ] which is a really privileged thing to do. So yeah let's let's get started about it. Oh I already introduced myself before the slide. It's fine. Uh so what's the problem statement that Aztec is trying
to solve right? And so if you look at blockchains today, everyone can see everything on blockchains, right? So Satoshi Nakamoto came up with this paper and everyone was like, "Oh, this is a new way of doing finance." And there were some people who were able to see it back then. It actually took me a lot of time to be in blockchains and actually see through that oh that's a real problem that everyone can see whatever is happening between these addresses because uh somewhere we all have this assumption that if I am 0x something some sort of an address on a blockchain I am private but that's not true because there's
something called chain analysis people can basically go through a block explorer they can run various algorithm AI is getting really good at it and they can start linking you, right? And it becomes worse than cash, right? Because uh it slowly becomes more and more and and more uh you know like not so private. And that's the thing, you know, like that's what cryptos was set out to solve. It was like set out to solve to give human humans freedom of using their money how they want as they want. Right?
And we can debate the philosophy around it. I'm more than happy to answer it later on. But right now that's the problem that blockchains are public. Every trade that you make, every amount that you send, anyone can say it. People can do chain analysis, people can do various techniques. Uh and that's not great, you know, like you don't want people to be saying that you are buying a taco, you're buying, you know, like a $10 Subway, you are watching the specific movie in a theater. you just don't want everyone in the world to be able to you know like mine on top of this data u so what's the solution right and the solution is to build a private world computer and what do I mean by that is that if you look at how crypto started
it started at Bitcoin where you had this publicly traceable but self sovereign money so what you mean by that is that there's this digital store of value back then it used to be the goal was to make a digital peer-to-peer scalable cache but I guess we somewhat stopped it just making it a store of value uh and it's traceable basically yeah anyone can know which address is sending what uh but this self sovereignity right so there is digital money and it's public but then basically post bitcoin everyone started making their own proofof work blockchains to solve a specific use case so someone was building a proof of work blockchain just for creating a naming system someone was like doing some sort
of a game on top of it and that they came the problem that you know like oh bitcoin is not programmable so you cannot build on top of its security so much energy is being spent on bitcoin but you can't do much with it beyond just basic transfers and that's where you could say ethereum came up with this vision of becoming the world computer where you have this digital asset ETH and you can also program it you can build an exchange you can build lending markets you can build NFDs and all of this stuff you can build on top of Ethereum, right? And we saw the whole DeFi summer similarly, but Ethereum is also public. Everything that you do on ETH is visible, you know, like every trade that you make, every NFD that you
own. Uh that's my one of like for example, if you go to hushbash.eth you can see, you know, like every NFD that I own and stuff like that. That's why I actually don't use hashbash. I just use it for my ENS. But I would never use it for anything serious because anyone can go to hushbach.eth eat and find out you know like uh my onchain transaction patterns which I don't want you all to know. Uh cool. So uh similarly like Zcash came up uh where their goal was back in like I guess Zcash started with the zero cache paper back in 2015 2016 I don't know like but like some sometime like there where they identified this problem with Bitcoin and they said we can we should we need a private
uh store of value right so basically they made Zcash Zcash is just like Bitcoin it has a 21 million supply but it's completely private and you can basically uh spend it without anyone knowing what you're doing on Zcash. So it's completely private digital money but again it's not programmable. So it has some like bitcoin like constraints and that's where we come to Aztec where it's like the private world computer where not only you can privately transfer money you can program it you can build like a defy app with it you can build private NFTs with it and you can interact with all of these applications while being completely
private and being protected by you know like zikas snacks. So what is a layer 2? Because AIC is a layer 2 system on top of Ethereum. So unlike everyone else, we're not trying to build a L1 like a layer 1 or a chain of its own. We're trying to tap into the security of Ethereum so that from day zero of Aztec's launch, because we're going to do stage two launch, Aztec is as secure as Ethereum. It has the same economic security. And now I've used this word latus and I to explain what it is super quickly. L2 basically allows you to delegate
execution of chain. So what do I mean by that is that right now when I say basically swap X for Y on Ethereum, the computation of swapping X to Y on from Ethereum is also happening on Ethereum. But you can basically delegate it. So you can just post the transaction data on Ethereum and then some other entity like like a rollup will basically do the compute and we'll just send the result. Right? So uh that's what a rollup is. A rollup is an offchain system where transaction execution is happening. All the data is available on the layer 1 but all the compute gets delegated to layer 2. And it offers two uh like one of its
main benefit is uh scaling where you can get compute for like way cheaper than how you would get it on on Ethereum. And the second is basically you can construct systems which can inherit Ethereum security. So we can now build Aztec and since Aztec settles on Ethereum, it is as secure as Ethereum. So the only way to compromise Aztec is now to compromise Ethereum you know like to revert a block or do something illegal uh on Aztec which is but by illegal I mean like outside of the protocol and Aztec is like by basically being able to control Ethereum. So yeah we get Ethereum grade security from dayc
uh and we provide a complete privacy stack and what do I mean by that is that we have smart contracts. So unlike Zcash, it's not only transfer of money. You can program money. You can give it some rails. You can like build all sorts of applications with it. Uh you can have both private and public state. So what do I mean by that? I will get to it pretty soon. We provide client side proving software. We provide you noir which is a really nice language to write smart contracts and zk programs in and we allow you to compose various private smart contracts. Now I've said a lot of stuff like what what does that mean?
Let's just try to you know like quickly see through it. So client side proing and private state basically when you're on other blockchains right now you send a transaction to basically update some public transparent state. So for example, if there's a counter on a blockchain like EVM, then you send a transaction to this EVM chain and you say, "Hey, increase my value by one. The counter value zero is basically visible to everyone else in the world." And the new value of the counter one is again visible to everyone on the world. On the other hand, on AIC, you can choose if you want this value to be private or public. If you choose it to be like public, it will just work like this. But if you choose it to be private then
comes the real magic where basically you will client side prove that so like the value is completely private. So if someone would look at Aztec they can't figure out you know like what the value of this counter is. So it's not visible publicly but then you can basically add to this private value by doing a client side. So you can read this value, decrypt it because you have the keys associated uh with it and then you can generate a client side proof saying that whatever private value I'm going to give you should be the new value here and uh this gives you mathematical guarantee that whatever operation I did on top of
this value is indeed correct. So you could basically have private counters, right? Like a lot of other private stuff. But the basic idea is that on Aztec you can have private state and you can operate on private state by client site, executing them and proving them and then just verifying the proof on Aztec which leaves nothing about this value. Right? So uh so that's basically about uh you know like what's pretty unique about client side probing and private state. So on Aztec you get to choose what state you want to be public and what state you want to be private.
So for example you can decide to make a mobile payment app where all the volume that the mobile payment app is doing is public. So this way anyone can trace that you know like oh this is whatever is happening through uh this app like it's auditable. People know that whatever money has got into the system is consistent with whatever money has got out of the system. uh and at the same time you could decide to keep the keep the transactions private of who's transferring what right and I'm going to show such a system in practice pretty soon uh so yeah so basically and and I and I said another part which is like it's composable so what do I mean
by that is that you could have multiple private smart contracts and they can call each other and that's pretty nerd snipy basically because it means that someone can have a DEX and someone can have a money market where you could basically privately swap first on the money market on the DEX and then lend that money on a money market and you can chain these two transactions together such that either one either all of it happened or none of it happens. So you can basically do Ethereum style composibility where smart contracts can call smart contracts a private function of a smart contract can call a private function of a smart contract. So you could have let's say smart contract A, private smart contract B, private smart
contract C. Uh they can compose with each other and whatever private state was updated will remain private to you and whatever public state was updated will now become public to everyone. So it also means that you can have a transaction which firstly does some private stuff and then at the end update some public state. So you can do all these sorts of really cool patterns on Aztec. So damn this [ __ ] is cool right? Basically when I saw it for the first time it took me a lot of time to get it and it's fine if it's you know like a little bit confusing and you're like how's that possible? This is possible like I it was completely the same for me. Uh it took me some times to read
through the docs to build some stuff to basically get the general idea of it. But once you start getting it, you're like, damn, this [ __ ] is so cool. We can do just so so much on it, you know, like it's an open canvas for new ideas. And that's why I really like it because uh because there has been this focus on scaling blockchains and I I have personally handled a lot of research around scaling blockchains but I've seen that not a lot of new use cases have came out of scaling blockchains like so just giving 100,000 TPS hasn't given us a lot of new use cases. Uh but on the other side I believe having the ability to build completely private apps does gives you a lot of cool stuff to do
right so what can you do you can build a private NEO bank so right now you cannot build a bank on Ethereum because who wants everyone to see what their balance is right but on Aztec you can basically have like a complete banking system where you are giving yields to the user so basically it's tapping into from staking yields. You're privately earning interest on top of it and you can spend through it. You can attach a card to it and you can completely bank yourself on Ethereum via Aztec while being completely private. You can build a private deck where your trades are hidden. So where like who is making the trades are hidden and you can even keep the trades hidden if you want you know like you could use certain techniques to do that. Uh but yeah so you can build
like a private unis swap you can build a private ae you can build a compliant private D5 system where basically you could say only someone who you like you could basically prove that okay if you want to use my private DAP you can only use it if you have never interacted with a blacklisted address right so you can do like all these sort of things you can build a governance platform which is completely private where all onchain voting happens on Aztec uh and it's completely private right So uh okay but you know like I've said a lot of stuff but can we see any of it in action because I can open I can create 15 slides of how we're going to get to Mars but if I don't have a rocket then we're not going to get to the Mars right so so
let's just uh do a quick demo and the demo will be of a private OTC market u and I will also show you some noir code of you know like how the stuff works and probably I will not bore you all in the process of Uh oh, I came to the thank you slide by earlier. But I will very fastly go to I will firstly go through you know like the uh through the article that I wrote so that we can understand the problem statement. The problem statement is that right now if there's an over to overthe-c counter trading happening if a seller is interested in selling Bitcoin for let's say uh like say something like USDC on base then if they sell on if they give someone some money on Bitcoin
and they give some if they give someone some money on base someone can easily link it they can say hey you know like this this was a trade between these two people so all the OTC right now is visible on public transaction graph and you might say eh no one cares but there are times when someone does care which was let's say if you look back in back what happened with the co-founder in 2023 is that uh he was trying to basically I guess sell some stuff OTC to save his liquidation positions and it was visible on the blockchain craft so everyone could see that the founder of curve himself is dumping the token and the token had big effects like it had a lot of really big
issues because of that like there was a lot of drama that was created. Now one can debate that oh it was actually good he was dumping tokens people should get to know but that's not the thing the thing is that this can happen in any different scenario as well whatever you're doing whatever you are selling through OTC markets is actually visible on public blockchains and the transaction graphs and I think uh we can solve this so we at Aztec thought about it you know like how could you solve this problem and we were like okay what if we could build a non-custodial private OTC market where the volumes that this market is doing is public but who is selling to whom and what is being sold is completely private right and the way this works is uh basically so yeah
the problem statement is that the seller should be able to sell one ETH for 5,000 USDC because I want ETH to go to 5,000 USDC and then be able to uh buy uh someone be to able to buy you know like 5,000 USDC for one ETH and uh yeah so there like few simple processes that happen here. So there will be a seller and a seller will deploy a private escro contract on Aztec, right? So the project is open source here on Aztec pioneers Aztec OTC desk and basically what this escro contract on Aztec is supposed to do is basically allow the ability to deposit privately which means that first of all
no one should be able to know that you are trying to sell something. Whatever you're depositing into this contract where let's say I want to sell one each. So I'm going to privately deposit it one into it so that no one out there can know that I have deposited one into this escrow contract and then I'm going to create something called as a partial note. And what's a partial note? I will just try to keep it very simple here because it would take us on a tangent but more than happy to answer this question later on if someone really wants to del deep into it. Basically, a partial note allows Alice to be able to get some money from Bob without Bob knowing who Alice is on Aztec and vice versa. Like you can try to enforce vice versa as well if you want. So basically,
let's say if Alice is a bakery owner and Bob has just bought like a piece of bread, then if Bob pays her directly on the blockchain, then Bob knows the whole volume that Alice does on her shop. But with Aztec, you can basically use something called as a partial note, which is the piece of data that Alice can give to Bob. And when Bob fills the amount that he wants to pay, the only thing that Bob knows is that Bob paid someone some USDC like this amount of USDC. But Bob doesn't know to whom they paid. So they don't know who Alice is on Aztec. They just know that they paid some address, this amount, some amount of USDC, and that's it. They don't know who Alice is. that allows Alice to
completely privately take payments on Aztec. So, we're going to use this construct here where basically what the seller does is that once it deposits the token into the escrow, let's say one ETH here, it's going to say, "Hey, here's my partial note." And basically, anytime someone pays 5,000 USDC to this partial note, give them the ETH that I've locked here. So this allows the seller to receive payment privately for their order without the buyer knowing because they are just paying to a partial loan as we described here.
Cool. And then there's the service called the orderflow service. I'm going to quickly go through it, but it basically helps people discover orders. So let's say if there's someone who is ready to uh buy these orders, they need to know that there are these orders that exist out there. So a seller can optionally record this into an orderflow service unless they just know whom they're going to sell to and they are directly going to give them the address of the the order details. They can expose it to an orderflow service and the orderflow service doesn't know who the seller is. They just know that someone is ready to like sell this much amount of some asset but they don't know who. Right? So that's not even known to the orderflow service. And then comes the buyer side of it. the buyers are looking at oh someone is willing to sell
one E for 5,000 USDC and if a buyer is interested in it then they will basically privately call this smart contract they will transfer their 5,000 USDC to the partial note which will basically give cover the payment for the seller and uh then the smart contract will privately give them uh their basically uh ETH one ETH for it and in this scenario uh the buyer doesn't get to know who the seller is and the seller doesn't get to know who the buyer is. Right? So, uh that's kind of how the system works. So, I'm going to now quickly go through the code and then a demo. So, if you look here, if you go like you can later on go to the to the
repository, you have this main noir file. NR file in contracts and this is what noir looks like. So it's a very rustl like language I would say uh which you can use to write private smart contracts. So every smart contract basically is written inside with the specific syntax uh which is let's say pub contract and then your contract name and then you have basically uh this specific macro that's required to you know like decorate a contract and then you're importing like stuff. So basically uh yeah these are like basic imports. So if you have like used any programming language like if you if you
are like if you use TypeScript think of them as import statements. I think like Python also have like import statements. So yeah like just think of them being able to import library code. And here's the stuff here. Let's say we say we define our storage and we say we have a private immutable value. And what we mean by that is that this value will only be recorded once and no one can change it and it will be private. And what does this value look like? Uh this is the content of the value. So the value basically records who is the owner of this escrow who does you know like what's the partial note what token is being sold what token is being like how much is being sold what token is being
bought and how much is being bought and some randomness here which I will skip for now but you can think that it's for security uh purposes that we add some stuff here. So yeah, so basically you store in the storage of the smart contract all of these details related to the order and no one else in the world can see these details. It's only visible to the seller and the buyer. It's completely private like you cannot go to a blockchain explorer and you know like find all of this data out. And then just like how we have constructor in normal programming languages, we have initializers here which is basically initializing the storage values. So here basically you the seller when you create
the contract you provide the address of the token you want to sell, how much you want to sell, how much you want to buy and what is the address of the token that you want to buy and then you create a partial note to which the payment has to be made so that you can privately get your other asset in and then you basically uh initialize your storage with this data right and the act of initializing the storage will make sure that this value here is filled like there is the there all of these values are now filled and now they cannot be changed and they will remain private and only known to the person who created it and has the keys for this contract. So once the escrow has been created then
you go ahead and deposit your token. So you will basically deposit uh let's say if I want to sell one E I will and if you look at here like we have defined #private. So what hash private means is that this function runs client side on the user's device and a proof of it will be generated but it won't be executed on AIC. It will be run completely client side right. So that's what the hashic uh private stuff mean. So now we are going to allow so anywhere you see private you now know that it's it's like running on your own device and it's completely private. Uh so yeah the act of depositing is basically you depositing whatever token you want to the contract.
So the contract will now hold it. So for example if you want to deposit one E then you will privately transfer one to this contract and now this contract holds the one E and it will only release it when someone will pay you 5,000 USDC or whatever amount you have set in exchange for it. Right? So that happens and then there's this very simple function which is again completely private which is fill order. If a buyer is interested in buying this order, uh they will come here and they will basically pay uh the smart contract the required amount of tokens. So let's say if they want to sell 5,000 USDC, they're going to sell 5,000 USDC and uh yeah, then basically the contract will give this 5,000 will pay this 5,000
USDC to the partial note. So, and then basically it's going to give the ETH back to whoever whoever is like willing to buy it. I'm sorry if it sounds a little bit confusing, but I tried my best. Uh, but yeah, like it's basically uh it's basically this, you know, like there these three functions. Constructor initializes the value, you have the act of depositing, and you have the act of uh being able to fill orders. All of it is completely private. You can go at back and check out the code. I won't like read the code line by line but I hope this gives you some context you know like of how a contract is written on Aztec like uh this is the language is no rir we have documentation around it and yeah it has like very rustl like a
lot of rust like con constructs okay cool demo time I bored you all enough uh >> sorry we have a question on the maybe we can check it >> yeah sure uh >> can you see if I can read Uh I can see it. So what does it mean that one right like what does it mean that the attributes are totally private? If someone is sniffing the activity and a stick node they can access this data or not. Uh no so let's say if what I mean by and let me also read the line in the env where the smart contract is executing. Uh yeah so good question that's a really good question. So the thing is that anytime something is
private, it's not actually executed on the node. It's executed on the user's device. So anytime you see any function which has this private attribute to it, it's being executed on the user's device and only the proof of it will be verified on the Aztec node. So all the private compute that happened there is yeah completely private. But if it was a public function then it would be executed on the Aztec sequencer and the node and it would be visible. there. Um, cool. So, I think let's go through a quick demo of this thing in action. Uh, yeah. So, we're going to do uh there's this thing. Uh, is there a new question?
Ah, okay. Cool. Thank you. Uh, so yeah. So, we're going to like So, if you go to the repo uh like I will like tell you what you can do so that if you want to run this locally, you can as well. If you go to the ATC Aztec OTC disreo, you can check out this branch. But we're going to merge this on main. So main should also work for you once we merge it. Uh you can go to and you would have to do like a bun install which will build the whole system for you. I'm not going to do it right now. Uh and then you have to go to packages and then you have to go to contracts. And now you see this docker file. So we're going to start something called as an AIC sandbox. So basically AEC ships with this thing called as a sandbox which is
basically a local devet you could say that which has an Aztec node it runs anvil and you basically have like a complete Aztec instance on your system running uh and you can like develop stuff on it right so uh we're going to like start a docker file that does a bunch of stuff here uh for that so I'm going to quit it here. Um, it's the command call. Okay, cool. So, I'm going to do one run sandbox and it going to run the sandbox. It's going to run something called pxes, but I'm not going to get much into a pxe right now.
I think it's it could be a lot for someone to grasp in a single go, but more than happy to help answer any questions around it. So yeah, I've started like a local instance of Aztec now on my system. Uh it's settling to an envelope chain. And now we can come to the CLI here and we can show some cool demos. So the first step is to deploy some assets to Aztec. And if I'm going to say setup deploy, it's going to deploy USDC and ETH to Aztec. uh you can later on check the scripts uh but it's going to deploy two tokens because if if you're going to do OTC we firstly need some tokens on Aztec we like just
deploying two demi tokens to Aztec and now I'm very soon going to be a millionaire on testn net so just watch uh that out uh cool yep so basically we were able to deploy uh this stuff on a we able to deploy USDC contract and each contract uh on Aztec uh you can see some logs here as well probably. Okay, it's it's Docker. So probably uh a lot of blocks are being mixed. U cool then the next step is uh to basically so if we come and look at the balances right now if we print the balances bund balances we're going to see that the ETH balance
for the like the ETH and the USDC balance for the seller and the buyer both is zero. So how are they going to exchange something if they don't have any assets? So, we're going to run this script called one run setup mint. And this is going to mint some assets for them. So, so, so, so, so. Yes. So, basically, uh, 10 E was minted to the seller and 50,000 USDC was minted to a buyer. What's that? It's not worth a million. We should have, we should change the scripts to at least make people millionaires here. Uh, but yeah. So uh yeah if we now run the balances uh we can see that uh let's just see yeah we can see that the ETH balance is like
a big value but because that's like that is expanded so like we are using the way system here where I think one E is like 10 to the^ 18 uh way so that's why it means 10 million like 10 E sorry Right? And then same for the USDC. So we have like 50 USDC but 50,000 USDC but again it's expressed in the system where the smallest u let's say one USDC is 10 to the^ 9 or something like that or 10 to the^ 6 I I don't know like I'm confused about how many powers there are. But yeah uh cool but the thing is that now we need the ability to be able to transfer one E from the seller and be able to get 50,000 USDC from the buyer.
So if you look at the like a successful OTC order should allow the ETH balance of the buyer to be basically uh one and the UCCC balance of the seller to be 50,000 and of course both of these values need to be changed accordingly as well. So we're going to create an order first and we need to now run this orderflow service. Okay. One run that. Yeah. So now this order for service is what helps the buyers here to be able to discover orders. So if you look here, if I do uh bun run order create, now it's going to create
an order, which means that it's going to deploy an escro contract to Aztec saying I am giving you one E and you only give this one E to someone if someone gives 5,000 USDC to my P shell node. So we're going to say burn run create order. And now like an escro is being deployed to Aztec and all of these parameters are being set. So you can look here like the contract is getting published uh and then it's going to get deployed. Cool. Yep. So it got uh deployed OTC order was created and you can see that the order was also discovered by the orderflow service. So now anyone who's a
buyer can basically query the API here and see that there's an order for something but they won't know who is trying to sell it. And if we now run the balances stuff we see that the ETH balance for the buyer is zero. But you can see the ETH balance for the seller changed. They dropped one E and that one E is not deposited to the contract. So now when we would fill the order is where let's say the the the buyer of this OTC will discover this order through this orderflow service and we'll give 5,000 USDC here and we'll get one each back and all of that will happen
completely privately. So it says found a matching order to fill attempting to fill order. I hope it passes its attempt to fill the order and and and and Yes, finally. So, yeah, like a transaction happened. Uh, and now if we were go to going to go and look at the balances, we can see that uh yeah, we can see that the ETH balance is 9. it got 50,000 USDC 5,000 USDC here and the ETH balance of the buyer
increased by one. So we can see that they were able to privately exchange these assets without knowing each other which is really cool. It's basically like if you look at it it's actually like an completely private order book the way it works. So the code for it is available on GitHub on AIC pioneers and you can go and spin all of this on your own and I guess I pulled off the impossible of getting a live demo actually working without any error. So yes, that's that's a very weird thing. Usually doesn't happen. Something always breaks. Uh but yeah. Uh cool. Yeah. So that's that's that's about like some live demo of an application on Astic.
And thank you. I don't want to you know like uh keep expanding on that tip. >> Um can we send the GitHub link to the Telegram group? >> Yes. >> Or it chat also works. I >> Yeah, I'm send it to the chat. So this is the GitHub link and this is the link of the articles. >> Yeah. >> Let me send it to Telegram group and if we have any questions you can ask for harsh.
>> Yeah. Yeah. Uh August if I'm pronouncing your name correctly. Yeah. >> Okay. Thank you. Um my question is uh why use uh Noir instead of Rust or other programming language? Uh I didn't understand that. >> Yeah, that's a that's a great question. Basically uh Noah already looks a lot like Rust. But the thing is that making the whole Rust language work for like being provable client side would be very expensive. So basically when you are
doing zero knowledge proofs you want something that's very efficient. So noir is designed from first principles about how do we create a language that can be proven really fast on client side devices and rest as a language with all of its feature was never designed for that like it was never designed to be proven was just designed to be executed. So that's why we have noir which basically allows you to write like super efficient u uh super efficient client side uh software which is client side probable like does that help like >> oh yeah Karolina like am I pronouncing
it correctly like >> yes thank you Um yeah, thanks for the talk. Um maybe you know this project that I'm sharing in the chat um Kohaku. Um I just wondered uh what's your opinion on on it and how Ashtex is positioned regarding what they are doing? Yeah, I haven't like so I've heard about Kohaku but I haven't like really got into into it but from my understanding uh this is just my understanding or whatever I've seen till this far about Kohaku is that they're basically like trying to use like privacy pools for May and stuff like that and yeah they could technically you could technically integrate Kohaku with AIC uh but I think
like they aren't trying to do what we are trying to do they're trying to just use other protocols like AIC which is let's say like a protocol on Ethereum uh let's say something like Xerox Bore and route transactions through it and you could technically Kohaku could technically route transactions through Aztec as well. Uh but what do I think about only doing a doing privacy directly on Ethereum? I think uh it's very hard to get a big anonymity set and you again run back into the same pro problem that you cannot program stuff. So let's say if Kohaku integrates with let's say private transfers and sends through something like 0x which is a privacy pool. Now you still can't do private swaps. You still can't do
private lending right. So if Kohaku integrates with something like Aztec it can do private swaps, private lending, private OTC and all of that stuff. So I think like uh Wuhaku as a wallet is basically something that can be expanded to Aztec and I think the kind of protocols that it's going to integrate with right now uh yeah like might not be uh uh that interesting but yeah it it okay it does look like that they're interested in integrating with lay so yeah like I think it's going to be pretty complimentary so like they're going to just like we can just integrate it with a yeah and the good thing is that Aztec has native account abstraction which means that your Ethereum keys can directly work on AI.
So your Metam mask can technically open AI. >> Cool. Very interesting. Thanks for sharing. >> What practical consideration should one keep in mind when deploying and executing applications on Aztec particularly regarding the interaction between public and private state and onchain verification. uh I would say like the practical consideration while writing uh client site like like noir programs is that the more optimized the better.
So like firstly I'm just going to talk performance which is uh basically making sure that your contracts are as less by like consume as less bite code as possible because the bigger your circuit is the more your user is going to spend time generating a zk proof. So you should basically try to write like like reason through a lot of you know like about about your code. So I would say that's one thing that you definitely need to think that I've written this program but can I make it go faster because it going faster means the user being able to prove it faster. uh on the security side of it is where like if your public function in Aztec is is is basically
responding to any call on a private function. So let's say if a private function calls your public function then you need to make sure that whatever happened in the private function is something that you're satisfied with. So let's say let's say a private counter. So uh yeah so let's say a a counter where the value is public but you can add any value to it in private right so now what's going to happen is that rather than someone adding the value in public they're going to add it in private and just give you the result right u and uh oh yeah like and there could be an even simpler example which could be an base
and an exponent yeah so let's say let's say base and an exponent problem. So let's say you have a value of 16 and you basically have a public value of 16 on AIC and you are saying if someone can find a factors of this let's say uh like if someone can find a base and an exponent like something we've raised these many times to the same value would give 16. I'm going to reward them some USDC for doing this computation although this computation is pretty simple. So now the private function of the user is going to look like I know a base and exponent which could be 2 raised to ^ 4 or 4 to the^ 2 like the public function doesn't know out which out of it is
which will result into 16. So your public function just needs to make sure that whatever private function the user called is something that actually verifies the logic that they're interested in which is let's say base into exponent is equal to 16. So I think that's the thing like every time you are doing any public action based upon something that was run private and client side you need to make sure that whatever happened on client side stuff is what you are fine with. So if that makes sense I I have a question.
>> Yeah. >> Yeah. So uh what do you think about privacy in blockchain gaming or in gaming in general? Uh where I'm coming from is I am I and my team are working on a poker game and we have built a recently completed building our own game on chain. So what's your opinion because I had also attended Aztec's uh community call where uh Joe Andrews had Joseph Andrew openly mentioned that you know blockchain gaming is a good use case es especially poker so he couldn't highlight more but I would like to have your outlook on that because we are we are building that and uh we are actively
building that for Aztec as well and we have spoken to Josh so if you could just highlight Yeah. So I think like I like it. I actually yesterday tweeted about it that if someone is building this more than happy to help architecturally. I think um is like AIC would be really cool to build games where the strategy cannot be revealed on chain. So for example poker like you cannot build poker on Ethereum because like no one can actually know like who has what cards, right? So if the cards are visible on Ethereum then there's nothing left to speculate. So you could basically have a private shuffling on of cards on the on Aztec and I think you can bring a real poker game blockchain and that's really epic because I don't think most people have like I I haven't
seen someone actually be able to do it, you know, like I've seen papers but I've not seen someone actually get like a real system in production without any trust assumptions, you know, like stuff like that. So yeah, I'm pretty bullish. I think you can build like a lot of strategy game on chain with it where me not being able to know your strategy is very crucial. >> Oh thanks thanks good to know that you're bullish on it and uh I would like to connect with you if if for a meeting with my team that would be great because we are actually hitting few roadblocks because we have been exploring building on Aztec Josh has been helpful but yeah if you can guide us that would be great.
>> Sure then. Yeah, I'm on Telegram. So, do we have any other question? >> I believe not. Um, thank you for your discussion, Harsh. It was amazing. And if you have any other questions about our tech harsh is on our telegram group so that you can you know text them and yeah thank you very much.
>> Thank you. Yeah I hope it was helpful in some capacity. >> It it was really good and you're right always while trying to do a live demo something happened but this time it was amazing like very fluent. >> Oh >> congratulations. >> Thank you. Yeah. See you all. Happy Diwali to celebrating it. >> Y thank you. Bye-bye. Take care.