MACI - Private Voting - ETHGlobal Singapore 2024
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join us for a workshop with Matthew Krak titled, "Building Omnichain Tokens." In this hands-on workshop, you'll learn how to deploy Omnichain Fungible Tokens (OFTs) using LayerZero's omnichain interoperability protocol. We'll guide you through the entire process, from setting up your development environment to deploying your OFTs across multiple blockchains. This workshop took place at ETHGlobal Singapore 2024, a 3-day hackathon held from September 20 to 22, 2024, that brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ________ Follow us: x.com/ethglobal Website: https://ethglobal.com Email us at: hello@ethglobal.com
Transcript
[Music] hello hey everyone um yeah I'm with Foundation um privacy and scale expirations uh we do a lot of like TK and now recently more NPC and FG uh research and trying to build um applications that can be used by anyone um I work in Macy uh and we with uh private voting so today we just going to be going through Macy and just dive a little bit into the protocol nothing nothing crazy and kind of focus on how you can build on it and what you can build on it for the aaton um right so Macy is a private um voting protocol H you can use it to run like onchain uh poles uh these are the the main properties so um collusion resistance um you basically um you have coordinator role and and um only them can be known can be certain of the validity of a vote uh so collusion is it becomes very difficult uh you also cannot prove how you voted uh because all the votes are encrypted and for you to prove Beyond any reasonable doubt how you voted everyone would also need to show the vote or the coordinator in this case uh is private uh only you and a coordinator really know uh how to decrypt your vote it cannot be censored uh so every every vote that is sent on chain must be processed and cannot be censored even by the coordinator um you can alter your vote uh but well you can onlyy your votes but you cannot really delete it once an action is posted on chain is there and it must be processed and the coordinator cannot really produce any false output and that's thanks to the CK um stuff cool um so why do we need private voting I mean I think in general uh voting is just suceptible to bribery and collusion uh we've seen it everywhere uh whether it's like local election or like online voting um with contr funding and contr voting for instance um the difference can be made by more people actually coming together and voting for a project or contributing a small amount of money uh compared to like more organized group with money but you know if pollution is not easy then still we don't really solve the problem there and yeah also when you're voting like if you know everyone voted you might get condition right maybe you don't research too much on the candidates or the projects you're like okay this famous person is voted on them let me just do the same um and yeah just to reiterate on the briber part like because with Macy uh the briber cannot really be sure of how you vot it uh then you know they wouldn't really have a reason motivation to to prbe you and the goal is to you know bring more de Democratic voting um so the architecture so the protocol is divided into like three main parts uh we got a smart contracts which uh run on any evm chains uh we got some ZK circuits uh these are built with um circum there like these two big circuits one of them deals with processing the messages and generating proof that everything was done uh correctly and the tally one which basically sums up all the votes and generates the what we call the results of the voting round and you'll find a bunch of like types code that basically replicates some of the logical the smart contract so it can be a process of chain and like an SDK to interact with it so the user flow um kind of simplified uh us the user you can register into the system um you register with your own identity this is a m public key which is not to be confused with like an ethereum key uh this is like a ddsa key and uh you basically just need to pass some set conditions that's decided by whoever round is the voting round May Pro or c pro on something anything they want and once you register you can send votes uh these votes are encrypted um and they are encrypted with a share key between you and the coordinator and they're also also signed with your own uh private key so that no one else can really like post uh votes on your behalf after all the processing then like you can verify So like um the protocol is fully verifiable uh you'll have the public data of the tally and you can just verify on chain um just just to dive a little bit into the The Vault itself so that's like a encrypted command that is sent uh to the smart contract it is encrypted with the share key uh we use a CD so you generate a random key the coordinator has the public key on the smart contract you generate the share key you encrypt it uh and then you send encrypted vote then the coordinator can just reverse the process uh you sign it with DSA as mentioned before there are some nones on the messages so that you can send uh different votes and you can create like your ballot through the different votes and you can also use the nons to invalidate uh preview votes in case know you made a mistake or like you think you're bribed and you just want to inv validate everything that was say before uh in the message so this vote you specify uh who you're voting for which is like the vote option the weight so there like qura voting and on quadratic voting you have certain amount of uh credits to spend and you just basically like weigh your preference um through the vote it can also be like a simple like yes or no vote um yeah it will still go uh through the vote way it'll just be like one instead of like a different number um yeah basically anyone can vote really um but only if you signed up your vote will be counted so like that kind up to the um to the anonymity Set uh so you just sign up maybe one address then you go and vote with the different ethereum address and as long as you have this Macy key and you sign the vot with it then you'll be able to uh cast votes so this is what the coordinator does um so yeah we have the poll this finishes uh users are not able to send any more messages um we have this like Merle Tre and chain which just merge the data store whatever we need uh we pull all the events uh with this types of code and then we basically uh run the processing so the processing is like the crypting the votes for the coordinator and constructing a ballot based on the valid votes and then put all this data into like a ZK circuit generate proofs and just submit them on chain uh everything validates in chain that's cool we can then um do the tally so we have all the ballots well the coordinator has all the bot locally and again process them calculates the the result the T and then generates proof and post them on chain uh there are some trust assumptions uh currently um there is like a coordinator figure and it is assumed to be honest they could um publish this vot uh they could decide just to not conclude around or maybe just delay or they can cude themselves with briers uh what they cannot do is they cannot really censor any votes um I mean if the code is is audited if the code works correctly they cannot do that uh everything that is said on chain must be processed and they can also not do an incorrect processing of this data because they need to submit ZK proofs for it um yeah so what helps here is like this source of truth that um basically form the public inputs to the Circuit so everything that is St chain like uh number of votes the number of people sign up um all of these goes into like the public input to the Circuit so if the coordinator is trying to like process less messages uh sensors and users they just won't be able to um gen like verify the proof on chain and people will know that there's something wrong with this round cool uh so now on the acon part what can you build with it uh there's a lot of things I say that you can build uh different Integrations um yeah something like we've not explored yet is like building tooling for Dows so like for Dow voting uh that kind of has few problems like how do you assign the credits for voting like you know maybe in a DA you have like power based on the tokens you hold but you know so people keep in mind it's like flash loans and stuff so if someone wants to tackle this uh that be pretty interesting uh there's some like um protocols that we'd like to integrate with like anadar or open passport and this can be used for like gatekeeping access uh to the voting round so let's say only Indian RAC with a an dark and like join the round or like with open passport um whatever passport they support you know um that's how you could fill the cills so my ideas like building some voting up for like University clubs um sort of election system like feedback as well I think uh you could have like internal feedback system built with Macy um build ups like we just starting to explore a kind of structure which is what kind of need uh to be able to bring this to the masses and you know building an app that has like um pay masters like custom one maybe they just allowed um users to like Vote or sign up like you know you can use this pay Master for the stuff or like they maybe limit the amount of like transaction that can be made and whatnot and smart World L recovery so that um anyone that doesn't really own a metamask wallet or any other wallet can actually use these apps uh some other cool stuff would be trying to make it completely free so like maybe build some sort of like relay system uh that can be used uh to relay votes and mesages on chain and some ideas like feel like recursive mayy so thinking like uh some sort of like tournament style voting where like you know you started like I know this eight projects and then you know the top four make it to the next vote and like trying to build like an app and like starting the vote based on these results um things that I'd like to see personally and I think will make stand out some projects is like trying to implement some sort of um new voting um methods like that can be done through changes in the tally circuits so for instance like cap um the max vter can be uh assigned to a project or to an option uh or maybe just like having only two Winners instead of more and you know whatever you can think really any other type of like voting that is just not the simple quadratic voting or non- quadratic voting um yeah some some other stuff would be like building when if you build an up it would be really cool to see like some sort of widget like for like the Quadra voting part which I think people find quite hard in terms of interface uh we seen like people trying to spend the credits and they're like okay I'm putting 10 credits but why is it counting 100 you know if you have any idea on how to do this that would be really cool to see and yeah mentioned before like some custom pay Master stuff so how you can build an it um so the core protocol uh is here on this repo that's where you find this contol in the circuits um then we starting to build like a platform which is like basically like a front end with some automation for the coordinator stuff um the coordinat stuff not really ready yet but the front end is and it's like can be used can be for can be changed and it' be great you know to like maybe start from there rather than starting from scratch um or there's also like a community build project that came out of like if London aaton and and yeah it's like a wrapper like um it's built using what's that called um if from Bill Guild I can't remember but anyway like um you can use it to like very easily create like uh poles and like um yeah build on Macy like very easily so so yeah we have a few bounties um so the first one will get 3,000 and some death Con tickets for free um yeah so exciting stuff um 2,000 for the second and 1,350 for the third there's two more just I didn't have a metal Emoji for it but there's two more prices like 750 500 I believe um yeah I mean just to reiterate like we really think the you know tackling voting issues is important um and yeah we think Macy like makes is more secure it's far from perfect um and yeah that's why we kind of like try to come to aaton so like encourage people to contribute to the project everything we do with PC is like open source and public good so you know if it's not today is another time you guys want to poy Discord and like trying to contribute on something we really welcome people to help and yeah just some links and stuffff uh to join the PSC Discord like we got a public Channel there you can ask questions I'll be around the venue so like you can drop a text and then like we don't have a booth but drop a text and then we'll meet somewhere I'll be happy to help um yeah just some links and stuff I'll I'll share this in the Disco later yeah that's everything if anyone's got any questions we got some time okay that's a good question so um to answer the first one you can choose who the coordinator is like so the terminology would be like you the one that deploys the contracts and operat the round or the 14 is like an operator and then the coordinator is basically like a a key is like a key pair so like you know you could appoint someone that generates this ddsa key they publish the public key on chain with a poll and then you know they are in charge then processing everything at the end so it doesn't need to be yourself it can be someone else and yeah so we don't really have any slashing mechanism uh for it um uh I mean that probably be something cool to implement um yeah like even NPC is not something we've really um explored that much yet but yeah like anything that can reduce the trust of the Coordinator would be like great to see okay uh sure um to like submit the proof you mean like to Story how do this proof Yeah so basically like um there would be like um this stally file which like is is basically like a file with a result and some sort of commitments to the data that should be made publicly available um for now it's just like a Json file we didn't really think about uh where to put it it's just up to the operator coordinator but yeah that's a good point it could be part of the data of a es and yeah user will take that run through there a CLI command that you can use to verify this uh this data on chain yeah yeah but that's yeah good question that yeah yeah correct Yeah so basically you will create the the key yourself um it can be done deterministically so like you know like we don't want to remember like the secrets to it you can use like a your wallet signature for instance sign a message in the app and that generates like with the hash of that you can use it to exceed for the key and then yeah basically you submit the uh the sign up transaction chain and your key alongside with your public key alongside uh your credits will be stored into like what we call a state Lea and that goes into like the state tree which is just a medical tree yeah yeah so that would be up to the gatee keeping mechanism like say Anar right you know you scan it once and through the gatekeeper we recorded this anadar it or whatever is being used and you cannot use it again right unless you know you have someone else card or I with a passport uh yeah so that's custom like cool I think yes 50 past any more questions we can talk later I'm on Discord there's a channel in the if Global one just drop a text um yeah I'll be happy to talk and uh yeah thanks for listening [Music]
Automatic transcript — names and jargon may be misspelled.