Introduction to the Leo programming language
Aleo has assembled a solid team of compilers to create a very ambitious schema compiler language. The main goal of this work is to allow developers to simply use zero-disclosure evidence in their applications — this is achieved by minimizing the requirements for cryptographic knowledge. How does Leo achieve this and what do you need to know to start using it? Let’s find out.
First of all, let’s briefly remind ourselves what zero-disclosure evidence is. This is some piece of data that proves that we performed the calculations correctly; for example, that we used a private key to send someone NFT or that we have some attribute that allows us to update the state of the application. In addition, it allows us to keep some data secret if we wish; for example, we do not need to disclose the private key we used to send NFT. And this evidence is also much smaller than all the calculations, so it will require much less storage space (in the chain) and they will be transmitted faster.
This is a very abstract idea, so it may be more relevant if we link it to the scalability issues we are seeing in the industry right now. Take a look at the challenges that different networks face in getting enough transactions per second, and the scaling requirements for enhanced online gaming capabilities. Tools such as state segmentation have proven useful, but we need to add more to support the growth of these uses (and future uses that we don’t even know about yet). In addition, the ZKP also allows us to hide data that we do not want to disclose; of course, this is not possible for other scaling solutions.
Now, how do you do ZKP? Well, it’s done for us with a system of evidence and something called the ZK scheme — it’s actually a scheme we need to build, and that’s what Leo will do for you! Libraries that convert ZK schemas to proofs already exist, and so far people have used these libraries directly.
Think of the device you’re using right now, there are circuits inside that do all these calculations, right? Well, aren’t these circuits just I-NOT valves through which zeros and ones run? ZK schemes are very similar, except that instead of AND-NOT elements they are made of addition and multiplication elements, and instead of zeros and ones we have numbers between zero and p, where p is a phenomenally large prime number. Are you beginning to realize that we can perform as many calculations in ZK circuits as we can in real circuits?
Now, we come to the part where we talk about the middle ground, which is why Aleo is investing so much in compiling the Leo schema compiler. your application. I mean, how much time would it take you to write common applications if you had to connect NAND valves to build calculations… Sounds not very fun, right?
Well, this is the current state of ZK schema creation. In essence, you have to work at the circuit construction level, because there is not enough infrastructure to automate low-level repetitive parts. In fact, it’s even worse. Not only do we not yet have these automation tools, but we also need a lot of cryptographic knowledge even to start building ZK circuits. In most cases, people need several months of face-to-face training to overcome this barrier to entry. Sounds not very good for product development.
Leo is a Rust-based programming language with static typing, designed for writing private applications. It is designed for developers who can intuitively build the Aleo blockchain, providing the basis for a private decentralized ecosystem. It is the first known programming language to represent a test environment, a packet registry, an import converter, a remote compiler, and a theorem generator for zero-disclosure general-purpose applications.
Let’s jump ahead and say that you wrote a Leo program, similar to the bubble sort in the image above — what does Leo actually do when you run a program?
It takes your code, creates a validation schema that represents the calculation you want to run, fills the input wires with the required values, runs the schema, generates validation keys, and then combines all the relevant data into the ZKP. For example, you can run it on the input in the image below.
But we said that you don’t need any special knowledge in the field of cryptography to use Leo, so what’s the point of creating evidence? Summing up, we can say that Leo provides proof that you performed your calculations correctly, which means that if you run the above scheme on some array and present the original array with the proof, any observer will be able to confirm that the array was indeed sorted by verifying the evidence, not the array.
This may not seem so great if the array contains only 10 elements, but when we start working with data structures that have millions of elements and more complex calculations, proof verification (which is always the same size!) Begins to convey much more value. But this is not an article on how to benefit from ZKP, this article is intended to help developers learn Leo so that they can create valuable applications themselves.
Leo also does more than just create a diagram for you and generate proof based on it. It is filled with functionality that helps to minimize development time. The testing platform, package registry, and import converter work together to save developers a lot of time, ensuring that external features are easily imported and that the code really does what was expected of it.
When building an ecosystem that focuses on developing scalable private applications, one of the best ways to drive growth is to remove as many barriers to application development as possible. This is what Leo helps to achieve. If you want to know more, take a look at the playground or the developer’s documentation.
Discord ~ https://discord.com/invite/aleohq
Website ~ https://www.aleo.org/
Twitter ~ AleoHQ ~ https://twitter.com/AleoHQ
Announcements Blog ~ https://www.aleo.org/blog