Modal Title
Frontend Development

Aleo Introduces Private Application Development for Blockchain

Aleo is a Layer 1 blockchain using zero knowledge rollups, so aspects of its blockchain transactions benefit from maintaining a level of privacy.
Sep 27th, 2022 6:00am by
Featued image for: Aleo Introduces Private Application Development for Blockchain

Zero knowledge (zk) proofs are gaining traction in the blockchain space as a solution to a variety of different challenges. The concept has been around for quite a while in the cryptography space, originating in the 1985 paper, The Knowledge Complexity of Interactive Proof Systems. Up until recently, practical use cases have been limited due to computational complexity.

Zcash built a digital currency and transaction protocol leveraging zk proofs as a means of keeping transaction details private when two parties engage in commerce. This addresses one of the challenges of using blockchain for transactions, where you may not want everyone on the planet to know things about who you paid and how much you paid them — just like a majority of people wouldn’t share similar information from their bank account publicly either.

Ethereum virtual machine-compatible Layer 2 blockchains, like Polygon, are implementing zk-Rollups, which are essentially a large batch of transactions aggregated by the Layer 2 blockchain and presented to the Ethereum blockchain with a zero knowledge proof that validates their authenticity. This translates to 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, is expanding on these concepts to create an ecosystem for building decentralized applications for use cases where you may want to have some of the performance benefits from zk rollups, coupled with the notion that certain aspects of blockchain transactions benefit from maintaining a level of privacy.

Why dApps Need Privacy

One of the frequently touted 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 isn’t ideal. In an interview with The New Stack, Howard Wu, co-founder and CEO of Aleo, said, “There are a broad set of verticals where Web3 is missing privacy. It’s not because we need to bolt it on, it’s because many applications require some kind of information asymmetry or hiding of knowledge in order to even function correctly.”

One example Wu gave is using a blockchain for a game of poker. “A dealer can pass cards out to seven or eight other players and ask check or bet to each player,” he said. “Each player can produce a zero knowledge proof that follows each previous player and weave it into a single transaction that then gets broadcast on chain, playing one round of the game and then moving to the next round.” This all happens without individual players knowing who holds which cards.

Other real-world applications rely on a combination of public state and private state. What Aleo provides 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 requiring this flexibility. Wu said, “In elections, people want to vote, but they don’t want to show other people how they voted. The tally of the votes needs to be public to understand the outcome. Having private votes and public tallies ends up being a capable functionality in applications here.”

Smarter people than me can likely pick apart whether there are other risks in enabling a blockchain-enabled voting process, but in low-stakes decision-making, like DAO voting, I can certainly see how this might be useful.

From a developer implementation standpoint, any elements that are designated private are encrypted. The zero knowledge proof is what’s used to prove that a user is encrypting the data with their public address, meaning it is verifiable that the person taking the action is who they say they are, but the public address is encrypted so it isn’t viewable on chain. The zero knowledge proof is ultimately what attests to the encryption algo, decryption algo and the logic being run under the hood.

Writing Aleo dApps with Leo

One of the unique aspects of Aleo’s approach to dApp development is the accompanying Leo programming language. In my interview with Wu, I suggested that adding yet another programming language to the blockchain space might be detrimental to adoption. “When we started,” he replied, “we wanted to bolt this on to Rust or Typescript so that we didn’t have to reinvent the wheel. It turns out it’s really difficult to do that, because the things that you might think are cheap in one programming model are very expensive in this model. We ended up building a new language because under the hood what the compiler is doing is very different from traditional architecture.”

What exactly makes Leo different from Rust or Typescript? “What we have is a high-level language that gets compiled into polynomials that are executed inside of a proof system,” he said. “The proof system operates over polynomials to get you the final output. The final output looks just like a normal CPU’s 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 that could also be public at the user’s discretion. That’s the foundational difference in architecture.”

“If you use LLVM for Rust or C++,” he continued, “you basically need to break away from the LLVM architecture and invent a new architecture. The challenge is [that] the syntax you normally assume to be cheap on the high-level language ends up being very expensive.”

You can see the example syntax for determining which values are public or private in Leo below.

Aleo Leo programming language code example

One of the ways Aleo is attempting 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, each time an ERC-20 token is deployed, the SafeMath contract is also deployed. Aleo allows you to reference packages instead of re-using them in your code each 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 functions that were written before.”

Aleo is also making it possible to continue to build with existing tools. Wu said, “Most of the users interacting on blockchains are calling in from existing SDKs from their respective dApps. From our perspective, we are taking a stand on adding in JavaScript, Wasm and Rust support for interacting with Leo and Aleo programs from day one to make it as easy as possible to call into 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 completes in October. Howard Wu also recently posted a list of additional Aleo resources on GitHub. Whether zk proofs fundamentally change blockchain technology, they are also finding their way into non-blockchain applications as well. Back in May 2021, Cloudflare implemented zk proofs in their Privacy Pass to reduce the number of times an individual might need to fill out a captcha.

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.