Introducing Aztec’s Private Smart Contract Framework

Today we’re announcing, a powerful new smart contract framework for Aztec applications. enables smart contract developers to intuitively manage private state.

In other words, Aztec now has a smart contract language.

👀 Explore the Github repo here is a framework built on top of Noir, an open-source, universal zk programming language to which Aztec Labs is a core contributor. allows developers to write private smart contracts in Noir and extend their functionality with templated functions that simplify state management.

Last week we teased how simple and intuitive private state management would be on Aztec.

📕 Read the first post in this series: Privacy Abstraction with Aztec

Today we’re explaining how works and showing how you can get started building smart contracts and full-fledged privacy-preserving applications on Aztec.

The point of

The framework helps you deal with complex note management that is critical to privacy preservation within smart contract development.

But it does so in a way that makes it so that developers don’t have to rebuild smart contract functionality from scratch every time they write a Noir program.

Without, you wouldn’t be able to emit events, make calls to other contracts, or even have the notion of a contract or an address. You’d have no msg.sender or access to historic blockchain. takes Noir — a general zero knowledge programming language — and gives it the smart contract functionality and syntax developers might expect coming from Solidity.

Developers can now access a complete set of smart contract features:

  • Contracts (including callable contract functions and inter-contract function calls)
  • Persistent state variables
  • Contract address semantics
  • Access to msg.sender and other call context information
  • Access to transaction context information
  • Access to historic blockchain data
  • Events (logs) (both encrypted and unencrypted)
  • Cryptographic primitives
  • Cross-chain (L1 -> L2 and L2 -> L1) message passing

For examples of at work, check out examples of:

How we got here

At Aztec Labs we harbor two very strong beliefs:

  1. Privacy is the major unlock for the next leg of adoption. Having every single address, transaction, and balance exposed in plaintext is a non-starter for everyday users, businesses, and institutions coming on-chain.
  2. Privacy UX has to be better than the existing state of the art in blockchains. Privacy-preserving technology is only useful if the experience of using it isn’t better than what is available today.
0*vE0znpLWQV nnvww

The framework is a major step in improving the developer experience for managing private state — functionality that “vanilla” Noir doesn’t have.

For example for a simple private token contract, includes helper functions like:

  • get_balance
  • increment
  • decrement
  • etc.

In other words, the kinds of functions you might expect to call in a standard token contract!

Let’s walk through this private token contract to show you how helps with abstracting private note management:

Follow along in the Github repo of our private token contract example here

1*LhnBXX4tsGEL Fq6PyZk7Q
How private notes can be managed

Say Alice wants to send funds to Bob. Practically, she would have to aggregate all of the existing non-nullified notes they have of the asset she were sending, add up the values, and once she had enough notes to send the amount, create a change note to reconcile her balance.

For example, say Alice had two UTXO’s of 0.25 ETH each, and wanted to send 0.4 ETH to Bob. In order to spend the note Alice would have to sum the two 0.25 ETH notes together, nullify them both, and create a change note for herself of 0.1 ETH.

Thankfully, makes it easy to manage notes. Take for example the decrement and decrement_by_at_most functions written by the Aztec Labs team for the private token example above.

Here’s how decrement_by_at_most works:

Follow along with the decrement_by_at_most example here.

1. Find notes to decrement. The function begins by getting some notes that add up to max_amount or less from the set of notes owned by owner.

1*c1M Vzn357pasfyAvj7oJw

2. Destroy selected notes. It then iterates over these selected notes and destroys them, adding their values to a variable decremented.

1*X oKJdZFoHqUXeGSI9fdfw

3. Handle Change: If the total value of the destroyed notes (decremented) is greater than max_amount, it creates a new note with the excess value (change_value) and assigns it back to the owner.

1*t hml0r8wtK1iDcUt OGNQ

4. Return the Decrement: Finally, the function returns the total value that was decremented, which is stored in decremented.

The decrement example is a perfect showcase for how makes it easy to manage notes and nullifiers with built-in getinsertreplace, and remove functions.

If a dev wanted to write this without (as in, write it with “vanilla” aka non-smart-contract Noir), they would have to write their own Merkle trees to insert and prove membership of notes and support non-membership checks for nullifiers.

But as a developer, you don’t have to worry about rebuilding core privacy primitives — the Aztec Labs team has already done all of that work on your behalf.

You just focus on smart contract logic.

When will I get to play with all this cool tech?

Soon, anon, soon.

We’ll soon release a local developer environment for developers to write and test Aztec smart contracts against a local instance of an Aztec node.

Developers will soon get a full-fledged development kit for building smart contracts and applications on Aztec, supported by’s functionality.

But for now, you can preview what comes in the box.

Explore the Github repo here

Start familiarizing yourself with Noir syntax, since is simply a smart contract framework written in vanilla Noir.

To get started learning Noir, check out:

Finally, sign up for Aztec Labs’ developer e-mail list to stay apprised of all technical developments across Noir and Aztec:

📬 Subscribe here to the Aztec Labs Developer Dispatch, the latest news and releases about Aztec and Noir

To learn more about Aztec generally, keep up to date on our Discourse, where we discuss major protocol decisions like upgrade mechanisms and decentralizing sequencers.

Join our team

Aztec Labs is on the lookout for talented engineers, cryptographers, and business people to accelerate our vision of encrypted Ethereum.

If joining our mission to bring scalable privacy to Ethereum excites you, check out our open roles.

And continue the conversation with us on Twitter.