New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Circom buses: a new journey by Albert Rubio | Devcon SEA

DevconThu, Oct 9, 2025, 12:00 AM

Circom is one of the most widely used languages in programmable cryptography. In this talk we present an amazing new circom feature, called buses. Like structs in other languages, programmers can define their own buses, as new types, in a general way to create structured collections of signals and freely use them in their code. Buses increase the readability, modularity and security of circuits. Illustrative examples as well as the renewed circomlib, using buses, are presented. Speaker(s): Albert Rubio Skill level: Intermediate Track: Applied Cryptography Keywords: ZKP, Zero-Knowledge, Cryptography, buses Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum, https://warpcast.com/devcon Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on Swarm, IPFS and more. Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon SEA was held in Bangkok, Thailand on Nov 12 - Nov 15, 2024. Devcon is organized and presented by the Ethereum Foundation. To find out more, please visit https://ethereum.foundation/

Transcript

[Music] hello uh welcome everybody I'm here to present a new great feature of uh circum called buses okay so just a little bit of context of what is circum just in case you don't know so circum is a DSL uh where the programmer explicitly provides the constraints defining the circuit and also provides an efficient way to compute the the witness um in circum one of the nice features that we have an A a large uh library of circuits that the programmers can reuse and in fact this is uh really encouraged because uh there is a best way to uh program easily good and safe uh new circuits uh what the compiler does is uh from this program produces um constraint system in R1 Cs on one hand and on the other hand you uh you get uh the code that allow you to allows you to execute uh the circuit and compute the witness so probably one of the drawbacks of circum uh till today uh was the fact fact that has a or had a two simple type system okay let's see it in a in example assume that we want just as a as a simple example we want to to build a circuit comparing uh dates uh and then what happened that when you want to do that with circum there was no way to express dates you just could include uh signals and then you need to express six signals for day month and year of each of the inputs okay so then you have something like this which doesn't express any structure of of of the of the data as a as a date okay so imagine that then you think okay let's put it all together and then I use an array but that's maybe even worse somehow because you don't even have any clue about what's the dat what's the the month what's the year so what do we really need so what we need is doing it properly okay and this is from now on can be done with buses so with a bus you can introduce this new type that says well this is a a a single structure that will have the day the month and the year okay and then from that point on you operate with this and then you can see well I have two inputs that are this dates and then of course you can access these uh these fields of the of the bus using the standard dot uh operation okay so this looks much nicer okay and uh so the point is that buses are collection of signals like strs in in other languages and of course we call them buses because we work with uh with circuits and then what's a collection of signals of bus okay so this is the reason for the name and not using St like in other languages uh a bus can be defined in a in a in a very general uh way without restrictions so you can use signals arrays and other buses okay all together there is no restriction except for recursive definitions but they will come soon okay so then a bus defines a new type and the point is that now using these types the compiler can prevent from mixing uh data and that's very important okay so now we we will able to to ensure type safety and so on and and also this will help us to define the library of circuits in a circuits in a proper way using all these data and and make it this nicer so let's see a bit a bit of this orthogonality in the definition of the of the buses and then you see here I have this date but then I can define a new BS that uses this BS okay inside an array not restriction at all so now we have a a new bus definition which is made of a signal and an array of dates okay look that also we can use parameterized uh buses as we can have parameterized templates in in circum and this just to make things fit well because you see here I Define a template with the with a parameter and this parameter is used when defining a bus okay so then I have this n for the for the template and this n is again used to define the the uh the bus uh that I'm using as input and look then here I'm using an anonymous component another feature of of uh of circum then and you see I'm just using as input the array of dates that that was a field of the of this profile uh bus okay so everything is is done smoothly like in any other language okay so all of a sudden you can see this code and it is no longer can see that this low level okay so it's it was something that was always said about that was low level is not level low level anymore okay so look at this code doesn't look low level so let's go a bit on what we are providing with this so with uh now we can combine buses with another feature what was called tax and and the combination of both things that you get get new types using buses and then you also have some notion of subtyping using uh the tax okay so know that now we can mix both things the buses and tax and then the tax can occur inside and outside the bus so if they uh are inside the bus they restrict any instance of this bus so you attach this property to all instances of the bus but if you use it outside it's for the particular instance you're using let's uh and and adding tax is also is very important because somehow they show particular properties on on the types okay so this is a a very nice combination that makes a good still not so complex but a strong and and and and useful type system okay so all this will impact a lot in the in the circum lip and let's see it uh through as uh an example uh coming from uh from the library which is this uh circuits for the baby jab jab elliptic curve and then the the point is that in the original form you have something like this you see you work with points but what happens that you have again the points are not there okay so you have here two signals one for the X one for the Y and and each for the two points so there is no structure here and then you also have the operations for the Montgomery uh for the for the Montgomery form and then then we are using an array of two uh signals instead of of the two signals and then you see there is kind of a mismatch but uh well who cares and then you have also the conversor as circuits and then you see here we're using the the the the Edward forms here as two signals and in the other part as an array of two signals okay so alt together okay it's low reability and error prone okay so what's what's different now so look I will just create a bus for El point and then I have all this so nicely written okay I get an other point another point and produce other point okay so from a point same there okay I do this uh this there and I get the same nice presentation and then for the you see here I have this two things and now for the conversal you see everything looks nice and then we have readable code and types if okay so finally using buses I can avoid using both t uh types of points because in fact they are points but the thing is that they are in one form or another then I use tax to distinguish them you see here I say I have a point but Edwards okay and then in Montgomery say I have a point but it's Montgomery okay and then with a with a with a conversion it's clear that I go from a point and Edward to point in Montgomery okay and then the type check will check everything okay good so we have revised the the library we have ADD buses TXS make it compatible with different uh primes and uh we don't need to audit again because we have formally verified that that the that the the constraints are the same it's simply that they are nicely written okay so conclusions uh circum is great but now it's even better okay so now we we have these buses to structure secrets and we can secrets and we can ensure type safety and increase reability and security and help audit all these uh uh ZK projects and of course we will have this uh new circum lip for the for the for the for adapted to all this and just this is for coming soon but uh well it's just what is coming in the next uh few months that will be useful for all developers okay thank you very much thank you thank you very much Albert uh for your wonderful presentation now for my favorite section we going to go to the Q&A uh we have the QR code on the right make sure to scan it and we can start with uh the first question I I saw a few questions kind of like are similar so um some people may be a bit confused about why a bus is called a bus and why not struct or class as I said because this is a circuit we are programming circuits and then buses is is the word I would say it's not just uh uh there is I wouldn't say well you can call it a struct struct are in in C like uh languages but then why not a map or a dictionary or so so we decide okay we are doing circuits or bosses got it thank you now for the next question are there any educational courses they can follow up to learn Circle programming language oh there are many there this uh yeah there is a lot of of uh of of courses and tutorials and and on the web for for uh for following and learning uh circum I think that if you just put the tutorials on circum you you will get many of them available gotcha so put tutorials and you'll find a lot of resources and documentation on it yeah okay next question is what are some applications you're most excited about that is possible with circum buses I mean with buses the point is not that you will be able to to design new circuits the point is that you it will be they will be defined in a nicer way and they will be readable and uh it it will be much more difficult to make mistakes because the even the compiler will check that all types uh much and then you're not going to mix things that are not meaning the same I think that is more about the security of the circuits and the and and and of of the way you program than the fact that you can develop new things or new projects that you could not do before it's not just so it improves the security but also offers a better ux for the developers overall very nice uh will uh circum become close to high level language like python uh well in fact well as you said I think that it already uh but with this new uh types and and and uh in development I think that this already can be considered a high level language okay maybe we don't have some of the features but it's also because they are not needed for our in our for our purpose I would say I think that that providing a good type system was the missing step for for getting a high level language all right uh we have a few more other questions so people are very curious about circum buses so uh maybe when is it available to use it's already available so the the release was uh kind of a month ago and uh we have just released uh circum 2.2.1 because we are fixing uh we're improving some parts but it's all available already and you can download it and and use it uh in all your your CS from now on okay the and for the second lip it will be released the new version with the buses will be released in uh in few days okay fantastic so you can already try it out make sure to to check it out um is it possible to add methods or Associated function to a bus um not not this way because this is not intended to be like this I mean we are not an object created language and uh and the same as we don't have inheritance or or we just have this notion of subtyping by means of tax but and we are not considering that you have method ass templates I mean a template itself does I mean it's a sub circuit and it's not that think it's not that that s that much sense to what methods to do things on top of it I mean it's the circuit describes uh what is intended to do from the inputs to the outputs but it makes so much sense to add new operations on top of it got it and I think this will be the last questions because we running out of time so Texs don't have uh to be declared ahead of time seems like an easy way to make a typo uh well there is so for types need to be declared ahead so buses should be declared ahead uh and before using them but for tax is not like this and well we maybe in the near future maybe we will start at least to have the possibility to describe them and and and from the beginning I should sheet them to some buses uh in advance to avoid mixing things or or just making something that is not easy to read Because you combine tax in on different things okay fantastic well thank you for answering these questions and thank you for the audience for the questions again a big round of applause for Albert and thank you very much

Automatic transcript — names and jargon may be misspelled.