# Aleo overview > *This document is an overview on Aleo, done by reading/watching [Aleo docs](https://developer.aleo.org/overview/), [Aleo Blogs](https://www.aleo.org/blog), [ZK Summit Aleo talk](https://youtu.be/e-1mPNEINRI) and asking questions on [Aleo Discord](https://discord.com/invite/SMXsDEQ).* <div style="float:right;font-style:italic;margin-bottom:10px;">Research Group, 2022-10-05</div> <br> <div style="background: #f2f2f2;"> **Contents:** [TOC] </div> ## Overview Aleo is a L1 blockchain that provides scalability and privacy. It does so by using ZK-SNARKs to verify transactions. Aleo has ability to run user written applications. One destinction of Aleo is optional privacy, where a user can either act in the open, with less computation required, or be private, however they would require to do more work on their side. Right now Aleo is in testnet phase, but it is expected to go live in Q4 2022. ## Architecture The model in Aleo consists of Programs, similar to Contracts in Ethereum. They have some predefined logic on how you can interact with them, by invoking functions. Each Program has a state, but instead of having one state it is split into small fragments, so that multiple parties can interact with a program at the same time. Each part is defined by its owner and a random nonce and in addition can contain other information, such as a balance or a street address of a house. When you want to use the state, you consume it, which means that you can only use it once, and then generate a new state with a new random nonce. This is done to prevent double spending and is a classic approach of UTXO, as used in Bitcoin or ZCash. The state part, called record, can be private or public, or only partly public. In case it is private, only the owner of the record can see it. In addition to the program records, each program can have a public storage, called mappings. They store correlation between keys and values, where both key and value are defined by the programmer. ## Programming Aleo has implemented its own two languages for writing code. 1. Aleo - compiled to WASM 2. Leo - compiled to Aleo They additionally have plugins for most popular text editors and IDEs, and they have a [playground](https://playground.aleo.org/) where you can try out the language. They are also building out an Aleo Studio as well as Aleo Package Manager, taking developer experience to a very high level. Be careful with the documentation, as it is still in development and some parts are not up to date. Best is to ask on Discord. Aleo provides very helpful shell scripts to compile and run both languages, make sure to use them as they are very helpful. ### Data types It is also important to point out that to develop in Aleo one needs to know the Elliptic Curve primitives, such as point addition, as well as basics on groups and fields. Otherwise, developing might be less straightforward. Aleo has dedicated types for these primitives: 1. `Field` is defined by the field on which elliptic curve operates. 2. `Group` of points on the elliptic curve used in Aleo. 3. `Scalars`, which are elements of cyclic group of order as the group above. ### SnarkOS This is a VM that runs in Aleo - a decentralized operating system for private applications. It forms the backbone of Aleo and enables applications to verify and store state in a publicly verifiable manner. ### Aleo [Aleo](https://developer.aleo.org/overview) is the name for the language to write programs, it feels similar to Assembly in the way how low level it is, but it also bares some resemblance to Rust. You can have a look at a few examples of using Aleo which we have done and are available [here](https://github.com/GurakG/aleo-learn-by-trial/tree/main/alto-language). The amount of primitives is very low, as you are limited to functions, variables, structs and records. ### Leo [Leo](https://developer.aleo.org/overview/leo) is a higher level language, which is compiled to Aleo. It is a statically typed language, which means that you need to define the types of variables and functions. It is also a functional language, which means that you can only use functions as a construct. Additionally, Leo is very similar to Rust, thus one can easily transfer their knowledge from Rust to Leo. Example of a Leo program can be found [here](https://github.com/GurakG/aleo-learn-by-trial/blob/main/leo-language/src/main.leo). We have actually seen a lot of users stick with Aleo, as it looks to be far more developed and mature than Leo. Yet we must note that debugging was very hard, as the error messages were not very helpful. Variables in Leo are pass by value, which means that when you pass a variable to a function, you are actually passing a copy of it. ### Deployment One can also deploy their programs to Aleo Network, which can be done by spinning up a node and connecting to the chain. The node will take a long time to start up, by downloading about 1GB of setup material to verify blockchain state transitions. ### Development Feasibility As a practice exercise we have decided to develop a voting application in Aleo. There have already been a few attempts to do so, one by the Aleo core team, [here](https://github.com/AleoHQ/leo/tree/testnet3/examples/vote), and another one by a community member, [here](https://github.com/zkprivacy/aleo-vote/tree/main/vtoken). First used an idea of tickets, where each voter is given a ticket that is then invalidated. Tickets are private records, which are burnt during voting. Voting is public. The problem is that distribution of tickets is out of the scope of the program, so it is not very useful. The second approach was focused on having a token one can vote with. There, for a token there exists a mapping between users and balances, and after each vote the balance is decreased. This behaves like a system where you pay for each vote. We could not just copy the solution from Ethereum, where they have a MiniMe tokens with history as right now Aleo does not support nested mappings. So our only option is to extend the second approach, by having a new voting token generated for each vote from the main token. However, this approach is only conceptual and we have not been able to implement it / it might not work. Another approach would be to do something simular to OVote, where we would store a hash of the merkle tree of the voters and then each voter would prove that they belong to the tree to cast a vote. And we would also add a mapping of nullifies to prevent double voting by an address. The Aleo has pedersen hash implemented, thus it will not be hard to do such a thing. However, we have not yet tried to implement it. ## Network There are 3 types of nodes in Aleo network: 1. Client - observe the blockchain and submit transactions to the mem pool. 2. Prover - generate proofs for Aleo programs executions and transaction correctness. For private transactions this is done by the client. 3. Verifier - verify proofs submitted to Aleo, construct blocks and submit them to the chain. ### Consensus Aleo uses Proof of Succinct Work, where miners are required to produce correct proofs for transactions, which are then bundled together into blocks by verifiers. The blocks are then added to the blockchain. ### Tokenomics Aleo has raised 200M$ in a private sale, and they are yet to start a public sale. The amount of tokens is not capped as the project decided to have an inflationary currency, with inflation dropping over time. Tokens are used to buy computation power much like gas in Ethereum, however here one pay Provers to prove correctness of your transaction. ### Community Aleo runs a set of community and bounty programs, which they have set aside 5M$ for. ## Conclusion Aleo is a very hot project, with a large community and a lot of effort put into it. Yet it is doing what the others are doing and so far it is hard to say what is their differentiating factor. Additionally, after working with Aleo it is hard to believe that a project with such funding is unable to provide a better developer experience for documentation and error messages. Yet as these are the first steps of the project, we are sure that they will improve in the future. Overall, Aleo will definitely be one of the big players in the space, and it is worth connecting with their team to later jump on the train.