Aleo introduces private application development for Blockchain
Zero knowledge (zk) proof is gaining traction in the blockchain area as a solution to a number of different challenges. The concept has been around for quite some time in the field of cryptography, originating in the 1985 paper, The Knowledge Complexity of Interactive Proof Systems. Until recently, practical use cases have been limited due to computational complexity.
Zcash built a digital currency and transaction protocol that leverages zk proof as a means of keeping transaction details private when two parties trade. This solves one of the challenges of using blockchain for transactions, where you might not want everyone on the planet to know things about who you paid and how much you paid them – just as a majority of people wouldn’t want to share similar information from their bank account public rather.
Ethereum virtual machine-compatible Layer 2 blockchains, such as Polygon, implement zk-Rollups, which are essentially a large group of transactions aggregated by the Layer 2 blockchain and presented to the Ethereum blockchain with zero-knowledge proofs validating their authenticity. This means fewer Ethereum transactions, which in turn results in higher throughput and lower gas fees for interacting with the Ethereum blockchain.
Aleo, a Layer 1 blockchain, expands on these concepts to create an ecosystem for building decentralized applications for use cases where you might want some of the performance benefits of zk rollups, combined with the idea that certain aspects of blockchain transactions benefit from maintaining a level of privacy.
Why dApps need privacy
One of the often discussed aspects of blockchain technology is the public nature of all transactions. There are use cases, like the zcash example of maintaining some level of banking privacy, where fully public transaction data is not ideal. In an interview with The New Stack, Howard Wu, co-founder and CEO of Aleo, said, “There’s a broad set of verticals where Web3 lacks privacy. It’s not because we need to bolt it on, it’s because many applications require some sort of information asymmetry or hides knowledge to function properly.”
An example Wu gave is using a blockchain for a poker game. “A dealer might deal cards to seven or eight other players and ask each player to check or bet,” he said. “Each player can produce a zero-knowledge proof that follows every previous player and weave it into a single transaction that is then sent on chain, play one round of the game and then move on to the next round.” All of this happens without individual players knowing who has which cards.
Other real-world applications rely on a combination of public state and private state. What Aleo offers is a way for developers to make implementation decisions about information that is made public versus information that is kept private. Voting is another practical use case that requires this flexibility. Wu said: “In elections, people want to vote, but they don’t want to show others how they voted. The vote count needs to be public to understand the result. Having private votes and public votes ends up being a capable functionality in applications here.”
Smarter people than me can probably decide if there are other risks to enabling a blockchain-enabled voting process, but in low-stakes decisions like DAO voting, I can certainly see how this could be useful.
From a developer implementation point of view, all items designated as private are encrypted. The zero-knowledge proof is what is used to prove that a user encrypts the data with their public address, meaning that it can be verified that the person performing the action is who they say they are, but the public address is encrypted so that it is not visible on chain. The zero-knowledge proof is ultimately what attests to the encryption algo, the decryption algo, and the logic running under the hood.
Writing Aleo dApps with Leo
One of the unique aspects of Aleo’s approach to dApp development is the included Leo programming language. In my interview with Wu, I suggested that adding yet another programming language to the blockchain space could be detrimental to adoption. “When we started,” he replied, “we wanted to stick this to Rust or Typescript so we didn’t have to reinvent the wheel. It turns out that it’s very difficult to do that, because the things you might think are cheap in one programming model are very expensive in this model. We ended up building a new language because what the compiler does under the hood is very different from traditional architecture.”
What makes Leo different from Rust or Typescript? “What we have is a high-level language that compiles into polynomials that execute in a proof system,” he said. “The proof system operates over polynomials to give you the final result. The final output looks just like normal CPU output, but it comes with a zero-knowledge proof that can attest to the fact that the computation was run from a specific program on some hidden inputs which can also be public at the discretion of the user. That is the fundamental difference in architecture.”
“If you use LLVM for Rust or C++,” he continued, “you basically have to break away from the LLVM architecture and invent a new architecture. The challenge is [that] the syntax you normally assume is cheap in the high-level language ends up being very expensive.”
You can see the sample syntax for determining which values are public or private in Leo below.
One of the ways Aleo attempts to overcome the friction associated with implementing a new programming language is by making package management a core part of the Aleo ecosystem design. When developers build for Ethereum, the SafeMath contract is also distributed every time an ERC-20 token is distributed. Aleo allows you to reference packages instead of reusing them in your code every time. As Wu puts it, “The goal is to build an ecosystem of packages where you can start writing glue code as opposed to reinventing features that were written before.”
Aleo also makes it possible to continue building with existing tools. Wu said, “Most of the users interacting with blockchains are calling in from existing SDKs from their respective dApps. From our perspective, we are taking a stand to add JavaScript, Wasm, and Rust support for interacting with Leo and Aleo- programs from day one to make it as easy as possible to call in apps that were already deployed using traditional software stacks you’re already familiar with.”
Aleo is currently on its third testnet, with a mainnet release to follow after the final phase of the testnet is completed in October. Howard Wu also recently posted a list of several Aleo resources on GitHub. Whether zk-proofs fundamentally change blockchain technology, they also find their way into non-blockchain applications. Back in May 2021, Cloudflare implemented zk proof in their Privacy Pass to reduce the number of times a person had to fill out a captcha.